<?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 Feature Layer Save Bug? in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/feature-layer-save-bug/m-p/714673#M18375</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In Silverlight API 3.1 I encountered this possible bug trying to save a feature layer created in code-behind.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All in code-behind:&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;Create a new FeatureLayer with where = "1&amp;lt;&amp;gt;1".&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Initialize and Update feature layer in that order and wait for those to complete.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Create a new graphic and add it to the feature layer.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Remove graphic from feature layer.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;FeatureLayer.HasEdits returns with &lt;SPAN style="text-decoration:underline;"&gt;true&lt;/SPAN&gt;, now call FeatureLayer.SaveEdits().&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;SaveEditsFailed, EndSaveEdits, BeginSaveEdits events are never fired.&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt;The bug is: although FeatureLayer.HasEdits = true, it in fact does not have any edits. So I check to see if it has edits, and it falsely returns that it does so I call SaveEdits() and I'm using something like a wait indicator letting the user know to hold up while I save this. And the wait is for infinity because SaveEditsFailed, EndSaveEdits, BeginSaveEdits events are never fired.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My workaround is to call FeatureLayer.UndoEdits(Graphic), check if FeatureLayer.Graphics contains Graphic and delete if so, then HasEdits returns correctly and I can skip saving if there is in-fact no edits to save. The UndoEdits works well in the scenario above because it removes the newly added graphic and correctly sets the HasEdits to false.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Mar 2013 20:01:26 GMT</pubDate>
    <dc:creator>RobChouinard</dc:creator>
    <dc:date>2013-03-18T20:01:26Z</dc:date>
    <item>
      <title>Feature Layer Save Bug?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/feature-layer-save-bug/m-p/714673#M18375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In Silverlight API 3.1 I encountered this possible bug trying to save a feature layer created in code-behind.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All in code-behind:&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;Create a new FeatureLayer with where = "1&amp;lt;&amp;gt;1".&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Initialize and Update feature layer in that order and wait for those to complete.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Create a new graphic and add it to the feature layer.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;Remove graphic from feature layer.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;FeatureLayer.HasEdits returns with &lt;SPAN style="text-decoration:underline;"&gt;true&lt;/SPAN&gt;, now call FeatureLayer.SaveEdits().&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;SaveEditsFailed, EndSaveEdits, BeginSaveEdits events are never fired.&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt;The bug is: although FeatureLayer.HasEdits = true, it in fact does not have any edits. So I check to see if it has edits, and it falsely returns that it does so I call SaveEdits() and I'm using something like a wait indicator letting the user know to hold up while I save this. And the wait is for infinity because SaveEditsFailed, EndSaveEdits, BeginSaveEdits events are never fired.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My workaround is to call FeatureLayer.UndoEdits(Graphic), check if FeatureLayer.Graphics contains Graphic and delete if so, then HasEdits returns correctly and I can skip saving if there is in-fact no edits to save. The UndoEdits works well in the scenario above because it removes the newly added graphic and correctly sets the HasEdits to false.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Mar 2013 20:01:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/feature-layer-save-bug/m-p/714673#M18375</guid>
      <dc:creator>RobChouinard</dc:creator>
      <dc:date>2013-03-18T20:01:26Z</dc:date>
    </item>
  </channel>
</rss>

