AnsweredAssumed Answered

ArcGISRuntime hangs when reusing a CompositeSymbol (Repro sample included)

Question asked by richard.a.mcgough on Jun 22, 2018
Latest reply on Jul 19, 2018 by chazwrob

We create a CompositeSymbol using two symbols, a SimpleMarkerSymbol for the background and a PictureMarkerSymbol created from a RuntimeImage as follows:


SimpleMarkerSymbol background = new SimpleMarkerSymbol() { Color = this.BackgroundColor, Style = SimpleMarkerSymbolStyle.Circle, Size = this.Size };

ImageSource img = new BitmapImage(new Uri(@"pack://application:,," + this.IconPath, UriKind.RelativeOrAbsolute));
RuntimeImage runtimeimage = await img.ToRuntimeImageAsync();

PictureMarkerSymbol picsymbol = new PictureMarkerSymbol(runtimeimage) { Height = this.Size, Width = this.Size };


CompositeSymbol composite = new CompositeSymbol();



We save this symbol in a dictionary so we can reuse it rather than creating a new one each time it is needed. There appears to be some kind of race condition that causes the ArcGISRuntime to hang about 33% of the time we run the attached sample application. Pausing the Debugger during the hang shows that the application has stopped after the sample code attempts to add the graphic to the GraphicsOverlay:




The call stack shows that the execution stopped in this method:


Esri.ArcGISRuntime.dll!RuntimeCoreNet.GeneratedWrapper.CoreVector.Insert( ....)


Call stack


When running the attached sample, you must restart it between tests. It usually only takes two or three attempts before it hangs. 


Is there something wrong with this approach to caching CompositeImages, or is it a bug in the ArcGISRuntime? Please let me know if there is a better approach or a workaround. Caching the images is important because we use thousands of them they take a lot of overhead to create (in our real app the background is a more complicated bitmap).


Any help would be greatly appreciated.