We have the following problem with a .NET Maui app using the Maps SDK:
When the device resumes from sleeping, we get a hard crash, apparently caused by the AuthenticationManager concurrently accessing the same list from different threads:
System.InvalidOperationException: InvalidOperation_EnumFailedVersion
at System.Collections.Generic.List`1.Enumerator[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNextRare()
at System.Collections.Generic.List`1.Enumerator[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
at Esri.ArcGISRuntime.Security.AuthenticationManager.AddCredential(Credential credential, CredentialAddedContext context, Boolean syncPersistence)
at Esri.ArcGISRuntime.Security.AuthenticationManager.EndSignIn(SignInTask signInTask, Credential crd, Exception error)
at Esri.ArcGISRuntime.Security.AuthenticationManager.DoSignIn(SignInTask signInTask)
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object )
at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
at System.Threading.ThreadPoolWorkQueue.DispatchItemWithAutoreleasePool(Object , Thread )
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
We're observing this problem only on iOS devices and the problem seems to occur more reliably the more layers are added to the map. Our guess is that the layers try to reinitialize after resume and are all concurrently using the AuthenticationManager to do so.
Is this a known problem or are there any suggestions how to work around this?