I am currently implementing ArcGIS 100.2.1 as we have a requirement to support UWP on Windows 10 LTSB (1607) and have a couple of issues with the application locking up while initialising the map and perhaps more crucially, an issue whereby we can't seem to add a large number of graphics to the map.
I've tried a handful of different approaches such as calling the RenderGraphics() method synchronously from the constructor and on a background thread from the MapLoaded event.
Currently I have the following implementation (abridged for readability):
View Model
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">class</SPAN> <SPAN class="token class-name">ExampleMapViewModel</SPAN> <SPAN class="punctuation token">:</SPAN> Screen
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">readonly</SPAN> PictureMarkerSymbol _markerStyleA<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">readonly</SPAN> PictureMarkerSymbol _markerStyleB<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">readonly</SPAN> PictureMarkerSymbol _markerStyleC<SPAN class="punctuation token">;</SPAN>
<SPAN class="comment token">// List of custom markers (generated by a service) with status and locations</SPAN>
<SPAN class="keyword token">private</SPAN> IList<SPAN class="operator token"><</SPAN>MarkerRef<SPAN class="operator token">></SPAN> _markers<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">public</SPAN> Map Map <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">get</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">set</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">public</SPAN> GraphicsOverlayCollection Overlays <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">get</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">set</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">public</SPAN> <SPAN class="token function">ExampleMapViewModel</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
Map <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Map</SPAN><SPAN class="punctuation token">(</SPAN>Basemap<SPAN class="punctuation token">.</SPAN><SPAN class="token function">CreateLightGrayCanvasVector</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
Overlays <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">GraphicsOverlayCollection</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
Map<SPAN class="punctuation token">.</SPAN>Loaded <SPAN class="operator token">+</SPAN><SPAN class="operator token">=</SPAN> Map_Loaded<SPAN class="punctuation token">;</SPAN>
GraphicsOverlay customOverlay <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">GraphicsOverlay</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> Id <SPAN class="operator token">=</SPAN> <SPAN class="string token">"CustomOverlay"</SPAN><SPAN class="punctuation token">,</SPAN> MinScale <SPAN class="operator token">=</SPAN> <SPAN class="number token">36000</SPAN><SPAN class="punctuation token">,</SPAN> SelectionColor <SPAN class="operator token">=</SPAN> Color<SPAN class="punctuation token">.</SPAN><SPAN class="token function">FromArgb</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="number token">77</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN>
Overlays<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Add</SPAN><SPAN class="punctuation token">(</SPAN>customOverlay<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
_markerStyleA <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">PictureMarkerSymbol</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Uri</SPAN><SPAN class="punctuation token">(</SPAN>"ms<SPAN class="operator token">-</SPAN>appx<SPAN class="punctuation token">:</SPAN><SPAN class="operator token">/</SPAN><SPAN class="comment token">//Assets/MarkerStyleA.png", UriKind.RelativeOrAbsolute)) { Width = 24, Height = 24 };</SPAN>
_markerStyleB <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">PictureMarkerSymbol</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Uri</SPAN><SPAN class="punctuation token">(</SPAN>"ms<SPAN class="operator token">-</SPAN>appx<SPAN class="punctuation token">:</SPAN><SPAN class="operator token">/</SPAN><SPAN class="comment token">//Assets/MarkerStyleB.png", UriKind.RelativeOrAbsolute)) { Width = 24, Height = 24 };</SPAN>
_markerStyleC <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">PictureMarkerSymbol</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Uri</SPAN><SPAN class="punctuation token">(</SPAN>"ms<SPAN class="operator token">-</SPAN>appx<SPAN class="punctuation token">:</SPAN><SPAN class="operator token">/</SPAN><SPAN class="comment token">//Assets/MarkerStyleC.png", UriKind.RelativeOrAbsolute)) { Width = 24, Height = 24 };</SPAN>
<SPAN class="comment token">// Returns a collection of 2000 markers with ids, labels, coordinates and status</SPAN>
_markers <SPAN class="operator token">=</SPAN> _markerService<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetMarkers</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">async</SPAN> Task <SPAN class="token function">RenderGraphics</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">await</SPAN> Task<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Run</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> overlay <SPAN class="operator token">=</SPAN> Overlays<SPAN class="punctuation token">.</SPAN><SPAN class="token function">FirstOrDefault</SPAN><SPAN class="punctuation token">(</SPAN>x <SPAN class="operator token">=</SPAN><SPAN class="operator token">></SPAN> x<SPAN class="punctuation token">.</SPAN>Id <SPAN class="operator token">==</SPAN> <SPAN class="string token">"CustomOverlay"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">if</SPAN> <SPAN class="punctuation token">(</SPAN>overlay <SPAN class="operator token">!=</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">for</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">var</SPAN> i <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">;</SPAN> i <SPAN class="operator token"><</SPAN> _markers<SPAN class="punctuation token">.</SPAN>Count<SPAN class="punctuation token">;</SPAN> i<SPAN class="operator token">++</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> graphic <SPAN class="operator token">=</SPAN> <SPAN class="token function">CreateGraphic</SPAN><SPAN class="punctuation token">(</SPAN>_marker<SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
overlay<SPAN class="punctuation token">.</SPAN>Graphics<SPAN class="punctuation token">.</SPAN><SPAN class="token function">Add</SPAN><SPAN class="punctuation token">(</SPAN>graphic<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
Debug<SPAN class="punctuation token">.</SPAN><SPAN class="token function">WriteLine</SPAN><SPAN class="punctuation token">(</SPAN>$<SPAN class="string token">"Added graphic {i + 1}"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">private</SPAN> Graphic <SPAN class="token function">CreateGraphic</SPAN><SPAN class="punctuation token">(</SPAN>MarkerRef marker<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> loc <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">MapPoint</SPAN><SPAN class="punctuation token">(</SPAN>marker<SPAN class="punctuation token">.</SPAN>Longitude<SPAN class="punctuation token">,</SPAN> marker<SPAN class="punctuation token">.</SPAN>Latitude<SPAN class="punctuation token">,</SPAN> SaptialReferences<SPAN class="punctuation token">.</SPAN>Wgs84<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> symbol <SPAN class="operator token">=</SPAN> marker<SPAN class="punctuation token">.</SPAN>Status <SPAN class="operator token">==</SPAN> MarkerStatus<SPAN class="punctuation token">.</SPAN>A <SPAN class="operator token">?</SPAN> _markerStyleA <SPAN class="punctuation token">:</SPAN> marker<SPAN class="punctuation token">.</SPAN>Status <SPAN class="operator token">==</SPAN> MarkerStatus<SPAN class="punctuation token">.</SPAN>B <SPAN class="operator token">?</SPAN> _markerStyleB <SPAN class="punctuation token">:</SPAN> _markerStyleC<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> attributes <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">List</SPAN><SPAN class="operator token"><</SPAN>KeyValuePair<SPAN class="operator token"><</SPAN><SPAN class="keyword token">string</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">object</SPAN><SPAN class="operator token">></SPAN><SPAN class="operator token">></SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">KeyValuePair</SPAN><SPAN class="operator token"><</SPAN><SPAN class="keyword token">string</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">object</SPAN><SPAN class="operator token">></SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"Reference"</SPAN><SPAN class="punctuation token">,</SPAN> marker<SPAN class="punctuation token">.</SPAN><SPAN class="keyword token">ref</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> graphic <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">Graphic</SPAN><SPAN class="punctuation token">(</SPAN>loc<SPAN class="punctuation token">,</SPAN> attributes<SPAN class="punctuation token">,</SPAN> symbol<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> graphic<SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">async</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">Map_Loaded</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">object</SPAN> sender<SPAN class="punctuation token">,</SPAN> EventArgs e<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">await</SPAN> <SPAN class="token function">RenderGraphics</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>View
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"><</SPAN>Page</SPAN>
<SPAN class="attr-name token">...</SPAN>
<SPAN class="attr-name token"><SPAN class="namespace token">xmlns:</SPAN>esriui</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>using:Esri.ArcGISRuntime.UI.Controls<SPAN class="punctuation token">"</SPAN></SPAN><SPAN class="punctuation token">></SPAN></SPAN>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"><</SPAN>SplitView</SPAN><SPAN class="punctuation token">></SPAN></SPAN>
<SplitView.Pane>
...
</SplitView.Pane>
<SplitView.Content>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"><</SPAN>Grid</SPAN><SPAN class="punctuation token">></SPAN></SPAN>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"><</SPAN><SPAN class="namespace token">esriui:</SPAN>MapView</SPAN> <SPAN class="attr-name token"><SPAN class="namespace token">x:</SPAN>Name</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>MapView<SPAN class="punctuation token">"</SPAN></SPAN>
<SPAN class="attr-name token">Map</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>{Binding Map}<SPAN class="punctuation token">"</SPAN></SPAN>
<SPAN class="attr-name token">GraphicsOverlays</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN>{Binding</SPAN> <SPAN class="attr-name token">Overlays}"</SPAN>
<SPAN class="attr-name token">Loaded</SPAN><SPAN class="attr-value token"><SPAN class="punctuation token">=</SPAN><SPAN class="punctuation token">"</SPAN>MapView_Loaded<SPAN class="punctuation token">"</SPAN></SPAN> <SPAN class="punctuation token">/></SPAN></SPAN>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"></</SPAN>Grid</SPAN><SPAN class="punctuation token">></SPAN></SPAN>
</SplitView.Content>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"></</SPAN>SplitView</SPAN><SPAN class="punctuation token">></SPAN></SPAN>
<SPAN class="token tag"><SPAN class="token tag"><SPAN class="punctuation token"></</SPAN>Page</SPAN><SPAN class="punctuation token">></SPAN></SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>View (Code Behind)
<SPAN class="keyword token">public</SPAN> <SPAN class="keyword token">sealed</SPAN> <SPAN class="keyword token">partial</SPAN> <SPAN class="keyword token">class</SPAN> <SPAN class="token class-name">ExampleMapView</SPAN> <SPAN class="punctuation token">:</SPAN> Page
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">public</SPAN> <SPAN class="token function">ExampleMapView</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">this</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">InitializeComponent</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">MapView_Loaded</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">object</SPAN> sender<SPAN class="punctuation token">,</SPAN> RoutedEventArgs e<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
MapView<SPAN class="punctuation token">.</SPAN>LocationDisplay<SPAN class="punctuation token">.</SPAN>AutoPanMode <SPAN class="operator token">=</SPAN> Esri<SPAN class="punctuation token">.</SPAN>ArcGISRuntime<SPAN class="punctuation token">.</SPAN>UI<SPAN class="punctuation token">.</SPAN>LocationDisplayAutoPanMode<SPAN class="punctuation token">.</SPAN>Recenter<SPAN class="punctuation token">;</SPAN>
MapView<SPAN class="punctuation token">.</SPAN>LocationDisplay<SPAN class="punctuation token">.</SPAN>IsEnabled <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">true</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>When the view model is loaded, I can see the output starts to show the 'Added graphic' lines that we defined on 43, but when running in the above code it only gets as far as 29 (the count of _markers is 2000) before the output stops and the application or map control freezes (in this case before the base layer can load). If I move the execution of the RenderGraphics() method into the constructor of the view model then I can get to approximately 120 graphics before it falls over but ultimately the result is the same. Commenting out line 42 where we add the graphic the overlay fixes the problem in so far as all the graphics are generated but it seems to be adding them to the overlay that is causing the issue.
I tried a slightly different approach whereby we only added graphics to the overlay that were within the coordinates of the current visible map area which worked slightly better but would ultimately crash after a certain number of graphics had been rendered, even if we cleared the overlay graphics collection every time.
Has anyone experienced something similar in the past?