<?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 Edit operation failed. - generic message in ArcGIS Pro SDK in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/edit-operation-failed-generic-message-in-arcgis/m-p/880781#M5659</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm getting an intermittent error during an editing. This code is running as part of a Pro Add-in that I'm writing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error doesn't happen every time this function runs but if I repeatedly run this function it will eventually fail. Sometimes it will take 2 tries and other times it will take 20 ties. When running through Visual Studio it will error more frequently. When running as the compiled Add-in, it takes longer to error.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;It fails at the insp.ApplyAsync() call with an error message with the heading "Update Feature Attributes" and the message text of "Edit operation failed.". This is some very generic message.&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="412446" alt="Edit operation failed." class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/412446_error.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Another strange thing is that it doesn't hit my error handling for this initial message but after I close the initial message it will then drop to my error handling.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Part of the application's requirements is that I don't need to prompt the user to save edits.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also tried EditOperation combined with SaveEditsAsync() with the same error results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The feature class is stored in a file geodatabase on my local drive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ArcGIS Pro 2.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know how to prevent this error or code around it somehow?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;internal static async Task&amp;lt;int&amp;gt; UpdateBoundarySubdivisionAttribute(string strSelectedAppNo, string strNewSubdivisions)&lt;BR /&gt;{&lt;BR /&gt; try&lt;BR /&gt; {&lt;BR /&gt; await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(async () =&amp;gt;&lt;BR /&gt; {&lt;BR /&gt; // Find boundary layer.&lt;BR /&gt; var disLayer = ArcGIS.Desktop.Mapping.MapView.Active.Map.FindLayers(Settings.Get("pyp_boundary_layer_name")).FirstOrDefault() as BasicFeatureLayer;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Search by application number attribute.&lt;BR /&gt; var queryFilter = new ArcGIS.Core.Data.QueryFilter();&lt;BR /&gt; queryFilter.WhereClause = "APPLICATION_NUMBER = '" + strSelectedAppNo + "'";&lt;BR /&gt; var rc = disLayer.Search(queryFilter);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create list of oids to update. There should only be one.&lt;BR /&gt; var oidSet = new List&amp;lt;long&amp;gt;();&lt;BR /&gt; while (rc.MoveNext()) { oidSet.Add(rc.Current.GetObjectID()); }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create Inspector.&lt;BR /&gt; var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector();&lt;BR /&gt; insp.Load(disLayer, oidSet);&lt;BR /&gt; insp["SUBDNAME"] = strNewSubdivisions;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Save edits with no undo. If you want the undo option then use EditOperation().&lt;BR /&gt; if (true != await insp.ApplyAsync()) // &amp;lt;-- point of error "Update Feature Attributes" "Edit operation failed."&lt;BR /&gt; {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;string ERR_PROC = " UpdateBoundarySubdivisionAttribute() ";&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;System.Windows.MessageBox.Show("Error in ApplyAsync() ErrProcedure = " + ERR_PROC + " Unable to save edits the the feature class.", "Update Boundary Subdivision Error", MessageBoxButton.OK, MessageBoxImage.Error);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;return;&lt;BR /&gt; }&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;return await Task.FromResult(0);&lt;BR /&gt; }&lt;BR /&gt; catch (Exception ex)&lt;BR /&gt; {&lt;BR /&gt; string ERR_PROC = " UpdateBoundarySubdivisionAttribute() ";&lt;BR /&gt; System.Windows.MessageBox.Show("ErrProcedure = " + ERR_PROC + ex.Message, "Update Boundary Subdivision Error", MessageBoxButton.OK, MessageBoxImage.Error);&lt;BR /&gt; return await Task.FromResult(1); // Return error&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Jun 2018 15:09:39 GMT</pubDate>
    <dc:creator>BillMacPherson</dc:creator>
    <dc:date>2018-06-27T15:09:39Z</dc:date>
    <item>
      <title>Edit operation failed. - generic message in ArcGIS Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/edit-operation-failed-generic-message-in-arcgis/m-p/880781#M5659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm getting an intermittent error during an editing. This code is running as part of a Pro Add-in that I'm writing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error doesn't happen every time this function runs but if I repeatedly run this function it will eventually fail. Sometimes it will take 2 tries and other times it will take 20 ties. When running through Visual Studio it will error more frequently. When running as the compiled Add-in, it takes longer to error.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;It fails at the insp.ApplyAsync() call with an error message with the heading "Update Feature Attributes" and the message text of "Edit operation failed.". This is some very generic message.&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="412446" alt="Edit operation failed." class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/412446_error.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Another strange thing is that it doesn't hit my error handling for this initial message but after I close the initial message it will then drop to my error handling.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Part of the application's requirements is that I don't need to prompt the user to save edits.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also tried EditOperation combined with SaveEditsAsync() with the same error results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The feature class is stored in a file geodatabase on my local drive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ArcGIS Pro 2.0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know how to prevent this error or code around it somehow?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;internal static async Task&amp;lt;int&amp;gt; UpdateBoundarySubdivisionAttribute(string strSelectedAppNo, string strNewSubdivisions)&lt;BR /&gt;{&lt;BR /&gt; try&lt;BR /&gt; {&lt;BR /&gt; await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(async () =&amp;gt;&lt;BR /&gt; {&lt;BR /&gt; // Find boundary layer.&lt;BR /&gt; var disLayer = ArcGIS.Desktop.Mapping.MapView.Active.Map.FindLayers(Settings.Get("pyp_boundary_layer_name")).FirstOrDefault() as BasicFeatureLayer;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Search by application number attribute.&lt;BR /&gt; var queryFilter = new ArcGIS.Core.Data.QueryFilter();&lt;BR /&gt; queryFilter.WhereClause = "APPLICATION_NUMBER = '" + strSelectedAppNo + "'";&lt;BR /&gt; var rc = disLayer.Search(queryFilter);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create list of oids to update. There should only be one.&lt;BR /&gt; var oidSet = new List&amp;lt;long&amp;gt;();&lt;BR /&gt; while (rc.MoveNext()) { oidSet.Add(rc.Current.GetObjectID()); }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create Inspector.&lt;BR /&gt; var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector();&lt;BR /&gt; insp.Load(disLayer, oidSet);&lt;BR /&gt; insp["SUBDNAME"] = strNewSubdivisions;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Save edits with no undo. If you want the undo option then use EditOperation().&lt;BR /&gt; if (true != await insp.ApplyAsync()) // &amp;lt;-- point of error "Update Feature Attributes" "Edit operation failed."&lt;BR /&gt; {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;string ERR_PROC = " UpdateBoundarySubdivisionAttribute() ";&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;System.Windows.MessageBox.Show("Error in ApplyAsync() ErrProcedure = " + ERR_PROC + " Unable to save edits the the feature class.", "Update Boundary Subdivision Error", MessageBoxButton.OK, MessageBoxImage.Error);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;return;&lt;BR /&gt; }&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;return await Task.FromResult(0);&lt;BR /&gt; }&lt;BR /&gt; catch (Exception ex)&lt;BR /&gt; {&lt;BR /&gt; string ERR_PROC = " UpdateBoundarySubdivisionAttribute() ";&lt;BR /&gt; System.Windows.MessageBox.Show("ErrProcedure = " + ERR_PROC + ex.Message, "Update Boundary Subdivision Error", MessageBoxButton.OK, MessageBoxImage.Error);&lt;BR /&gt; return await Task.FromResult(1); // Return error&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2018 15:09:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/edit-operation-failed-generic-message-in-arcgis/m-p/880781#M5659</guid>
      <dc:creator>BillMacPherson</dc:creator>
      <dc:date>2018-06-27T15:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: Edit operation failed. - generic message in ArcGIS Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/edit-operation-failed-generic-message-in-arcgis/m-p/880782#M5660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A couple suggestions...&lt;/P&gt;&lt;UL style="list-style-type: circle;"&gt;&lt;LI&gt;You should call Dispose() on your cursor after using it the canonical way of doing this is with the using block.&lt;/LI&gt;&lt;LI&gt;You should verify some rows were found (oidSet isn't empty) before attempting to make an edit.&lt;/LI&gt;&lt;LI&gt;You should verify at least one of these rows doesn't already have this value for "SUBDNAME" set before attempting to make an edit (non-edits&amp;nbsp;may still be reported as 'failed' (well they certainly didn't 'succeed').&lt;/LI&gt;&lt;LI&gt;ApplyAsync on the inspector creates its own edit operation, which is setup to report a failed edit through a modal dialog.&amp;nbsp; If you want more control over the operation you can create your own...&lt;/LI&gt;&lt;/UL&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; var op = new EditOperation();
 // op.ShowModalMessageAfterFailure = false; // This shouldn't be necessary as its the default (but not through inspector.ApplyAsync()
 op.Modify(insp);
 bool succeeded = op.Execute();&lt;/PRE&gt;&lt;UL style="list-style-type: circle;"&gt;&lt;LI&gt;You shouldn't call MessageBox.Show from the background thread, UI should be reported on the UI thread.&lt;/LI&gt;&lt;LI&gt;This is overly convoluted and non-idiomatic.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return 0; is preferred.&lt;/LI&gt;&lt;/UL&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;return await Task.FromResult(0);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 17:02:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/edit-operation-failed-generic-message-in-arcgis/m-p/880782#M5660</guid>
      <dc:creator>JohnJones</dc:creator>
      <dc:date>2021-12-12T17:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Edit operation failed. - generic message in ArcGIS Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/edit-operation-failed-generic-message-in-arcgis/m-p/880783#M5661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;John, Thank you for you thoughtful reply and list of suggestions. I was called away to work on another project so I'm just now able to get back to this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have applied your suggestions to my function (see the revised code below). The result is just the same as before. I'm still getting the same generic "Edit operation failed" that I was getting before and it is still just as random as before. The error still occurs on the insp.ApplyAsync() function call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also tried&amp;nbsp; await insp.LoadAsync() but that didn't help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could this be a bug within the inspector.&lt;SPAN&gt;ApplyAsync() function call? If you have any other suggestions, I would appreciate the help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ArcGIS Pro 2.0, Visual Studio 2017 community edition, file geodatabase.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;internal static async Task&amp;lt;int&amp;gt; UpdateBoundarySubdivisionAttribute(string strSelectedAppNo, string strNewSubdivisions)&lt;BR /&gt; {&lt;BR /&gt; Debug.WriteLine(" UpdateBoundarySubdivisionAttribute() start");&lt;BR /&gt; try&lt;BR /&gt; {&lt;BR /&gt; await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(async () =&amp;gt;&lt;BR /&gt; {&lt;BR /&gt; // Find boundary layer.&lt;BR /&gt; var disLayer = ArcGIS.Desktop.Mapping.MapView.Active.Map.FindLayers(Settings.Get("pyp_boundary_layer_name")).FirstOrDefault() as BasicFeatureLayer;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Search by application number attribute.&lt;BR /&gt; var queryFilter = new ArcGIS.Core.Data.QueryFilter&lt;BR /&gt; {&lt;BR /&gt; WhereClause = "APPLICATION_NUMBER = '" + strSelectedAppNo + "'"&lt;BR /&gt; };&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Add each ObjectID to the List.&lt;BR /&gt; var oidSet = new List&amp;lt;long&amp;gt;();&lt;BR /&gt; using (RowCursor rc = disLayer.Search(queryFilter))&lt;BR /&gt; {&lt;BR /&gt;while (rc.MoveNext())&lt;BR /&gt; {&lt;BR /&gt; oidSet.Add(rc.Current.GetObjectID());&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// There should be one ObjectID - boundary feature.&lt;BR /&gt; if (oidSet.Count &amp;lt; 1)&lt;BR /&gt; {&lt;BR /&gt; // This shouldn't happen. There should always be one boundary feature for this AppNo.&lt;BR /&gt; return;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Create Inspector.&lt;BR /&gt; ArcGIS.Desktop.Editing.Attributes.Inspector insp = new ArcGIS.Desktop.Editing.Attributes.Inspector();&lt;/P&gt;&lt;P&gt;insp.Load(disLayer, oidSet);&lt;/P&gt;&lt;P&gt;insp["SUBDNAME"] = strNewSubdivisions;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (true != await insp.ApplyAsync())&lt;BR /&gt; {&lt;BR /&gt; return; // Return error&lt;BR /&gt; }&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Return success&lt;BR /&gt; return 0;&lt;BR /&gt;}&lt;BR /&gt; catch (Exception ex)&lt;BR /&gt; {&lt;BR /&gt; string ERR_PROC = " UpdateBoundarySubdivisionAttribute() ";&lt;BR /&gt; System.Windows.MessageBox.Show("ErrProcedure = " + ERR_PROC + ex.Message, "Update Boundary Subdivision Error", MessageBoxButton.OK, MessageBoxImage.Error);&lt;BR /&gt; return 1; // Return error&lt;BR /&gt;}&lt;BR /&gt; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Aug 2018 14:04:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/edit-operation-failed-generic-message-in-arcgis/m-p/880783#M5661</guid>
      <dc:creator>BillMacPherson</dc:creator>
      <dc:date>2018-08-07T14:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Edit operation failed. - generic message in ArcGIS Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/edit-operation-failed-generic-message-in-arcgis/m-p/880784#M5662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As you are seeing the issue with a file geodatabase is there any chance you can post your data (or a&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;subset where you can still duplicate the sporadic problem)? Similarly with your entire add-in code. ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;If the data and/or code is proprietary I understand if you can't post it, but it&amp;nbsp;may&amp;nbsp;help us duplicate the problem a little&amp;nbsp;more quickly.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Right now we've identified one data locking issue which returns the 'edit operation failed' rather than something more specific.&amp;nbsp; But it is not a sporadic problem and can be&amp;nbsp;reproduced with a clear set of steps.&amp;nbsp; &amp;nbsp;We are working on resolving this issue but it's unclear whether your problem is a data locking issue or something else.&amp;nbsp; &amp;nbsp;The data and code along with&amp;nbsp;some reproducible steps (even for a sporadic problem)&amp;nbsp;&amp;nbsp;will&amp;nbsp;help us with trying to track down your problem.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Narelle&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2018 18:05:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/edit-operation-failed-generic-message-in-arcgis/m-p/880784#M5662</guid>
      <dc:creator>NarelleChedzey</dc:creator>
      <dc:date>2018-08-08T18:05:28Z</dc:date>
    </item>
  </channel>
</rss>

