Bug 58593 - Navigating from one page with toolbar items to another may cause a "Cannot change ObservableCollection" exception
Summary: Navigating from one page with toolbar items to another may cause a "Cannot ch...
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.5
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-08-04 17:25 UTC by Pete Schmitz
Modified: 2017-09-06 23:44 UTC (History)
2 users (show)

Tags:
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:
Status:
RESOLVED NOT_ON_ROADMAP

Description Pete Schmitz 2017-08-04 17:25:43 UTC
There's an edge-case one of our users has encountered while navigating from one page with toolbaritems to another page with toolbaritems.

Device: Alcatel Fierce 4
Android: 6.0

I haven't had luck reproducing this on my end yet, but here's what appeared to occur -

Our navigation stack:

MasterDetailPage
- Master: Page (Menu)
- Detail: TabbedPage
- - Page (Contains toolbar items)

- Our CalendarPage (CarouselPage) is constructed and set (MasterDetailPage.Detail) when selected from the Menu, then apparently encountered the following stack:


Stacktrace:

System.InvalidOperationExceptionCannot change ObservableCollection during a CollectionChanged event.
Raw
System.Collections.ObjectModel.ObservableCollection<T>.CheckReentrancy()<b0bda925c4bf49d1a32369e5893c32e1>:0
System.Collections.ObjectModel.ObservableCollection<T>.RemoveItem(int index)<b0bda925c4bf49d1a32369e5893c32e1>:0
System.Collections.ObjectModel.Collection<T>.RemoveAt(int index)<5bcda10a16504eadae91a282001667ca>:0
Xamarin.Forms.ObservableWrapper<TTrack, TRestrict>.RemoveAt(int index)<6857c3e3d8934a01aedef43d5fab1604>:0
at iSurvey.CalendarPage.<.ctor>b__7_3 (System.Object sender2, System.EventArgs e2) [0x0008a] in <a26b53114a1e4fb6a0c6cf31a8cb5a08>:0
<Module>.invoke_void_object_EventArgs(object, EventArgs)(wrapper delegate-invoke)
Xamarin.Forms.MultiPage<T>.OnCurrentPageChanged()<6857c3e3d8934a01aedef43d5fab1604>:0
Xamarin.Forms.MultiPage<T>.set_CurrentPage(T value)<6857c3e3d8934a01aedef43d5fab1604>:0
Xamarin.Forms.MultiPage<T>.OnChildrenChanged(object sender, NotifyCollectionChangedEventArgs e)<6857c3e3d8934a01aedef43d5fab1604>:0
<Module>.invoke_void_object_NotifyCollectionChangedEventArgs(object, NotifyCollectionChangedEventArgs)(wrapper delegate-invoke)
System.Collections.ObjectModel.ObservableCollection<T>.OnCollectionChanged(NotifyCollectionChangedEventArgs e)<b0bda925c4bf49d1a32369e5893c32e1>:0
System.Collections.ObjectModel.ObservableCollection<T>.OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index)<b0bda925c4bf49d1a32369e5893c32e1>:0
System.Collections.ObjectModel.ObservableCollection<T>.RemoveItem(int index)<b0bda925c4bf49d1a32369e5893c32e1>:0
System.Collections.ObjectModel.Collection<T>.RemoveAt(int index)<5bcda10a16504eadae91a282001667ca>:0
Xamarin.Forms.ObservableWrapper<TTrack, TRestrict>.RemoveAt(int index)<6857c3e3d8934a01aedef43d5fab1604>:0
at iSurvey.CalendarPage.<.ctor>b__7_0 () [0x00027] in <a26b53114a1e4fb6a0c6cf31a8cb5a08>:0
at Xamarin.Forms.ToolbarItem+<>c__DisplayClass3_0.<.ctor>b__0 (System.Object s, System.EventArgs e) [0x00000] in <6857c3e3d8934a01aedef43d5fab1604>:0
Xamarin.Forms.MenuItem.OnClicked()<6857c3e3d8934a01aedef43d5fab1604>:0
Xamarin.Forms.MenuItem.Activate()<6857c3e3d8934a01aedef43d5fab1604>:0
Xamarin.Forms.Platform.Android.GenericMenuClickListener.OnMenuItemClick(IMenuItem item)<5830324141594541b34d6a8a43fe677e>:0
Android.Views.IMenuItemOnMenuItemClickListenerInvoker.n_OnMenuItemClick_Landroid_view_MenuItem_(IntPtr jnienv, IntPtr native__this, IntPtr native_item)<102418d7d2bf4184b710a3f732c08209>:0
at (wrapper dynamic-method) System.Object:856ffb8a-21b5-40e6-a584-fda9af2abd43 (intptr,intptr,intptr)
Comment 1 Paul DiPietro [MSFT] 2017-08-04 17:44:11 UTC
We are moving away from CarouselPage to CarouselView in the future, but for the moment I will set this to needinfo in hopes that we can get a reproduction.
Comment 2 Pete Schmitz 2017-08-04 17:46:11 UTC
Thanks Paul, we'll make note to transition over and I'll resubmit a repro if I have any luck/we receive additional information from our users.
Comment 3 Paul DiPietro [MSFT] 2017-09-06 23:44:37 UTC
As it's been some time now, I'm going to mark this as not on roadmap due to the CarouselPage/CarouselView change as mentioned above, but if a reliable reproduction pops up (assuming this still ends up being an issue), please feel free to reopen this issue up with one.