<?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: I'm getting a new error calling GraphicsOverlay.Graphics.Add(graphic): &amp;quot;Cannot call this method in this context: Graphic already has an assigned id.&amp;quot; in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311257#M3622</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Phil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have a candidate fix for this issue that is currently being tested. It involved some changes to our internal graphic id allocation and management. If it proves to be robust with no regressions we should be able to include it in our next release. Unfortunately we still have not been able to repro the issue with&amp;nbsp;the code you provided.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding your repro code, by using the await keyword you are awaiting your SetGraphicSymbolAsync task and therefore effectively doing that work in the background. The Task.Wait() call is a blocking call which would wait until the task is finished.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Feb 2017 23:15:49 GMT</pubDate>
    <dc:creator>MichaelBranscomb</dc:creator>
    <dc:date>2017-02-15T23:15:49Z</dc:date>
    <item>
      <title>I'm getting a new error calling GraphicsOverlay.Graphics.Add(graphic): "Cannot call this method in this context: Graphic already has an assigned id."</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311251#M3616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This call fails intermittently, and I can't figure out&amp;nbsp;why. &amp;nbsp;&lt;/P&gt;&lt;P&gt;Graphic is newly created in the same method; I'm definitely not adding a graphic multiple times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stack Trace:&lt;/P&gt;&lt;P&gt;at Esri.ArcGISRuntime.ArcGISException.HandleCoreError(CoreError error, Boolean throwException)&lt;BR /&gt; at RuntimeCoreNet.GeneratedWrappers.Interop.CheckError(IntPtr errorHandle, Boolean throwOnFailure, GCHandle wrapperHandle)&lt;BR /&gt; at RuntimeCoreNet.GeneratedWrappers.CoreVector.Insert(Int64 position, CoreElement value)&lt;BR /&gt; at Esri.ArcGISRuntime.RuntimeCollection`1.InsertItem(Int32 index, T item)&lt;BR /&gt; at Esri.ArcGISRuntime.RuntimeObservableCollection`1.InsertItem(Int32 index, T item)&lt;BR /&gt; at Infor.Mobile.Core.WRT.Windows.UI.Mapping.EsriMap.AddMarkerInternal(IMapMarker marker)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Nov 2016 20:00:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311251#M3616</guid>
      <dc:creator>PhilScovis</dc:creator>
      <dc:date>2016-11-29T20:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a new error calling GraphicsOverlay.Graphics.Add(graphic): "Cannot call this method in this context: Graphic already has an assigned id."</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311252#M3617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please share your code that reproduces the problem ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Nov 2016 22:36:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311252#M3617</guid>
      <dc:creator>PreetiMaske</dc:creator>
      <dc:date>2016-11-29T22:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a new error calling GraphicsOverlay.Graphics.Add(graphic): "Cannot call this method in this context: Graphic already has an assigned id."</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311253#M3618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't have a small sample that reproduces the error.&amp;nbsp; This code runs fine about 99% of the time, and randomly seems to fail.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt; &lt;SPAN class="keyword token"&gt;protected&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;override&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;AddMarkerInternal&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;IMapMarker marker&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Graphic graphic &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;Graphic&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;EsriMapProjection&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;ProjectDataToMap&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;marker&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Location&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Attributes&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;MarkerIdAttributeName&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; marker&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Id&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;SetGraphicSymbolAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;graphic&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; marker&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ImageResourceId&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;true&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _MarkersLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Graphics&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Add&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;graphic&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;catch&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token class-name"&gt;InvalidOperationException&lt;/SPAN&gt; ex&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;// Unexplained error:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;&lt;SPAN&gt;// &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Farcg.is%2F2gGn7O5" target="_blank"&gt;http://arcg.is/2gGn7O5&lt;/A&gt;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LogService&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;GetLogger&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Error&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Error adding marker graphic"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ex&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As you can see, I'm creating the graphic right at the top, setting some attributes, and adding it to the layer.&amp;nbsp; SetGraphicSymbolAsync is our own method that adds a PictureMarkerSymbol to the graphic, in a platform-specific way.&lt;/P&gt;&lt;P&gt;Let me know if you need more information.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:53:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311253#M3618</guid>
      <dc:creator>PhilScovis</dc:creator>
      <dc:date>2021-12-11T14:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a new error calling GraphicsOverlay.Graphics.Add(graphic): "Cannot call this method in this context: Graphic already has an assigned id."</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311254#M3619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error you mentioned indicates you are hitting a bug but we tried reproducing the issue by writing code using similar workflow and were not able to reproduce it. There are couple things you can do to help us narrow down the problem. Can you please try changing the code with one option at a time and run your code and see if it still reproduces the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- await &lt;SPAN&gt;SetGraphicSymbolAsync&lt;/SPAN&gt; method that sets the picturemarkersymbol.&lt;/P&gt;&lt;P&gt;- Get rid of async symbol stuff altogether or replace PictureMarkerSymbol with a SimpleMarkerSymbol.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10pt;"&gt;Preeti&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2016 18:07:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311254#M3619</guid>
      <dc:creator>PreetiMaske</dc:creator>
      <dc:date>2016-11-30T18:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a new error calling GraphicsOverlay.Graphics.Add(graphic): "Cannot call this method in this context: Graphic already has an assigned id."</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311255#M3620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Both of these suggestions cleared up the problem entirely.&amp;nbsp; &lt;/P&gt;&lt;P&gt;I think for our application, it will be acceptable to await the setting of the graphic symbol, although I'd prefer to let the images load in the background.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your attention to our little problem; let me know if there's anything more I can do to help you narrow down the cause.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2016 18:42:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311255#M3620</guid>
      <dc:creator>PhilScovis</dc:creator>
      <dc:date>2016-11-30T18:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a new error calling GraphicsOverlay.Graphics.Add(graphic): "Cannot call this method in this context: Graphic already has an assigned id."</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311256#M3621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad the workaround worked. I am still curious if I can repro the problem and find cause of failure with background loading. Will be you be able to share your code for setting platform specific image. If want you can direct email me &lt;A href="mailto:pmaske@esri.com"&gt;pmaske@esri.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Preeti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2016 19:25:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311256#M3621</guid>
      <dc:creator>PreetiMaske</dc:creator>
      <dc:date>2016-11-30T19:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: I'm getting a new error calling GraphicsOverlay.Graphics.Add(graphic): "Cannot call this method in this context: Graphic already has an assigned id."</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311257#M3622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Phil,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have a candidate fix for this issue that is currently being tested. It involved some changes to our internal graphic id allocation and management. If it proves to be robust with no regressions we should be able to include it in our next release. Unfortunately we still have not been able to repro the issue with&amp;nbsp;the code you provided.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding your repro code, by using the await keyword you are awaiting your SetGraphicSymbolAsync task and therefore effectively doing that work in the background. The Task.Wait() call is a blocking call which would wait until the task is finished.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Feb 2017 23:15:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/i-m-getting-a-new-error-calling-graphicsoverlay/m-p/311257#M3622</guid>
      <dc:creator>MichaelBranscomb</dc:creator>
      <dc:date>2017-02-15T23:15:49Z</dc:date>
    </item>
  </channel>
</rss>

