ListView with IsGroupingEnabled = true throws System.NullReferenceException in Android outside of single project structure #19845
Labels
area-controls-listview
ListView and TableView
high
It doesn't work at all, crashes or has a big impact.
migration-compatibility
Xamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convert
platform/android 🤖
s/triaged
Issue has been reviewed
s/verified
Verified / Reproducible Issue ready for Engineering Triage
t/bug
Something isn't working
Milestone
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
The text was updated successfully, but these errors were encountered: