I'm using the WPF control (10.2.7) and have a layer with about 180,000 graphic items. The graphic items are all simple Polylines about 1m in length. The layer is only displayed when the scale is < 1250. If I add any attributes to the 180,000 Graphic items it makes the control very unstable and it randomly crashes when zooming in. I can see the control is using about 1Gb of memory and I assume the random crashes are somehow memory related. I tried splitting the 180,000 items across multiple GraphicsLayers but I get the same random crashes. Any advise for fixing this issue?
Andrew
Hi,
Here are some questions that might give us better understanding what is going on.
How do you create the graphics? How do you add the attributes? What kind of renderer you are using? What kind of symbols you are using in the renderer? Are you accessing graphics or their attributes before they crash? Does attributes or geometries get updated? Is graphics source being updated? Is GraphicsLayers rendered in Dynamic mode? Is labelling enabled? How many graphics are generally in view? Specs of the machines where it is crashing? Does it always crash on specific areas?
If you have a change, could you provide simple demo that reproduces the issue?
Can you get the stack trace from the crash if you enable native code debugging?
Strangely if I enable "Enable native code debugging" the control does not seem to crash. When disabled the control crashes once you zoom in so the GraphicsLayer with the 180,000 items is displayed (even when zooming to an area where I know none of the graphics will be displayed)
I'm creating the graphics like this :
foreach (var segment in zone.KmlIndividualSegments)
{
System.Collections.Generic.List<Esri.ArcGISRuntime.Geometry.MapPoint> myPoints1 = new System.Collections.Generic.List<Esri.ArcGISRuntime.Geometry.MapPoint>();
foreach (var vector in segment.Points)
myPoints1.Add(new Esri.ArcGISRuntime.Geometry.MapPoint(vector.Longitude, vector.Latitude));
Esri.ArcGISRuntime.Symbology.SimpleLineSymbol mySimpleLineSymbol1 = new Esri.ArcGISRuntime.Symbology.SimpleLineSymbol();
mySimpleLineSymbol1.Color = Colors.Black;
mySimpleLineSymbol1.Width = 10;
var attributes1 = new Dictionary<string, object>();
attributes1.Add("ID", string.Format("{0}", segmentcount));
// New graphic for this polyline
Esri.ArcGISRuntime.Layers.Graphic myGraphic1 = new Esri.ArcGISRuntime.Layers.Graphic(attributes1);
myGraphic1.Geometry = new Esri.ArcGISRuntime.Geometry.Polyline(myPoints1, new Esri.ArcGISRuntime.Geometry.SpatialReference(4326));
myGraphic1.Symbol = mySimpleLineSymbol1;
GraphicsLayer_TempsIndividual.Graphics.Add(myGraphic1);
}
if I omit the attributes1.Add("ID", string.Format("{0}", segmentcount)); then I do not get the crash. I'm therefore assuming (perhaps wrongly) that it's related to addributes.
I do not have any renderer defined in the XAML so I assume the default is being used. The Xaml is fairly simple
<esri:MapView x:Name="MyMapView" Loaded="MyMapView_Loaded" NavigationCompleted="MyMapView_NavigationCompleted">
<esri:Map x:Name="Map1">
<esri:OpenStreetMapLayer ID="OSM" />
<esri:GraphicsLayer x:Name="GraphicsLayer_TempsIndividual"></esri:GraphicsLayer>
</esri:Map>
</esri:MapView>
Further testing indicates it crashes a lot more frequently using an OpenStreetMapLayer compared to a ArcGISLocalTiledLayer. In case that gives a clue to the problem.
Andrew