AllLayersObservable Crash

245
0
04-15-2022 09:58 AM
CalebPourchot
New Contributor III

I have been getting a crash in the runtime over the last several months that I can't track down. I am not able to reproduce it, but the logs of it show up in my AppCenter crashes on both Android and iOS. 

This is the stack trace available from AppCenter:

AllLayersObservable+<GetEnumerator>d__17.MoveNext ()

System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
 
List`1+Enumerator[T].MoveNextRare ()
List`1+Enumerator[T].MoveNext ()
AllLayersObservable+<GetEnumerator>d__17.MoveNext ()
Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate, System.Boolean& found)

MapView.FindLayerByCoreLayer (RuntimeCoreNet.GeneratedWrappers.CoreLayer coreLayer)
ICoreCallback_GeoView_LayerViewStateChanged.LayerViewStateChanged>b__0 ()
Thread+RunnableImplementor.Run ()
 
on iOS:
List`1+Enumerator[T].MoveNextRare ()
List`1+Enumerator[T].MoveNext ()
AllLayersObservable+<GetEnumerator>d__17.MoveNext ()
Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate, System.Boolean& found)
Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate)
MapView.FindLayerByCoreLayer (RuntimeCoreNet.GeneratedWrappers.CoreLayer coreLayer)
ICoreCallback_GeoView_LayerViewStateChanged.LayerViewStateChanged>b__0 ()
DispatchQueue.static_dispatcher_to_managed (System.IntPtr context)
(wrapper native-to-managed) CoreFoundation.DispatchQueue.static_dispatcher_to_managed(intptr)
(wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass)
Application.Main (System.String[] args)
 
(wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass)
Application.Main (System.String[] args)
 
I presume I have a race condition where some other thread is modifying that collection, but I don't know exactly what collection in the runtime that is or what triggers layer view state to change.
 
Anyone run into this? Anyone have any pointers? 
 
Using .NET Runtime SDK 100.13.1 on Xamarin.Forms 5.0.x
 
 
Thanks,
Caleb
0 Kudos
0 Replies