Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

CarouselView in ListView crash on iOS 12 #54

Open
SBurgos00 opened this issue Jul 8, 2020 · 1 comment
Open

CarouselView in ListView crash on iOS 12 #54

SBurgos00 opened this issue Jul 8, 2020 · 1 comment

Comments

@SBurgos00
Copy link

I have an app that has a CarouselView visible in some rows of a ListView. When scrolling past the row with the CarouselView until it's out of the screen and then back up it crashes with the below exception. If all the CarouselViews in the list rows are visible the crash happened sooner. Sometimes it just happened scrolling down. The best I can find is that it happens on iOS 12 and lower. iOS 13 is no problem. I attached a sample project to show this trying to make it as simple as I can.
CarouselViewTest.zip

The crash happens on iOS 12.4.7 physical iPad mini 2 and on iOS 11.1 and 12.1 simulators. On iOS 13.5.1 iPad there's no crash. My app used images in the CarouselView but the sample app used strings and still crashed. The number of items in the CarouselView doesn't seem to matter. Xamarin.Forms 4.5.0.495, 4.6.0.847 and 4.7.0.1080 all have the same results.

One difference was on iOS 13.1 simulator, XF 4.7.0.1080. The exception instead was:
System.NullReferenceException
Message=Object reference not set to an instance of an object
at Xamarin.Forms.Platform.iOS.ItemsViewLayout.InvalidateLayout () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\ItemsViewLayout.cs:545
at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSendSuper_CGSize(intptr,intptr,CoreGraphics.CGSize)
at UIKit.UICollectionViewFlowLayout.set_ItemSize (CoreGraphics.CGSize value) [0x00024] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UICollectionViewFlowLayout.g.cs:272
at Xamarin.Forms.Platform.iOS.CarouselViewLayout.ConstrainTo (CoreGraphics.CGSize size) [0x00074] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\CarouselViewLayout.cs:32
at Xamarin.Forms.Platform.iOS.CarouselViewController.BoundsSizeChanged () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\CarouselViewController.cs:109
at Xamarin.Forms.Platform.iOS.CarouselViewController.ViewDidLayoutSubviews () [0x0003f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\CarouselViewController.cs:57
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at CarouselViewTest.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\sburgos\source\repos\CarouselViewTest\CarouselViewTest\CarouselViewTest.iOS\Main.cs:17

Foundation.MonoTouchException
Message=Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: UICollectionView received layout attributes for a cell with an index path that does not exist: <NSIndexPath: 0x83d060db0f000ab2> {length = 2, path = 0 - 0}
Native stack trace:
0 CoreFoundation 0x000000011db3f1bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000011e8a2735 objc_exception_throw + 48
2 CoreFoundation 0x000000011db3ef42 +[NSException raise:format:arguments:] + 98
3 Foundation 0x000000011abd2877 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194
4 UIKitCore 0x0000000127f79dfa __45-[UICollectionViewData validateLayoutInRect:]_block_invoke + 1354
5 UIKitCore 0x0000000127f79379 -[UICollectionViewData validateLayoutInRect:] + 2483
6 UIKitCore 0x0000000127f4700e -[UICollectionView layoutSubviews] + 260
7 UIKitCore 0x0000000128bd4795 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1441
8 QuartzCore 0x0000000118b52b19 -[CALayer layoutSublayers] + 175
9 QuartzCore 0x0000000118b579d3 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
10 UIKitCore 0x0000000128bbf077 -[UIView(Hierarchy) layoutBelowIfNeeded] + 1429
11 UIKitCore 0x0000000128bc6235 +[UIView(Animation) performWithoutAnimation:] + 90
12 UIKitCore 0x000000012892e89b -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 1328
13 UIKitCore . 0x000000012892ebfb -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 73
14 UIKitCore 0x00000001288f5c36 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2863
15 UIKitCore 0x00000001289168ee -[UITableView layoutSubviews] + 165
16 UIKitCore 0x0000000128bd4795 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1441
17 QuartzCore 0x0000000118b52b19 -[CALayer layoutSublayers] + 175
18 QuartzCore 0x0000000118b579d3 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395
19 QuartzCore 0x0000000118ad07ca _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 342
20 QuartzCore 0x0000000118b0797e _ZN2CA11Transaction6commitEv + 576
21 QuartzCore 0x0000000118b086fa _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 76
22 CoreFoundation 0x000000011daa3c27 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23
23 CoreFoundation 0x000000011da9e0be __CFRunLoopDoObservers + 430
24 CoreFoundation 0x000000011da9e751 __CFRunLoopRun + 1537
25 CoreFoundation 0x000000011da9de11 CFRunLoopRunSpecific + 625
26 GraphicsServices 0x0000000122d021dd GSEventRunModal + 62
27 UIKitCore 0x00000001286ea81d UIApplicationMain + 140
28 ??? 0x00000001430c8125 0x0 + 5419860261
29 ??? 0x00000001430c7e73 0x0 + 5419859571
30 ??? 0x00000001430be253 0x0 + 5419819603
31 CarouselViewTest.iOS 0x000000010ffe6521 mono_jit_runtime_invoke + 1569
32 CarouselViewTest.iOS 0x00000001100fefc8 mono_runtime_invoke_checked + 136
33 CarouselViewTest.iOS 0x0000000110104445 mono_runtime_exec_main_checked + 117
34 CarouselViewTest.iOS 0x000000010ff5253c mono_jit_exec + 364
35 CarouselViewTest.iOS 0x00000001101fda1d xamarin_main + 2685
36 CarouselViewTest.iOS 0x000000010ff29cb7 main + 71
37 libdyld.dylib 0x000000011febe575 start + 1

Source=Xamarin.iOS
StackTrace:
at ObjCRuntime.Runtime.ThrowNSException (System.IntPtr ns_exception) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:406
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) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at CarouselViewTest.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\sburgos\source\repos\CarouselViewTest\CarouselViewTest\CarouselViewTest.iOS\Main.cs:17

@jocontacter
Copy link

jocontacter commented Sep 12, 2020

the same error but with CollectionView when after changing ItemTemplate i trying to add to Item's ObservableCollection one item

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants