I've been pounding my head against the wall trying to figure out why my Xamarin Forms app intermittently crashes while loading. This occurs in both Android and iOS. We've added some unhandled exception logging to try and capture some information, and every once in a while we get a "Collection was modified; enumeration operation may not execute" error that crashes the app. I traced it to two separate lines of code that both add operational layers to the map - vector tile package layers and feature layers from a SQLite geodatabase. The more layers we add to the map the more frequently we get app crashes.
My app has some serious girth, so to rule out some other culprit I just created a slimmed down repro app that downloads 11 vector tile packages and loads them into the map. I added a Reload Map button that reinstantiates the map and adds those 11 vector tile packages to the map. This basically emulates the app loading and map layer population that occurs in my real app. If I continually click that reload map button I can get the app to crash pretty reliably, so the issue is still intermittent but it does definitely occur in this slimmed down repro app. This seems to point to some low level bug in the OperationalLayers.Add method on the map.
I'm willing to supply this repro case to the Esri development team, but I don't want to post it here as it has some URLs and proprietary information that shouldn't be exposed to the masses. I am also willing to call in a support request on this, but it usually takes a few days until it gets to someone that can actually help. If one of you guys can let me know where I can send the repro, hopefully you can quickly determine whether or not this is something we can work around or if we're SOL until the next release of the API. We have a customer roll out occurring this week, and we obviously do not want to give this app to them with all this instability.
Any help here would be greatly appreciated ...
Thanks for the offer of the repro app - are you able to email to email@example.com ? Or host online somewhere and email me the details? Alternatively, I can create a Box share for you once I have your email address.
Hi Michael. I haven't heard from you since this morning, so just wanted to make sure we are still a go for the Box share? If not I can try to find another way to get you the repro code. Thanks ...
Have you had the opportunity to grab the repro code off of my OneDrive share and give this thing a test run? I sent you an e-mail about it last week but haven't heard back from you.
Thanks for the sharing the reproducer and I apologize for the delay in replying. We were able to reproduce the issue, and it appeared to be an OpenGL problem (which is often related to our shaders). But I have been waiting to re-test with more recent builds following a number fixes in vector tile layers and also related Android shader changes. We are now in a position to do that and will be retesting over the next few days. If those changes have not resolved the issue we will continue to investigate.
This issue should now be resolved in the recent v100.2 release. Please don't hesitate to let us know if you can still reproduce the problem with that version.
Please download the latest Visual Studio extension from ArcGIS for Developers or update your NuGet packages via the NuGet package manager.