Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Droid: CardsView.AddChild (Xamarin.Forms.View topView, Xamarin.Forms.View[] views) System.InvalidOperationException: Cannot change ObservableCollection during a CollectionChanged event. #92

Closed
JTOne123 opened this issue Aug 22, 2018 · 4 comments
Labels
resolved Waiting for validation Xamarin.Forms bug

Comments

@JTOne123
Copy link
Contributor

Hi Andrei,
I got a new exception
Version 1.5.8

CardsView.AddChild (Xamarin.Forms.View topView, Xamarin.Forms.View[] views)

System.InvalidOperationException: Cannot change ObservableCollection during a CollectionChanged event.
ObservableCollection`1[T].CheckReentrancy ()
ObservableCollection`1[T].InsertItem (System.Int32 index, T item)
Collection`1[T].Insert (System.Int32 index, T item)
ObservableWrapper`2[TTrack,TRestrict].Insert (System.Int32 index, TRestrict item)
CardsView.AddChild (Xamarin.Forms.View topView, Xamarin.Forms.View[] views)
CardsView.GetViews (PanCardView.Enums.AnimationDirection animationDirection, PanCardView.Processors.ICardProcessor processor, System.Int32[] indeces)
CardsView.SetupNextView ()
CardsView.SetupBackViews ()
CardsView+<SetCurrentView>d__202.MoveNext ()
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)
(wrapper dynamic-method) System.Object.d101e837-9e54-4ce7-ac07-2fd099217b2b(intptr,intptr)
@AndreiMisiukevich
Copy link
Owner

Hi, do you change your itemsSource elements at your code?
I think you should do it in main thread

@AndreiMisiukevich AndreiMisiukevich added question Further information is requested Xamarin.Forms bug and removed question Further information is requested labels Aug 22, 2018
@AndreiMisiukevich
Copy link
Owner

indeed.. every layout is observable collection...
But that is strange we getting crashes, however I add lock(_childLocker) in all places, where we interact with Children collection.

So, I think, this is Xamarin.Forms bug, probably it would be great idea to send them an issue.
From my side, i will try to catch this type of exception, and retry adding.

The same exception, as I see SimonSimCity/Xamarin-CrossDownloadManager#9

@JTOne123
Copy link
Contributor Author

I guess you are right

AndreiMisiukevich added a commit that referenced this issue Aug 22, 2018
@AndreiMisiukevich AndreiMisiukevich added resolved Waiting for validation and removed in_progress labels Aug 22, 2018
@AndreiMisiukevich
Copy link
Owner

1.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolved Waiting for validation Xamarin.Forms bug
Projects
None yet
Development

No branches or pull requests

2 participants