Skip to content

UICollectionView is stuck in its update/layout loop #12188

@FM1973

Description

@FM1973

Description

Using a grouped collectionview with a datatemplateselector crashes on IOS with the following exception:

UICollectionView is stuck in its update/layout loop

The same sample on android runs without any exception.

This may be a very individual problem of what I´m trying to implement.
Some sort of chat view (rotated 180°) so the newest message is in the bottom an the oldest on the top.

Steps to Reproduce

  1. Clone the repo
  2. Click on button "Message" on Android --> no problems
  3. Do the same on IOS --> Exception
    If the exception doen´t occur immediately, try to swipe up or down

Link to public reproduction project repository

https://github.com/FM1973/RefreshGridRepo.git

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

IOS 14 and up

Did you find any workaround?

Not yet

Relevant log output

ObjCRuntime.ObjCException: 'Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: UICollectionView (<UICollectionView 0x7fa0334b7000>) is stuck in its update/layout loop. This can happen for various reasons, including self-sizing views whose preferred attributes are not returning a consistent size. To debug this issue, check the Console app for logs in the "UICollectionViewRecursion" category. In particular, look for messages about layout invalidations, or changes to properties like contentOffset (bounds.origin), bounds.size, frame, etc.
Native stack trace:
	0   CoreFoundation                      0x000000010c68b8ab __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x000000011aa2eba3 objc_exception_throw + 48
	2   Foundation                          0x0000000113ce90cc _userInfoForFileAndLine + 0
	3   UIKitCore                           0x0000000128ef1d88 -[UICollectionView _setNeedsVisibleCellsUpdate:withLayoutAttributes:] + 477
	4   UIKitCore                           0x0000000128f29ec2 -[UICollectionView _invalidateLayoutWithContext:] + 1601
	5   UIKitCore                           0x0000000128f63ef0 -[UICollectionViewLayout invalidateLayoutWithContext:] + 173
	6   UIKitCore                           0x0000000128f574ea -[UICollectionViewFlowLayout invalidateLayoutWithContext:] + 655
	7   UIKitCore                           0x0000000128ef7739 -[UICollectionView _checkForPreferredAttributesInView:originalAttributes:] + 695
	8   UIKitCore                           0x0000000128f047c9 __68-[UICollectionView _processViewSpecificInvalidationsForVisibleViews]_block_invoke + 424
	9   CoreFoundation                      0x000000010c5d5d82 __NSDICTIONARY_IS_CALLING_OUT_TO_A_BLOCK__ + 7
	10  CoreFoundation                      0x000000010c7008c5 -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 225
	11  UIKitCore                           0x0000000128f045b3 -[UICollectionView _processViewSpecificInvalidationsForVisibleViews] + 1140
	12  UIKitCore                           0x0000000128f01043 -[UICollectionView _updateVisibleCellsNow:] + 2481
	13  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	14  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	15  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	16  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	17  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	18  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	19  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	20  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	21  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	22  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	23  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	24  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	25  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	26  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	27  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	28  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	29  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	30  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	31  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	32  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	33  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	34  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	35  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	36  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	37  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	38  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	39  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	40  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	41  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	42  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	43  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	44  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	45  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	46  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	47  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	48  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	49  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	50  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	51  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	52  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	53  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	54  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	55  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	56  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	57  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	58  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	59  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	60  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	61  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	62  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	63  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	64  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	65  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	66  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	67  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	68  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	69  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	70  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	71  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	72  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	73  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	74  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	75  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	76  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	77  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	78  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	79  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	80  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	81  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	82  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	83  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	84  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	85  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	86  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	87  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	88  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	89  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	90  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	91  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	92  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	93  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	94  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	95  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	96  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	97  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	98  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	99  UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	100 UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	101 UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	102 UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	103 UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	104 UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	105 UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	106 UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	107 UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	108 UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	109 UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	110 UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	111 UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	112 UIKitCore                           0x0000000128f012ec -[UICollectionView _updateVisibleCellsNow:] + 3162
	113 UIKitCore                           0x0000000128f07bc4 -[UICollectionView layoutSubviews] + 375
	114 UIKitCore                           0x000000012a03159f -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2305
	115 QuartzCore                          0x000000011812802c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 526
	116 QuartzCore                          0x00000001181335b9 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 65
	117 QuartzCore                          0x0000000118044b0c _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 626
	118 QuartzCore                          0x000000011807c69b _ZN2CA11Transaction6commitEv + 735
	119 QuartzCore                          0x000000011807db64 _ZN2CA11Transaction25flush_as_runloop_observerEb + 60
	120 CoreFoundation                      0x000000010c5ea055 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
	121 CoreFoundation                      0x000000010c5e49c2 __CFRunLoopDoObservers + 515
	122 CoreFoundation                      0x000000010c5e4f0d __CFRunLoopRun + 1161
	123 CoreFoundation                      0x000000010c5e46a7 CFRunLoopRunSpecific + 560
	124 GraphicsServices                    0x000000012198728a GSEventRunModal + 139
	125 UIKitCore                           0x00000001299fead3 -[UIApplication _run] + 994
	126 UIKitCore                           0x0000000129a039ef UIApplicationMain + 123
	127 libxamarin-dotnet-debug.dylib       0x00000001099eda5a xamarin_UIApplicationMain + 58
	128 libmonosgen-2.0.dylib               0x000000010a1fb609 do_icall + 345
	129 libmonosgen-2.0.dylib               0x000000010a1fa113 do_icall_wrapper + 291
	130 libmonosgen-2.0.dylib               0x000000010a1ec52c interp_exec_method + 3276
	131 libmonosgen-2.0.dylib               0x000000010a1e9e93 interp_runtime_invoke + 259
	132 libmonosgen-2.0.dylib               0x000000010a00eef8 mono_runtime_invoke_checked + 136
	133 libmonosgen-2.0.dylib               0x000000010a016f0c do_exec_main_checked + 92
	134 libmonosgen-2.0.dylib               0x000000010a145ec2 mono_jit_exec + 354
	135 libxamarin-dotnet-debug.dylib       0x0000000109a31e77 xamarin_main + 1927
	136 RefreshGridRepo                     0x0000000100ac8f54 main + 68
	137 dyld                                0x000000010960b2bf start_sim + 10
	138 ???                                 0x0000000201222310 0x0 + 8608949008

Metadata

Metadata

Assignees

Labels

area-controls-collectionviewCollectionView, CarouselView, IndicatorViewarea-controls-refreshviewRefreshViewarea-layoutStackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenterfixed-in-8.0.0-preview.4.8333Look for this fix in 8.0.0-preview.4.8333!highIt doesn't work at all, crashes or has a big impact.perf/generalThe issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)platform/iost/bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions