Esri / arcgis-maps-sdk-dotnet-toolkit

Toolkit for ArcGIS Maps SDK for .NET
https://esri.github.io/arcgis-maps-sdk-dotnet-toolkit/
Apache License 2.0
217 stars 121 forks source link

TOC does not work with group layers on version 100.1 #132

Closed kerenco75 closed 7 years ago

kerenco75 commented 7 years ago

TOC does not work with group layers on version 100.1 It only opens the parents level and not as a treeview for drill down

dotMorten commented 7 years ago

Use this webmap: http://ess.maps.arcgis.com/home/webmap/viewer.html?webmap=f1ed0d220d6447a586203675ed5ac213

Expected (worked in v100): image

Current (not working in v100.1): image

kerenco75 commented 7 years ago

I would like to understand better Is this a problem that has to be fixed within the core or within the arcgis-toolkit-dotnet solution?

dotMorten commented 7 years ago

In my first round of looking at this, it seems that the problem is with this return statement. If you remove it, the sub layers will populate: https://github.com/Esri/arcgis-toolkit-dotnet/blob/687545da529fdf4bfb18aac4e1e683d58b92b206/src/Esri.ArcGISRuntime.Toolkit/WPF/UI/Controls/TableOfContents/LayerContentViewModel.cs#L115

dotMorten commented 7 years ago

Pushed a fix in to resolve this.

kerenco75 commented 7 years ago

After I did the change I sometimes encounter with the following error:

System.InvalidOperationException: Collection was modified; enumeration operation may not execute.

at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResour ce resource)

at System.Collections.Generic.List‘1.Enumerator.MoveNextRareO

at System.Linq.Enumerable.WhereSelectEnumerableIterator‘2.MoveNextO

at System.Collections.Generic.List‘1..ctor(IEnumerable‘1 collection)

at med s.Map.UI.TableOfContent.LayerContentViewM od el. < BuildSublayerL ist> d_16.MoveNextO in c:\Users\tamarre\Source\Workspaces\SitaWare\Main\Source\meds.Ma p\U1\TableOfContent\LayerContentViewModel.cs:line 116 End of stack trace from previous location where exception was thrown

at System.Runtime.CompilerServices.AsyncMethodBuilderCore.< > c.<Thro wAsync> b_6_0(Obj ect state)

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegat e 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.InvokeImplO

at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Windows.Threading.DispatcherOperation.InvokeO

at System.Windows.Threading.Dispatcher.ProcessQueueO

at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object 0)

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegat e 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.Dispatcher.LegacyInvokeImpl(DispatcherPri ority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)

at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)

at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFram e frame)

at System.Windows.Application.RunDispatcher(Object ignore)

at System.Windows.Application.RunInternal(Window window)

at meds.Desktop.App.MainO in c:\Users\tamarre\Source\Workspaces\SitaWare\Main\Source\meds.Des ktop\obj\Debug\App.g.cs:Iine 0

dotMorten commented 7 years ago

@kerenco75 Could you try pulling the entire latest v100 branch? There was another commit shortly after that also cleaned up the indices in the collection.

If that doesn't help, could you share a sample and steps that reproduces this error?