[WinUI] NullReferenceException on startup when using UseMauiCompatibility() + Prism · Issue #12454 · dotnet/maui · GitHub
Skip to content

[WinUI] NullReferenceException on startup when using UseMauiCompatibility() + Prism #12454

Open
@BurkusCat

Description

Description

When using UseMauiCompatability on WinUI when Prism is being used, the app gets NullReferenceException on startup. See: #7949 for the original report of this issue by @anpin.

image

Steps to Reproduce

  1. Create a new Maui app
  2. Add UseMauiCompatability
  3. Install Prism.Maui and set it up
  4. Try to run the app

Expected
App launches fine

Actual
App crashes

Link to public reproduction project repository

https://github.com/BurkusCat/UseMauiCompatibilityWinUIException

Version with bug

6.0 Release Candidate 2 or older

Last version that worked well

6.0 Release Candidate 2 or older

Affected platforms

Windows

Affected platform versions

net6.0-windows10.0.19041.0

Did you find any workaround?

Workaround is to not call UseMauiCompatability on Windows:

#if ANDROID || IOS || MACCATALYST
            // Including this on Windows causes app to crash
            builder.UseMauiCompatibility();
#endif

I'm surprised UseMauiCompatibility does anything on Windows because I don't think there is compatibility provided for UWP custom renderers etc. in Maui.

Relevant log output

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area-core-lifecycleXPlat and Native UIApplicationDelegate/Activity/Window lifecycle eventsmigration-compatibilityXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convertplatform/windows 🪟s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions