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

NSInternalInconsistencyException Reason: Invalid update: invalid number of sections #26647

Open
LeoJHarris opened this issue Dec 15, 2024 · 2 comments
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/iOS 🍎 t/bug Something isn't working

Comments

@LeoJHarris
Copy link

LeoJHarris commented Dec 15, 2024

Description

Adding to a Grouping throws the following exception on iOS, does not crash on Android. Our use case is we use the RemainingItemsThresholdReachedCommand and RemainingItemsThreshold to load more items as per pagination, when we try to load more records into our CollectionView the app crashes immediately.

**ObjCRuntime.ObjCException:** 'Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: Invalid update: invalid number of sections. The number of sections contained in the collection view after the update (13) must be equal to the number of sections contained in the collection view before the update (8), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted). Collection view: <Microsoft_Maui_Controls_Handlers_Items_MauiCollectionView: 0x133678e00; baseClass = UICollectionView; frame = (0 0; 375 504); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x2808bec70>; layer = <CALayer: 0x2803f2840>; contentOffset: {0, 1844}; contentSize: {375, 2212}; adjustedContentInset: {0, 0, 122, 0}; layout: <Microsoft_Maui_Controls_Handlers_Items_ListViewLayout: 0x135331380>; dataSource: <SampleApp_Platforms_iOS_CustomGroupableItemsViewController_1: 0x1353246d0>>
Native stack trace:
	0   CoreFoundation                      0x000000018164fc74 EEC1287D-059B-38C8-9BC1-58A0C8B1E6C2 + 601204
	1   libobjc.A.dylib                     0x0000000198e7fee4 objc_exception_throw + 56
	2   Foundation                          0x0000000182df4c80 F9235FC7-EC4E-31C9-B56E-95CF10B07239 + 1199232
	3   UIKitCore                           0x0000000183cbea98 9D301877-2593-385C-8F72-F075AA0B48FA + 3959448
	4   UIKitCore                           0x0000000183f4a5bc 9D301877-2593-385C-8F72-F075AA0B48FA + 6628796
	5   UIKitCore                           0x000000018399c23c 9D301877-2593-385C-8F72-F075AA0B48FA + 672316
	6   SampleApp                         0x0000000106074538 xamarin_dyn_objc_msgSendSuper + 164
	7   SampleApp                         0x0000000106299de4 do_icall + 200
	8   SampleApp                         0x00000001062986b4 do_icall_wrapper + 348
	9   SampleApp                         0x000000010628c7d0 mono_interp_exec_method + 2632
	10  SampleApp                         0x0000000106289aec interp_entry_from_trampoline + 640
	11  SampleApp                         0x0000000106031970 native_to_interp_trampoline + 112
	12  SampleApp                         0x000000010639b1f4 -[__MonoMac_NSAsyncActionDispatcher xamarinApplySelector] + 96
	13  Foundation                          0x0000000182d0b660 F9235FC7-EC4E-31C9-B56E-95CF10B07239 + 243296
	14  CoreFoundation                      0x0000000181670448 EEC1287D-059B-38C8-9BC1-58A0C8B1E6C2 + 734280
	15  CoreFoundation                      0x0000000181680578 EEC1287D-059B-38C8-9BC1-58A0C8B1E6C2 + 800120
	16  CoreFoundation                      0x00000001815c2790 EEC1287D-059B-38C8-9BC1-58A0C8B1E6C2 + 22416
	17  CoreFoundation                      0x00000001815c7e08 EEC1287D-059B-38C8-9BC1-58A0C8B1E6C2 + 44552
	18  CoreFoundation                      0x00000001815db174 CFRunLoopRunSpecific + 572
	19  GraphicsServices                    0x00000001a20fa988 GSEventRunModal + 160
	20  UIKitCore                           0x0000000183ddda88 9D301877-2593-385C-8F72-F075AA0B48FA + 5134984
	21  UIKitCore                           0x0000000183b76f78 UIApplicationMain + 336
	22  SampleApp                         0x00000001060485f4 xamarin_UIApplicationMain + 60
	23  SampleApp                         0x0000000106299e58 do_icall + 316
	24  SampleApp                         0x00000001062986b4 do_icall_wrapper + 348
	25  SampleApp                         0x000000010628c7d0 mono_interp_exec_method + 2632
	26  SampleApp                         0x000000010628a2f4 interp_runtime_invoke + 236
	27  SampleApp                         0x00000001062581ac mono_jit_runtime_invoke + 1064
	28  SampleApp                         0x00000001061ffa14 mono_runtime_invoke_checked + 148
	29  SampleApp                         0x0000000106205e98 mono_runtime_exec_main_checked + 116
	30  SampleApp                         0x000000010625d930 mono_jit_exec + 356
	31  SampleApp                         0x0000000106073398 xamarin_main + 2312
	32  SampleApp                         0x000000010634d3a0 main + 64
	33  dyld                                0x00000001082d44d0 start + 444

Steps to Reproduce

Add new items to a CollectionView i.e. AddRange

Link to public reproduction project repository

No response

Version with bug

9.0.21 SR2.1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

No response

Affected platforms

iOS

Affected platform versions

iOS 15.0

Did you find any workaround?

Not yet.

Relevant log output

@LeoJHarris LeoJHarris added the t/bug Something isn't working label Dec 15, 2024
Copy link

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

@jfversluis jfversluis added platform/iOS 🍎 area-controls-collectionview CollectionView, CarouselView, IndicatorView labels Dec 16, 2024
@jfversluis
Copy link
Member

You mention iOS 15 specifically, is it only on that version or also newer versions of iOS?

@jfversluis jfversluis added this to the .NET 9 Servicing milestone Dec 16, 2024
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 platform/iOS 🍎 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants