AnsweredAssumed Answered

ArcGISDynamicMapServiceLayer VisibleLayers throw exception on visibility changes

Question asked by alitvak on Aug 31, 2016

Hello,

 

We are experiencing sporadic un-handled exception that occurs while loading MPK with multiple layers layer approx. 400+ layers.

During this process we are restoring VisibleLayers by adding or removing id's to be visible or hidden.

If comment out '#VisibleLayers.Remove(id)' thant this not happen anymore, but we requires it as we want to change layer and it's sub-layers visibility that has to be controlled by user needs. 

 

We are running ArcGIS Runtime 10.2.7 version.

 

Exception:

--------------------------------------------------------------------------------------------------------------------------------------

System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List`1.Enumerator.MoveNextRare() at System.Collections.Generic.List`1.Enumerator.MoveNext() at System.String.Join[T](String separator, IEnumerable`1 values) at Esri.ArcGISRuntime.Layers.ArcGISDynamicMapServiceLayer.GetImageExportParameters(ImageParameters properties) at Esri.ArcGISRuntime.Layers.ArcGISDynamicMapServiceLayer.GetImageAsync(ImageParameters properties, CancellationToken cancellationToken) at Esri.ArcGISRuntime.Layers.DynamicCallbackHandler.RequestImage(Int32 width, Int32 height, CoreEnvelope2D core_env, CoreSpatialReference s_ref, Single dpi, Double angle, Boolean wrapAround, Boolean hasTimeExtent, Int64 startTime, Int64 endTime) at RuntimeCoreNet.CoreDynamicLayer.<>c__DisplayClass2.<.ctor>b__0(Int32 width, Int32 height, CoreEnvelope2D extent, IntPtr pNativeSpatialReference, Single dpi, Double angle, Boolean wrapAround, Boolean useTime, Int64 startTime, Int64 endTime)

Outcomes