Adding an item to the observable collection while the page with the CollectionView is in focus, seems to work just fine.
However, trying to add an item to the observable collection, while the page holding the CollectionView is not i focus, breaks the CollectionView on iOS, but not on Android.
Specifically:
Foundation.MonoTouchException Message=Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: attempt to insert item 4 into section 0, but there are only 4 items in section 0 after the update...
Please see the two videos of running the reproducing code on iOS and Android. Also see the link to the simple reproduce project, provided below.
On Android it works as I would expect it to:

On iOS it does not work as I would expect it to work:

Works fine on Android, tried with 4.5.0.74-nighly still see the issue.
I can confirm that this is still an issue with 4.4.0 sr2, and for me adds to a long list of issues with CollectionView on iOS. I know my ItemsSource is okay since a test StackLayout using a BindableLayout on the same page updates perfectly.
Further to 1iveowl's detailed report, I can see that off-screen CollectionViews are somewhat handling the change notifications:
In summary it looks like the control is trying it's best to update the list but without the ability to change the size of the list.
At this point I'm not sure how to work around the issue short of re-architecting my app or replacing CollectionView with something that fully supports ObservableCollections.
Could I please request some urgency on this one? I've verified that this was working in 4.3.0.991221 and has been broken since 4.3.0.991250. This is a real blocker as I need some 4.4 features and recreating similar visuals with a ListView is not practical.
It looks like the changes to Xamarin.Forms.Platform.iOS/CollectionView/ObservableItemsSource.cs for #7678 is to blame.
I haven't looked at 1iveowl's repo, but the easiest way for me to reproduce the issue is to use the Visual Studio project template for a XF Shell app and drop in a CollectionView next to the ListView that's bound to the same list. Adding an item updates the ListView but not the CollectionView. I don't think it's a good look when even a VS project template doesn't work with a CollectionView.
Does anyone found a workaround on this one?
Does anyone found a workaround on this one?
I lost plenty of time trying to find one but without success. Possible options include rolling back to XF 4.3.0.991221, or switching to a ListView or BindingLayout. I went with the latter and bound my ObservableCollection to a StackLayout as I didn't need grouping, grid layouts or more than 20-30 items in the list.
Unfortunately, I am currently seeing similar behavior with ListView when ItemsSource is set to an ObservableCollection and I modify that collection's items. I only touch the collection on the UI thread, however it still crashes in ListViewRenderer.cs when I modify the list. I will try rolling back the Xamarin.Forms version. After that I'm not sure what to try.
Either the person maintaining these renderer classes is breaking things really badly, or else perhaps iOS is changing the underlying behavior to make it more strict, resulting in crashing. Either way, my app is badly broken.