System.InvalidOperationException: Cannot change ObservableCollection
See original GitHub issueHey Andrei, I try to implement the orientation change in my app and there is an error coming up. I’m not quite sure if its a CardView bug, but when you look at the call stack it seems to be an issue there or in XF. I use the latest version of both (2.0. 6 | 3.6.0.293080)
I have to different CardViews (Carousels) each in one page. When I change pages and then change my orientation to landscape an error occurs, I think it must be about the layout and the observable collections there, since I dont use any in this page where the error occurs. (There are no problems if I don’t change orientation)
System.InvalidOperationException: Cannot change ObservableCollection during a CollectionChanged event.
ObservableCollection`1[T].CheckReentrancy ()
ObservableCollection`1[T].MoveItem (System.Int32 oldIndex, System.Int32 newIndex)
ObservableCollection`1[T].Move (System.Int32 oldIndex, System.Int32 newIndex)
Layout.LowerChild (Xamarin.Forms.View view) D:\a\1\s\Xamarin.Forms.Core\Layout.cs:186
CardsView.SendChildrenToBackIfNeeded (Xamarin.Forms.View view, Xamarin.Forms.View topView)
CardsView.AddChild (Xamarin.Forms.View topView, Xamarin.Forms.View[] views)
CardsView.InitViews (PanCardView.Processors.ICardProcessor processor, PanCardView.Enums.AnimationDirection animationDirection, System.Collections.Generic.IEnumerable`1[T] bookedViews, System.Int32[] indeces)
CardsView.SetupPrevView (System.Int32 index)
CardsView.SetupBackViews (System.Nullable`1[T] index)
CardsView.SetCurrentView ()
AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state)
SyncContext+<>c__DisplayClass2_0.<Post>b__0 ()
Thread+RunnableImplementor.Run ()
IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this)
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
c# - Remove an item from an ObservableCollection in a ...
Calling .Remove() within the CollectionChanged event handler doesn't appear to be allowed. At runtime .NET throws an InvalidOperationException:.
Read more >Exception: Cannot change ObservableCollection during a ...
I think the problem is that an ObservableCollection is not originally thread safe. The problem occurs for me when there are two different ......
Read more >An observable collection cannot be modified during a change ...
General caveat: For both of the options described below, every change to the Data collection will result in a new event being raised,...
Read more >Xamarin Forms Exception OnLoadMore - "Cannot change ...
When doing a "first load" of a datasource the DataGridView control invokes two times the LoadMore event. This causes the data to loaded...
Read more >XamGrid - Cannot change ObservableCollection during a ...
I am using XamGrid which is bounded to collectionviewsource, apparently when i add filter row to the xamgrid (via below xaml) i get...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
the current one works fine, error is gone, thanks Andrei!
thx I will se what I can do, its difficult to reproduce with a small sample