Repetitive add and remove of KMLLayers

10-07-2015 03:09 AM
New Contributor

I got an assigment to add photo overlay on ArcGis Scene. Photo is updated after few seconds.

I couldn't find another solution, so I use KMLLayer, in following scenario:

  1-create temporary kml file with ground overlay object

  2-create KMLLayer with file uri

  3-add new layer to scene

  4-remove old one

First 3 steps are working smoothly, but when I try to remove old layer, application sometimes crashes (I can reproduce crashing with zooming and panning scene)

Code is bellow.

  private async void AddKMLLayer(string kml, string id, string oldid)


       await AddLayer(kml, id, SearchCompleted, oldid);


  private async Task AddLayer(string kml, string id, Action<KmlLayer> callback, string oldid)


       Uri sourceUri = new Uri(Environment.GetFolderPath(_folder + @"\" + id + ".kml");

       KmlLayer layer = new KmlLayer(sourceUri);

       layer.ID = id;

       _arcGISmapWPF.IkenaSceneView.IsEnabled = false;

       await layer.InitializeAsync();

       callback(layer, oldid);//add layer when initialized


  private void SearchCompleted(KmlLayer layer, string oldid)





0 Kudos
1 Reply
New Contributor II

I have a similar issue. I found out that the problem disapears when using 64bit compilation. 

0 Kudos