When I bind to a ListView it works, but using CollectionView I get:
Objective-C exception thrown. Name: NSRangeException Reason: *** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array
Displays a list.
Crashes
This is the exception related
{Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (1) must be equal to the number of items contained in that section before the update (1), plus or minus the number of items inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out).
Native stack trace:
0 CoreFoundation 0x000000011a3961bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x0000000124649735 objc_exception_throw + 48
2 CoreFoundation 0x000000011a395f42 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000118910877 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4 UIKitCore 0x0000000129c7b1b7 -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:] + 16010
5 UIKitCore 0x0000000129c76fcc -[UICollectionView _updateRowsAtIndexPaths:updateAction:updates:] + 521
6 UIKitCore 0x0000000129c77076 -[UICollectionView insertItemsAtIndexPaths:] + 64
7 ConnectorFiles.iOS 0x000000010aa3acf9 xamarin_dyn_objc_msgSend + 217
8 ??? 0x000000014a6d3467 0x0 + 5543638119
9 ??? 0x000000014a578ad4 0x0 + 5542218452
10 ??? 0x000000014e9f409b 0x0 + 5614026907
11 ??? 0x000000014e9f2bc3 0x0 + 5614021571
12 ??? 0x000000014a667716 0x0 + 5543196438
at ObjCRuntime.Runtime.ThrowNSException (System.IntPtr ns_exception) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.16/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:398
at ObjCRuntime.Runtime.throw_ns_exception (System.IntPtr exc) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/runtime/Delegates.generated.cs:128
at (wrapper native-to-managed) ObjCRuntime.Runtime.throw_ns_exception(intptr)
at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_IntPtr(intptr,intptr,intptr)
at UIKit.UICollectionView.InsertItems (Foundation.NSIndexPath[] indexPaths) [0x00024] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.16/src/Xamarin.iOS/UIKit/UICollectionView.g.cs:455
at Xamarin.Forms.Platform.iOS.ObservableItemsSource.Add (System.Collections.Specialized.NotifyCollectionChangedEventArgs args) [0x00042] in <b5294bb1e836495cae5ff00562d52b34>:0
at Xamarin.Forms.Platform.iOS.ObservableItemsSource.CollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs args) [0x00023] in <b5294bb1e836495cae5ff00562d52b34>:0
at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00018] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.16/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:263
at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.16/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:338
at System.Collections.ObjectModel.ObservableCollection`1[T].InsertItem (System.Int32 index, T item) [0x0001a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.16/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:196
at System.Collections.ObjectModel.Collection`1[T].Add (T item) [0x00020] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.16/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/
I finished the Android implementation of my page and CV loads there.
This is fixed in 4.0-pre8
When will pre-8 be released?
Currently scheduled for April 3.
Thank you. Will UWP support be included or is that down the road?
UWP support is being currently being implemented alongside iOS/Android, but it's behind. So not all features are currently available on all platforms. You can see the current list of supported features here: https://gist.github.com/hartez/7d0edd4182dbc7de65cebc6c67f72e14
And keep in mind that this is still a Preview feature.
Excellent, thank you for the detailed and quick response. Love the progress info!
Most helpful comment
This is the exception related