<?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 Re: Debugging EditOperation in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/debugging-editoperation/m-p/1194775#M8474</link>
    <description>&lt;P&gt;Thank you for the reply, Wolf. My search did not come up with the post you linked; It gave me an understanding of why this was happening. Seems like a bug only in so far as the EditOperation's ErrorMessage is misleading. Not doing anything when it is not given anything to do isn't really a failure.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jul 2022 00:46:09 GMT</pubDate>
    <dc:creator>BerndtNording</dc:creator>
    <dc:date>2022-07-22T00:46:09Z</dc:date>
    <item>
      <title>Debugging EditOperation</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/debugging-editoperation/m-p/1193681#M8445</link>
      <description>&lt;P&gt;Is there a way to get more information when an EditOperation fails using the SDK? I have an addin that populates a field in a layer with values and it works fine the first time, but fails when I run it again. Further investigation showed that the edit operation works when the existing values are &amp;lt;null&amp;gt;, but fails if the existing values are not null. But more generally, i would like to get a reason when an EditOperation fails.&lt;/P&gt;&lt;P&gt;An abbreviated part of my code:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;EditOperation assignIDEditOp = new EditOperation();
              assignIDEditOp.Name = "assignIDEditOp";
              assignIDEditOp.SelectModifiedFeatures = false;
              assignIDEditOp.SelectNewFeatures = false;

                strID += (j + 1).ToString(fmt);
                pInsp = new Inspector(true);
                pInsp.Load(pLay, pOID);
                pInsp["ID"] = strID;
                assignIDEditOp.Modify(pInsp);

              isOK = assignIDEditOp.Execute();
              if (!isOK)
              {
                MessageBox.Show(assignIDEditOp.ErrorMessage);
              }&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 19 Jul 2022 21:18:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/debugging-editoperation/m-p/1193681#M8445</guid>
      <dc:creator>BerndtNording</dc:creator>
      <dc:date>2022-07-19T21:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Debugging EditOperation</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/debugging-editoperation/m-p/1194221#M8464</link>
      <description>&lt;P&gt;Unfortunately, there is only a general error message for this type of failure.&amp;nbsp; &amp;nbsp;We are still checking if this is a potential bug.&amp;nbsp; What i see in my test add-in is that i can set the value only if the value is different.&amp;nbsp; For example: if your ID field already has a value of '5' i can't perform the update by writing a new value of '5', instead that would cause the 'operation failed' error.&amp;nbsp; However, i can write a value of '6'.&amp;nbsp; In my sample snippet below i write a time string that changes every minute, but i can't write the new value unless it's different.&amp;nbsp; This is a work around you can use since IsEmpty is true if no values have changed:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if (!assignIDEditOp.IsEmpty)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; // write the new value ....&lt;BR /&gt;&amp;nbsp; var isOK = assignIDEditOp.Execute();&lt;BR /&gt;&amp;nbsp;...&lt;BR /&gt;}&lt;BR /&gt;The sample snippet is for 2.9,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected override void OnClick()
{
    var pLay = MapView.Active?.Map.GetLayersAsFlattenedList()
        .OfType&amp;lt;FeatureLayer&amp;gt;().Where(r =&amp;gt; r.Name == "TestPoints")
        .FirstOrDefault();
    if (pLay == null) return;
    var updateId = 5;
    QueuedTask.Run(() =&amp;gt;
    {
        EditOperation assignIDEditOp = new EditOperation
        {
            Name = "assignIDEditOp",
            SelectModifiedFeatures = false,
            SelectNewFeatures = false
        };

        var strID = $@"ID={DateTime.Now.ToShortTimeString()}";
        var pInsp = new Inspector(true);  // 3.0 doesn't need isFeatureEditing: true anymore
        pInsp.Load(pLay, 5);
        {
            pInsp["TheString"] = strID;
            assignIDEditOp.Modify(pInsp);
            if (!assignIDEditOp.IsEmpty)
            {
                var isOK = assignIDEditOp.Execute();
                if (!isOK)
                {
                    MessageBox.Show(assignIDEditOp.ErrorMessage);
                }
            }
        }
    });
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It turns out that there's a previous post about this issue:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-failed/m-p/1178371#M8204" target="_blank"&gt;https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-failed/m-p/1178371#M8204&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2022 23:35:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/debugging-editoperation/m-p/1194221#M8464</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2022-07-20T23:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: Debugging EditOperation</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/debugging-editoperation/m-p/1194775#M8474</link>
      <description>&lt;P&gt;Thank you for the reply, Wolf. My search did not come up with the post you linked; It gave me an understanding of why this was happening. Seems like a bug only in so far as the EditOperation's ErrorMessage is misleading. Not doing anything when it is not given anything to do isn't really a failure.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 00:46:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/debugging-editoperation/m-p/1194775#M8474</guid>
      <dc:creator>BerndtNording</dc:creator>
      <dc:date>2022-07-22T00:46:09Z</dc:date>
    </item>
  </channel>
</rss>

