When I delete a feature in my map, I have a list of child features that also need to be deleted. When the parent is deleted, the child features of a different type also need to be deleted. So I trigger this code to get this done. When a delete is triggered, i successfully get the list of Rows, then a call delete and I get this error on the .Execute() line
"Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt”
//Delete all of the lists created above
foreach (List<Row> individualRowList in ListsOfLists)
{
if (!individualRowList.IsNullOrEmpty())
{
EditOperation deleteOperation = new EditOperation()
{
Name = string.Format("Deleted {0}", individualRowList),
SelectModifiedFeatures = false,
SelectNewFeatures = false
};
deleteOperation.Delete(individualRowList);
deleteOperation.Execute();
}
}
When removing items by looping through a list, you should loop through the rows in reverse.