<?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 Update KmlLayer ArcGis Runtime SDK .NET in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/update-kmllayer-arcgis-runtime-sdk-net/m-p/453817#M5551</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having an issue with updating a KmlLayer in MySceneView.Scene.Layers. This is constantly updated at less than 30fps. I have multiple threads (max of 4) calling this function, each has a unique ID. The contents of the kml changes, but the URI remains the same (each thread also has its own kml with different Uri). The problem I'm having is that my application is randomly crashing after running for about a minute, and it's not telling my why. It just says MyProgram has stopped working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Monitor.Enter(MySceneView.Scene.Layers);
try
{
&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var kmlLayer = new KmlLayer(sourceUri); //sourceUri is a local file&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; kmlLayer.ID = id;
&amp;nbsp;&amp;nbsp;&amp;nbsp; kmlLayer.Opacity = _alpha;
&amp;nbsp;&amp;nbsp;&amp;nbsp; kmlLayer.IsVisible = _visibility;
&amp;nbsp;&amp;nbsp;&amp;nbsp; kmlLayer.InitializeAsync();
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (MySceneView.Scene.Layers[id] != null)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MySceneView.Scene.Layers.Remove(id);
&amp;nbsp;&amp;nbsp;&amp;nbsp; MySceneView.Scene.Layers.Add(kmlLayer);
}
finally
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; Monitor.Exit(MySceneView.Scene.Layers);
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also tried replacing the layer instead of removing it, but it also crashes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if (MySceneView.Scene.Layers[id] == null)
&amp;nbsp;&amp;nbsp;&amp;nbsp; MySceneView.Scene.Layers.Add(kmlLayer);
else
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = MySceneView.Scene.Layers.Count - 1; i &amp;gt;= 0; i--)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (MySceneView.Scene.Layers&lt;I&gt;.ID == id)&lt;/I&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; MySceneView.Scene.Layers&lt;I&gt; = kmlLayer; //I cant replace the layer using the id as an index, since it's read only using a string index&lt;/I&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/PRE&gt;&lt;P&gt;Any help would be appreciated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 20:14:27 GMT</pubDate>
    <dc:creator>JasonTrinidad1</dc:creator>
    <dc:date>2021-12-11T20:14:27Z</dc:date>
    <item>
      <title>Update KmlLayer ArcGis Runtime SDK .NET</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/update-kmllayer-arcgis-runtime-sdk-net/m-p/453817#M5551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am having an issue with updating a KmlLayer in MySceneView.Scene.Layers. This is constantly updated at less than 30fps. I have multiple threads (max of 4) calling this function, each has a unique ID. The contents of the kml changes, but the URI remains the same (each thread also has its own kml with different Uri). The problem I'm having is that my application is randomly crashing after running for about a minute, and it's not telling my why. It just says MyProgram has stopped working.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Monitor.Enter(MySceneView.Scene.Layers);
try
{
&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var kmlLayer = new KmlLayer(sourceUri); //sourceUri is a local file&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; kmlLayer.ID = id;
&amp;nbsp;&amp;nbsp;&amp;nbsp; kmlLayer.Opacity = _alpha;
&amp;nbsp;&amp;nbsp;&amp;nbsp; kmlLayer.IsVisible = _visibility;
&amp;nbsp;&amp;nbsp;&amp;nbsp; kmlLayer.InitializeAsync();
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (MySceneView.Scene.Layers[id] != null)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MySceneView.Scene.Layers.Remove(id);
&amp;nbsp;&amp;nbsp;&amp;nbsp; MySceneView.Scene.Layers.Add(kmlLayer);
}
finally
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; Monitor.Exit(MySceneView.Scene.Layers);
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also tried replacing the layer instead of removing it, but it also crashes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if (MySceneView.Scene.Layers[id] == null)
&amp;nbsp;&amp;nbsp;&amp;nbsp; MySceneView.Scene.Layers.Add(kmlLayer);
else
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = MySceneView.Scene.Layers.Count - 1; i &amp;gt;= 0; i--)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (MySceneView.Scene.Layers&lt;I&gt;.ID == id)&lt;/I&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; MySceneView.Scene.Layers&lt;I&gt; = kmlLayer; //I cant replace the layer using the id as an index, since it's read only using a string index&lt;/I&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/PRE&gt;&lt;P&gt;Any help would be appreciated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:14:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/update-kmllayer-arcgis-runtime-sdk-net/m-p/453817#M5551</guid>
      <dc:creator>JasonTrinidad1</dc:creator>
      <dc:date>2021-12-11T20:14:27Z</dc:date>
    </item>
  </channel>
</rss>

