Bug 31367 - [Android] Crash in modal page
Summary: [Android] Crash in modal page
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 1.4.2
Hardware: PC Windows
: Normal critical
Target Milestone: ---
Assignee: Chris King
Depends on:
Reported: 2015-06-24 23:07 UTC by Simon Taylor
Modified: 2016-02-09 02:57 UTC (History)
5 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Simon Taylor 2015-06-24 23:07:42 UTC
Sorry, I've only seen this once and can't reproduce. I think I pressed the back button on a modal page while it was still rendering. In ILSpy the cause is pretty obvious.

06-25 12:48:01.456 I/MonoDroid(15224): UNHANDLED EXCEPTION:
06-25 12:48:01.456 I/MonoDroid(15224): System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
06-25 12:48:01.456 I/MonoDroid(15224): at System.Collections.Generic.List`1/Enumerator<System.Collections.Generic.List`1<Xamarin.Forms.Page>>.MoveNext () <0x000d4>
06-25 12:48:01.456 I/MonoDroid(15224): at Xamarin.Forms.NavigationModel/<get_Roots>d__0.MoveNext () <0x001d3>
06-25 12:48:01.456 I/MonoDroid(15224): at System.Linq.Enumerable/<CreateSelectIterator>c__Iterator10`2<Xamarin.Forms.Page, Xamarin.Forms.Platform.Android.IVisualElementRenderer>.MoveNext () <0x001db>
06-25 12:48:01.456 I/MonoDroid(15224): at Xamarin.Forms.Platform.Android.Platform.OnLayout (bool,int,int,int,int) <0x002db>
06-25 12:48:01.456 I/MonoDroid(15224): at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (bool,int,int,int,int) <0x00083>
06-25 12:48:01.456 I/MonoDroid(15224): at Android.Views.ViewGroup.n_OnLayout_ZIIII (intptr,intptr,bool,int,int,int,int) <0x0007f>
06-25 12:48:01.456 I/MonoDroid(15224): at (wrapper dynamic-method) object.2efba7b7-397e-4482-ab6c-27c1db53de6b (intptr,intptr,bool,int,int,int,int) <0x0007b>
Comment 1 Jason Smith [MSFT] 2015-06-25 16:39:26 UTC
Platform.cs:912 foreach (var modal in navModel.Roots)

Need to make a copy.