Select to view content in your preferred language

App crashes after resume (apparently concurrent access of credentials in AuthenticationManager)

433
4
07-31-2024 03:04 AM
Labels (3)
arleh
by
Emerging Contributor

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?

 

0 Kudos
4 Replies
MatveiStefarov
Esri Contributor

This sounds like a problem that has been fixed last year.  We made AuthenticationManager more resilient to multi-threaded use in ArcGIS Maps SDK version 200.2+.  If you are still using an older version, I recommend upgrading to check if this resolves the problem.

0 Kudos
arleh
by
Emerging Contributor

We are indeed still on 200.2 as we are waiting for the 200.5 release. We'll test with 200.3 as that should be doable within our current schedule (migrating to .net 8 will take some time).

Thanks for your reply!

0 Kudos
arleh
by
Emerging Contributor

Ah, I just noticed that 200.3 is already on .net 8 - that means it will take us a bit longer to deploy the fix. But at least we now have one more reason to speed up the transition.

0 Kudos
dotMorten_esri
Esri Notable Contributor

FYI 200.5 is out as of today. So you should be good to move. .NET MAUI on .NET 7 is also no longer officially supported by Microsoft, and there's so many great bug fixes in .NET8, you really want to upgrade.

0 Kudos