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

[iOS 15] CollectionView with CollectionViewHandler2 configured, is crashing app on iOS 15 (15.2) #26997

Open
vitalbit opened this issue Jan 8, 2025 · 3 comments · May be fixed by #27051
Open
Assignees
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView collectionview-cv2 p/2 Work that is important, but is currently not scheduled for release partner/syncfusion Issues / PR's with Syncfusion collaboration platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@vitalbit
Copy link

vitalbit commented Jan 8, 2025

Description

iOS 15 and iOS 15.2 (tested only those versions) make application crash when rendering CollectionView with CollectionViewHandler2 configured. Meanwhile iOS 17 and iOS 18 works fine.

Steps to Reproduce

  1. Configure CollectionView with CollectionViewHandler2 in MauiProgram.cs.
  2. Use CollectionView on MainPage and try to add some items into ItemsSource.

Actual result: application is failed to start for iOS 15/15.2.
Expected result: application works fine like on iOS 17/18.

Please check reproduction repository with iOS 15.2 simulator run.

Link to public reproduction project repository

https://github.com/vitalbit/CollectionViewHandler2_IOS15_Sample

Version with bug

9.0.21 SR2.1

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15, iOS 15.2

Did you find any workaround?

Nope :(

Relevant log output

Microsoft.Maui.Controls.Handlers.Items2.ItemsViewController2<Microsoft.Maui.Controls.ReorderableItemsView>.CheckForEmptySource (Unknown Source:0)
Microsoft.Maui.Controls.Handlers.Items2.ItemsViewController2<Microsoft.Maui.Controls.ReorderableItemsView>.NumberOfSections (Unknown Source:0)
ObjCRuntime.Messaging.void_objc_msgSendSuper (Unknown Source:0)
UIKit.UIViewController.LoadView (UIViewController.g.cs:691)
Microsoft.Maui.Controls.Handlers.Items2.ItemsViewController2<Microsoft.Maui.Controls.ReorderableItemsView>.LoadView (Unknown Source:0)
ObjCRuntime.Messaging.NativeHandle_objc_msgSendSuper (Unknown Source:0)
UIKit.UIViewController.get_View (UIViewController.g.cs:3275)
Microsoft.Maui.Controls.Handlers.Items2.ItemsViewHandler2<Microsoft.Maui.Controls.ReorderableItemsView>.CreatePlatformView (Unknown Source:0)
Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.Controls.ReorderableItemsView,UIKit.UIView>.OnCreatePlatformView (Unknown Source:0)
Microsoft.Maui.Controls.Handlers.Items2.ItemsViewHandler2<Microsoft.Maui.Controls.ReorderableItemsView>.OnCreatePlatformView (Unknown Source:0)
Microsoft.Maui.Handlers.ViewHandler.OnCreatePlatformElement (Unknown Source:0)
Microsoft.Maui.Handlers.ElementHandler.CreatePlatformElement (Unknown Source:0)
Microsoft.Maui.Handlers.ElementHandler.SetVirtualView (Unknown Source:0)
Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.Controls.ReorderableItemsView,UIKit.UIView>.SetVirtualView (Unknown Source:0)
Microsoft.Maui.Handlers.ViewHandler<Microsoft.Maui.Controls.ReorderableItemsView,UIKit.UIView>.SetVirtualView (Unknown Source:0)
Microsoft.Maui.Controls.Element.SetHandler (Unknown Source:0)
Microsoft.Maui.Controls.Element.set_Handler (Unknown Source:0)
Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IElement.set_Handler (Unknown Source:0)
Microsoft.Maui.Platform.ElementExtensions.ToHandler (Unknown Source:0)
Microsoft.Maui.Platform.ElementExtensions.ToPlatform (Unknown Source:0)
@vitalbit vitalbit added the t/bug Something isn't working label Jan 8, 2025
@jfversluis jfversluis added platform/iOS 🍎 area-controls-collectionview CollectionView, CarouselView, IndicatorView collectionview-cv2 p/2 Work that is important, but is currently not scheduled for release labels Jan 8, 2025
@jfversluis jfversluis added this to the .NET 9 Servicing milestone Jan 8, 2025
@Ying-6 Ying-6 added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage labels Jan 8, 2025
@Ying-6
Copy link

Ying-6 commented Jan 8, 2025

This issue has been verified using Visual Studio 17.13.0 Preview 2.1 (9.0.22 &9.0.21 & 9.0.14). Can repro on iOS 15.2, and not repro on iOS 18.2.
Image

@PureWeen PureWeen modified the milestones: .NET 9 Servicing, .NET 9 SR4 Jan 8, 2025
@karthikraja-arumugam karthikraja-arumugam added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jan 9, 2025
@dhindrik
Copy link
Contributor

dhindrik commented Jan 9, 2025

We also have this issue with iOS 16.x devices.

@vitalbit
Copy link
Author

vitalbit commented Jan 11, 2025

I decided to apply suggested fix and use CarouselViewHandler2 with CarouselView (so basically I've added null check for CarouselViewController2 -> NumberOfSections). After that another issue has appeared (I can create a separate issue for that if needed, but I feel they are connected).

Steps to reproduce:

  1. Use this branch as a sample: https://github.com/vitalbit/CollectionViewHandler2_IOS15_Sample/tree/fix/add-carousel-view
  2. In Burger Menu switch to CarouselView page.

Actual behaviour: app is crashed with the following:

Objective-C exception thrown. Name: NSInvalidArgumentException Reason: +[NSCollectionLayoutGroup horizontalGroupWithLayoutSize:repeatingSubitem:count:]: unrecognized selector sent to class 0x7fff866a7b70
Native stack trace:
0 CoreFoundation 0x00007fff203feba4 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff201a1be7 objc_exception_throw + 48
2 CoreFoundation 0x00007fff2040d72a __CFExceptionProem + 0
3 CoreFoundation 0x00007fff204030ac forwarding + 1433
4 CoreFoundation 0x00007fff204051d8 _CF_forwarding_prep_0 + 120
5 libxamarin-dotnet-debug.dylib 0x000000010cfc4ef9 xamarin_dyn_objc_msgSend + 217
6 libmonosgen-2.0.dylib 0x000000010d3c1675 do_icall + 341
7 libmonosgen-2.0.dylib 0x000000010d3bfd57 do_icall_wrapper + 295
8 libmonosgen-2.0.dylib 0x000000010d3b0d73 mono_interp_exec_method + 3411
9 libmonosgen-2.0.dylib 0x000000010d3c1b05 interp_entry + 453
10 libmonosgen-2.0.dylib 0x000000010d3c26b7 interp_entry_static_ret_3 + 71
11 ??? 0x000000010c26eccd 0x0 + 4498844877
12 UIKitCore 0x00007fff245fdc4f __51-[UICollectionViewCompositionalLayout _fullResolve]_block_invoke + 369
13 UIKitCore 0x00007fff2460bfae -[_UICollectionCompositionalLayoutSolver _queryClientForSectionDefintionForSectionIndex:] + 269
14 UIKitCore 0x00007fff2460311f -[_UICollectionCompositionalLayoutSolver _solve] + 90
15 UIKitCore 0x00007fff2460304f -[_UICollectionCompositionalLayoutSolver initWithContainer:traitCollection:layoutAxis:dataSourceSnapshot:options:sectionProvider:] + 607
16 UIKitCore 0x00007fff245fd52e -[UICollectionViewCompositionalLayout _fullResolve] + 1113
17 UIKitCore 0x00007fff245fa5e4 -[UICollectionViewCompositionalLayout prepareLayout] + 204
18 UIKitCore 0x00007fff246eea7d -[UICollectionViewData _prepareToLoadData] + 171
19 UIKitCore 0x00007fff246a0dc7 -[UICollectionView setFrame:] + 658
20 UIKitCore 0x00007fff25602010 -[UIView(Geometry) _resizeWithOldSuperviewSize:] + 1034
21 UIKitCore 0x00007fff25505c84 -[UIScrollView(_UIOldConstraintBasedLayoutSupport) _resizeWithOldSuperviewSize:] + 46
22 UIKitCore 0x00007fff2560101a __46-[UIView(Geometry) resizeSubviewsWithOldSize:]_block_invoke + 121
23 CoreFoundation 0x00007fff2036fde5 NSARRAY_IS_CALLING_OUT_TO_A_BLOCK + 7
24 CoreFoundation 0x00007fff202fb005 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 527
25 UIKitCore 0x00007fff25600f8e -[UIView(Geometry) resizeSubviewsWithOldSize:] + 198
26 UIKitCore 0x00007fff255ff26b -[UIView(Geometry) setFrame:] + 621
27 UIKitCore 0x00007fff25602010 -[UIView(Geometry) _resizeWithOldSuperviewSize:] + 1034
28 UIKitCore 0x00007fff2560101a __46-[UIView(Geometry) resizeSubviewsWithOldSize:]_block_invoke + 121
29 CoreFoundation 0x00007fff2036fde5 NSARRAY_IS_CALLING_OUT_TO_A_BLOCK + 7
30 CoreFoundation 0x00007fff202fb005 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 527
31 UIKitCore 0x00007fff25600f8e -[UIView(Geometry) resizeSubviewsWithOldSize:] + 198
32 UIKitCore 0x00007fff256024cc -[UIView(Geometry) setBounds:] + 643
33 libxamarin-dotnet-debug.dylib 0x000000010cfc501c xamarin_dyn_objc_msgSendSuper + 220
34 ??? 0x000000010c1f2ebe 0x0 + 4498337470
35 libmonosgen-2.0.dylib 0x000000010d3c00da ves_pinvoke_method + 554
36 libmonosgen-2.0.dylib 0x000000010d3b0e39 mono_interp_exec_method + 3609
37 libmonosgen-2.0.dylib 0x000000010d3ae5a3 interp_runtime_invoke + 259
38 libmonosgen-2.0.dylib 0x000000010d4a4528 mono_runtime_invoke_checked + 136
39 libmonosgen-2.0.dylib 0x000000010d4a8a32 mono_runtime_invoke + 562
40 libxamarin-dotnet-debug.dylib 0x000000010cfbc04c xamarin_invoke_trampoline + 6460
41 libxamarin-dotnet-debug.dylib 0x000000010cfc3b99 xamarin_arch_trampoline + 105
42 libxamarin-dotnet-debug.dylib 0x000000010cfc4d7a xamarin_x86_64_common_trampoline + 118
43 UIKitCore 0x00007fff2561d2b1 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2962
44 QuartzCore 0x00007fff289e2d2e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 548
45 QuartzCore 0x00007fff289edebf _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 65
46 QuartzCore 0x00007fff28929c86 _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 700
47 QuartzCore 0x00007fff28961853 _ZN2CA11Transaction6commitEv + 699
48 UIKitCore 0x00007fff2508c831 _afterCACommitHandler + 105
49 CoreFoundation 0x00007fff2036bc67 CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23
50 CoreFoundation 0x00007fff2036648c __CFRunLoopDoObservers + 541
51 CoreFoundation 0x00007fff20366a3c __CFRunLoopRun + 1126
52 CoreFoundation 0x00007fff203660f3 CFRunLoopRunSpecific + 567
53 GraphicsServices 0x00007fff2c995cd3 GSEventRunModal + 139
54 UIKitCore 0x00007fff25059f42 -[UIApplication _run] + 928
55 UIKitCore 0x00007fff2505eb5e UIApplicationMain + 101
56 libxamarin-dotnet-debug.dylib 0x000000010cf8311a xamarin_UIApplicationMain + 58
57 libmonosgen-2.0.dylib 0x000000010d3c1675 do_icall + 341
58 libmonosgen-2.0.dylib 0x000000010d3bfd57 do_icall_wrapper + 295
59 libmonosgen-2.0.dylib 0x000000010d3b0d73 mono_interp_exec_method + 3411
60 libmonosgen-2.0.dylib 0x000000010d3ae5a3 interp_runtime_invoke + 259
61 libmonosgen-2.0.dylib 0x000000010d4a4528 mono_runtime_invoke_checked + 136
62 libmonosgen-2.0.dylib 0x000000010d4abfeb mono_runtime_exec_main_checked + 107
63 libmonosgen-2.0.dylib 0x000000010d2ff1f2 mono_jit_exec + 354
64 libxamarin-dotnet-debug.dylib 0x000000010cfc3a27 xamarin_main + 1879
65 CollectionViewHandler2_IOS15_Sample 0x000000010bd734e4 main + 52
66 dyld 0x000000010c602ee9 start_sim + 10
67 ??? 0x000000011985b345 0x0 + 4723159877
at UIKit.NSCollectionLayoutGroup.GetHorizontalGroup(NSCollectionLayoutSize layoutSize, NSCollectionLayoutItem repeatingSubitem, IntPtr count) in /Users/builder/azdo/_work/9/s/xamarin-macios/src/build/dotnet/ios/generated-sources/UIKit/NSCollectionLayoutGroup.g.cs:220
at at Microsoft.Maui.Controls.Handlers.Items2.CarouselViewHandler2.<>c__DisplayClass4_0.b__0(IntPtr sectionIndex, INSCollectionLayoutEnvironment environment)
at ObjCRuntime.Trampolines.SDUICollectionViewCompositionalLayoutSectionProvider.Invoke(IntPtr block, IntPtr section, NativeHandle layoutEnvironment) in /Users/builder/azdo/_work/9/s/xamarin-macios/src/build/dotnet/ios/generated-sources/ObjCRuntime/Trampolines.g.cs:49638
at UIKit.UIView.set_Bounds(CGRect value) in /Users/builder/azdo/_work/9/s/xamarin-macios/src/build/dotnet/ios/generated-sources/UIKit/UIView.g.cs:3113
at at Microsoft.Maui.ViewHandlerExtensions.PlatformArrangeHandler(IViewHandler viewHandler, Rect rect)
at at Microsoft.Maui.Handlers.ViewHandler`2[[Microsoft.Maui.ILayout, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Microsoft.Maui.Platform.LayoutView, Microsoft.Maui, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].PlatformArrange(Rect rect)
at at Microsoft.Maui.Controls.VisualElement.ArrangeOverride(Rect bounds)
at at Microsoft.Maui.Controls.VisualElement.Microsoft.Maui.IView.Arrange(Rect bounds)
at at Microsoft.Maui.Layouts.LayoutExtensions.ArrangeContent(IContentView contentView, Rect bounds)
at at Microsoft.Maui.Controls.ContentPage.Microsoft.Maui.ICrossPlatformLayout.CrossPlatformArrange(Rect bounds)
at at Microsoft.Maui.Platform.MauiView.CrossPlatformArrange(Rect bounds)
at at Microsoft.Maui.Platform.MauiView.LayoutSubviews()
at at Microsoft.Maui.Platform.ContentView.LayoutSubviews()
at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/9/s/xamarin-macios/src/UIKit/UIApplication.cs:61
at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/9/s/xamarin-macios/src/UIKit/UIApplication.cs:96
at CollectionViewHandler2_IOS15_Sample.Program.Main(String[] args) in /Users/vitalipantsialei/VSProjects/CollectionViewHandler2_IOS15_Sample/CollectionViewHandler2_IOS15_Sample/Platforms/iOS/Program.cs:13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView collectionview-cv2 p/2 Work that is important, but is currently not scheduled for release partner/syncfusion Issues / PR's with Syncfusion collaboration platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
Status: Todo
7 participants