Select to view content in your preferred language

Saving Edits on IEditor causes Access Violation

419
0
06-15-2022 08:41 PM
MatthewWinslett
New Contributor II

 I am developing a tool that uses a EditorExtension to save edits on the IEditor object in ArcMap 10.5.  The save is triggered in an event handler for a custom event from another class.  After some validation to ensure that the save can proceed, this code is used for saving the edits:

 

 

 if (this.Editor.HasEdits())
                    {
                        ArcMap.Editor.StopEditing(true);                        
                        ArcMap.Editor.StartEditing(workspace); 
                    }

 

 

 

The problem is that when a point feature has been created and the code is run, ArcMap throws a Access Violation exception (according to the Windows Event Viewer and the Minidump that is generated) and quits.  This behavior does not occur when creating other types of features (polylines and polygons, for example), nor does it happen when modifying or deleting already existing features. 

If I use IWorkspaceEdit to save the edits, the problem doesn't occur.  Normally, I would just go with that approach, but this is a tool for ArcMap, and I need to sync with the Editor environment there, as well as its events to modify my UI based on the edit state.

I've tested with both versioned SDE data and feature classes stored in a file geodatabase, and the behavior is identical in both formats.  I've been chasing this one for a few days and can't figure out the problem.  If someone has any insight on what could be occurring here, I sure would appreciate it.

We are running 10.5, so I realize that this may have already been fixed in newer versions of Arc.  If so, that would be useful information to have as well.

Tags (2)
0 Kudos
0 Replies