AnsweredAssumed Answered

ArgumentOutOfRangeException when reordering layers while other layers are loading

Question asked by ccasanova on Jun 3, 2016
Latest reply on Mar 23, 2017 by jonathandicken

When reordering layers, even those that are not the ones loading, it is possible to hit this exception. Note that the spatial reference was already set on the map view. Sample callstack:

 

at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)

  at System.Collections.Generic.List`1.Insert(Int32 index, T item)

  at Esri.ArcGISRuntime.Controls.CoreLayerCollection.MoveLayer(Layer layer)

  at Esri.ArcGISRuntime.Controls.ViewBase.HandleLayersMoved(CoreLayerCollection layerManager, IEnumerable`1 movedLayers)

  at Esri.ArcGISRuntime.Controls.ViewBase.<OnLayersChanged>d__1.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

  at Esri.ArcGISRuntime.Controls.ViewBase.<OnLayerCollectionChanged>d__41.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

  at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)

  at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

  at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

  at System.Windows.Threading.DispatcherOperation.InvokeImpl()

Outcomes