Open Agistaris opened 4 hours ago
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.
Description
I've been using a group collection view to display grouped views for a while, traditional collection views do not have this issue. Only grouped collection views. The moment I populate either the Item source directly for the collection view or set the binding context to reference the item source for the collection view in XAML it has this issue and there seems to be no work around. This issue arose when using the iOS 18.1 simulator and when deployed on devices with iOS 18.1 and above (iOS 17.5 and below does not have this issue) using xcode 16+. This is also with .net8.0 and .NET 9.0 ,here is the exception I was able to catch:
ObjCRuntime.ObjCException: 'Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Expected dequeued view to be returned to the collection view in preparation for display. When the collection view's data source is asked to provide a view for a given index path, ensure that a single view is dequeued and returned to the collection view. Avoid dequeuing views without a request from the collection view. For retrieving an existing view in the collection view, use -[UICollectionView cellForItemAtIndexPath:] or -[UICollectionView supplementaryViewForElementKind:atIndexPath:]. Dequeued view: <Microsoft_Maui_Controls_Handlers_Items_VerticalSupplementaryView: 0x104acec40; baseClass = UICollectionViewCell; frame = (0 0; 0 0); alpha = 0; layer = <CALayer: 0x6000005c1420>>; Collection view: <Microsoft_Maui_Controls_Handlers_Items_MauiCollectionView: 0x127af7e00; baseClass = UICollectionView; frame = (0 0; 402 674); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x600000cd4ea0>; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x60000053fb60>; contentOffset: {0, 0}; contentSize: {402, 315}; adjustedContentInset: {0, 0, 539, 0}; layout: <Microsoft_Maui_Controls_Handlers_Items_ListViewLayout: 0x104aa1520>; dataSource: <Microsoft_Maui_Controls_Handlers_Items_ReorderableItemsViewController_1: 0x104a9f190>>
Here is an example collection view:
Steps to Reproduce
1. Set up the .NET MAUI Project:
2. Create Grouped Data Models:
3. Set up the CollectionView:
4. Bind Grouped Collection to CollectionView:
5. Populate the CollectionView via Binding:
6. Run on iOS 18.1 or Above:
Link to public reproduction project repository
No response
Version with bug
9.0.10 SR1
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
9.0.10 SR1
Affected platforms
iOS
Affected platform versions
iOS 18.1 and up
Did you find any workaround?
No work arounds. This does work with .NET 9.0 and .NET 8.0 if targeting a platform running on 17.5 and below. However, future releases will not work. that is why I said yes to regression testing but left the version as the current .NET release. because it does not work on newer iOS releases.
Relevant log output