Open nau-dwb opened 9 months ago
Verified this issue with Visual Studio 17.10.0 Preview 5(.NET8 &.NET7). Can repro on android platform with sample project. .NET7: Throws System.NullReferenceException. .NET8: App crashes on the emulator.
/similarissues
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Description
If we have a MAUI page with a ListView that has grouping enabled invoked in a stand alone .NET Android application (not part of the single project structure where MAUI\Android\iOS code is all together) then the page throws
System.NullReferenceException: 'Object reference not set to an instance of an object.'
when loading.This does NOT happen in Android if using the single project structure.
It does NOT happen in iOS whether it's standalone or single project structure.
It does NOT happen if not using grouping.
We're trying to migrate our Xamarin application to .NET 7 and MAUI. Our Xamarin Android and Xamarin iOS applications are their own project and all our Xamarin Forms code is in a .NET Standard project that the Android and iOS projects reference. We need to keep this same structure going forward (separate .NET7 Android and .NET7 iOS projects referencing a shared project containing the MAUI code targeting .NET android and iOS)
Steps to Reproduce
Expected: List displays formatted to support grouping
Actual: NullReferenceException thrown.
In the provided repro, run the code in
simple-android-embedded
to repro this exception. Running the code insimple-maui-embedded
will demonstrate that this works correctly in Android under the single project structure.Link to public reproduction project repository
https://github.com/nau-dwb/maui-embedded-use-issues/tree/main
Version with bug
Unknown/Other
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
Android, I was not able test on other platforms
Affected platform versions
Android 26+ with .NET 7
Did you find any workaround?
No real workarounds. As noted, this works fine if using the single project structure but we cannot switch to a single project structure at this time.
The only workaround to unblock will be to not use grouping in the list if running on Android.
Relevant log output