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

CollectionView with IsGrouped="True" throws NSInternalInconsistencyException with iOS 18 SDK #24971

Closed
velocitysystems opened this issue Sep 27, 2024 · 14 comments
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/iOS 🍎 potential-regression This issue described a possible regression on a currently supported version., verification pending t/bug Something isn't working

Comments

@velocitysystems
Copy link

velocitysystems commented Sep 27, 2024

Description

CollectionView with IsGrouped="True" throws a NSInternalInconsistencyException.
This happens when built with Xcode 16/iOS 18 SDK.

Note: This did not happen when building with Xcode 15.4/iOS 17.x SDK.

Steps to Reproduce

Create a blank MAUI app.
Add a CollectionView to a page with a data source and grouping enabled.

Link to public reproduction project repository

No response

Version with bug

8.0.91 SR9.1

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.91 SR9.1

Affected platforms

iOS

Affected platform versions

.NET 8.0.1xxx - Xcode 16.0 Support (8303)

Did you find any workaround?

Disable grouping.

Relevant log output

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
@velocitysystems velocitysystems added the t/bug Something isn't working label Sep 27, 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.

@velocitysystems
Copy link
Author

Tested with 8.0.99-ci.net8.24477.4 and can confirm the NSInternalInconsistencyException is no longer thrown.
This appears to be fixed by #24873. Closing as a duplicate of #17969.

@LeoJHarris
Copy link

LeoJHarris commented Oct 1, 2024

This is a blocking issue, our app immediately crashes with Xcode 16 but we are struggling to roll back as we have already updated to the latest MAUI workloads and the current error raised when trying to target Xcode 15.4 are for example:

error MT4162: The type 'UIKit.UITextFormattingViewController' (used as a parameter in UIKit.UITextView/_UITextViewDelegate.DidBeginFormatting) is not available in iOS 17.5 (it was introduced in iOS 18.0). Please build with a newer iOS SDK (usually done by using the most recent version of Xcode). 

We have not updated MAC OS yet, does anyone have work around or the cmd lines to rollback to previous MAUI workloads? Or rolling back to a specific workload such as 4.0.100

@velocitysystems
Copy link
Author

@LeoJHarris You can install Xcode 15.4 and use the previous workload version:

dotnet workload install maui --version 8.0.402.0

If you are building your app in a pipeline i.e. Azure DevOps you can do something like this:

- task: CmdLine@2
  displayName: Set Xcode Version
  inputs:
    script: sudo xcode-select -s /Applications/Xcode_15.4.app

- task: DotNetCoreCLI@2
  displayName: dotnet workload install
  inputs:
    command: custom
    custom: workload
    arguments: install maui --version 8.0.402.0

@samhouts samhouts added platform/iOS 🍎 potential-regression This issue described a possible regression on a currently supported version., verification pending area-controls-collectionview CollectionView, CarouselView, IndicatorView labels Oct 1, 2024
@LeoJHarris
Copy link

LeoJHarris commented Oct 1, 2024

@velocitysystems that worked

Running in the cmd line:
dotnet workload install maui --version 8.0.402.0

Also my Mac OS is still using Sonoma 14.7 which is probably my saving grace at the moment. The entire MAUI iOS eco system seems extremely fragile atm. But this is the only thing that work for me and probably the best I can upgrade to.

@elvenprogrammer
Copy link

Still having the same issue in a minimal repro, I updated to 9.0.0-rc.1.24453.9 with no benefit: NSInternalInconsistencyException Reason: Expected dequeued view to be returned to the collection view in preparation for display.

Any update on this topic?

@tritter
Copy link

tritter commented Oct 9, 2024

Definitely regression tested on mutliple systems with Sequoia. Problem is that macOS Sequoia only works with Xcode 16, iOS18 SDK. This means there is no fix at the moment...

@Shashidhar014
Copy link

Shashidhar014 commented Oct 10, 2024

Tested with 8.0.99-ci.net8.24477.4 and can confirm the NSInternalInconsistencyException is no longer thrown. This appears to be fixed by #24873. Closing as a duplicate of #17969.

When this fix will be released for .Net8.0? I am kind of stuck with this issue.

@pboisso
Copy link

pboisso commented Oct 25, 2024

Getting this here too.

@jfversluis
Copy link
Member

Looks like this should be fixed with .NET MAUI 8.0.92, please try that one and open a new issue if thats not the case. Thanks!

@pboisso
Copy link

pboisso commented Oct 29, 2024

We tested 8.0.92, but it brings a whole new set of problems for us, like many of the new .Net Maui releases. We stick with 8.0.82 and XCode 15.4 here for now, that's the most stable we have been able to achieve so far with Maui (our Xamarin Forms were stable for years without any issues).

@kofanov
Copy link

kofanov commented Oct 31, 2024

I have the same problem with 8.0.82 and Xcode 16 on iOS 18 when using grouped CollectionView. And I can confirm that Microsoft.Maui.Controls 8.0.92 solves this problem but brings whole new set of problems:

  1. Shell navigation works incorrectly. When I select any item, then other items becomes inactive (Flyout navigation stops working) and also selected item not applying active style.
  2. Custom TitleView doesn't work. It doesn't appear and then appears only after I expand and collapse Flyout menu.
  3. CollectonView Header moves by 90% out of the screen bounds.

Unfortunately I can't downgrade Xcode to 15.4 because of update Mac OS to Sequoia.
Also I have tried to use Nightly builds of Microsoft.Maui.Controls, but with no effect.

Is there any workaround? Maybe somebody can make some Handler to resolve this issue and continue to use 8.0.82?

@MauiExpert
Copy link

MauiExpert commented Nov 6, 2024

Hi, I have found a solution to this problem for anyone who is still struggling. All I had to do to get this to work is to add a few packages to the main project csproj.

These are the packages that I added:
PackageReference Include="Microsoft.Maui.Controls" Version="8.0.92"
PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.92"
PackageReference Include="Microsoft.Maui.Controls.Core" Version="8.0.92"
PackageReference Include="Microsoft.Maui.Controls.Xaml" Version="8.0.92"
PackageReference Include="Microsoft.Maui.Controls.Build.Tasks" Version="8.0.92"
PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0"

Once you’ve added these packages, do a clean, delete bin and obj, launch visual studio, build the project and run it.

This resolved my Collectionview IsGrouped issue for iOS 18.0, I hope it resolves yours too.

@kofanov
Copy link

kofanov commented Nov 7, 2024

Thank you for your answer!
Unfortunately, it doesn't work in my case. Using 8.0.92 libraries still brings set of listed problems.
I have resolved this issue only by installing Mac OS Sonoma, XCode 15.4, VS Code, and older MAUI workloads on external SSD and then boot from this SSD. I have spend few days trying to resolve this issues with many-many different options. But with no effect.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/iOS 🍎 potential-regression This issue described a possible regression on a currently supported version., verification pending t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants