<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Saving Edits on IEditor causes Access Violation in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/saving-edits-on-ieditor-causes-access-violation/m-p/1183403#M20482</link>
    <description>&lt;P&gt;&amp;nbsp;I am developing a tool that uses a EditorExtension to save edits on the IEditor object in ArcMap 10.5.&amp;nbsp; The save is triggered in an event handler for a custom event from another class.&amp;nbsp; After some validation to ensure that the save can proceed, this code is used for saving the edits:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; if (this.Editor.HasEdits())
                    {
                        ArcMap.Editor.StopEditing(true);                        
                        ArcMap.Editor.StartEditing(workspace); 
                    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; 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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use IWorkspaceEdit to save the edits, the problem doesn't occur.&amp;nbsp; 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.&lt;/P&gt;&lt;P&gt;I've tested with both versioned SDE data and feature classes stored in a file geodatabase, and the behavior is identical in both formats.&amp;nbsp; I've been chasing this one for a few days and can't figure out the problem.&amp;nbsp; If someone has any insight on what could be occurring here, I sure would appreciate it.&lt;/P&gt;&lt;P&gt;We are running 10.5, so I realize that this may have already been fixed in newer versions of Arc.&amp;nbsp; If so, that would be useful information to have as well.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jun 2022 04:22:45 GMT</pubDate>
    <dc:creator>MatthewWinslett</dc:creator>
    <dc:date>2022-06-16T04:22:45Z</dc:date>
    <item>
      <title>Saving Edits on IEditor causes Access Violation</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/saving-edits-on-ieditor-causes-access-violation/m-p/1183403#M20482</link>
      <description>&lt;P&gt;&amp;nbsp;I am developing a tool that uses a EditorExtension to save edits on the IEditor object in ArcMap 10.5.&amp;nbsp; The save is triggered in an event handler for a custom event from another class.&amp;nbsp; After some validation to ensure that the save can proceed, this code is used for saving the edits:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; if (this.Editor.HasEdits())
                    {
                        ArcMap.Editor.StopEditing(true);                        
                        ArcMap.Editor.StartEditing(workspace); 
                    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; 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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use IWorkspaceEdit to save the edits, the problem doesn't occur.&amp;nbsp; 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.&lt;/P&gt;&lt;P&gt;I've tested with both versioned SDE data and feature classes stored in a file geodatabase, and the behavior is identical in both formats.&amp;nbsp; I've been chasing this one for a few days and can't figure out the problem.&amp;nbsp; If someone has any insight on what could be occurring here, I sure would appreciate it.&lt;/P&gt;&lt;P&gt;We are running 10.5, so I realize that this may have already been fixed in newer versions of Arc.&amp;nbsp; If so, that would be useful information to have as well.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2022 04:22:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/saving-edits-on-ieditor-causes-access-violation/m-p/1183403#M20482</guid>
      <dc:creator>MatthewWinslett</dc:creator>
      <dc:date>2022-06-16T04:22:45Z</dc:date>
    </item>
  </channel>
</rss>

