maui icon indicating copy to clipboard operation
maui copied to clipboard

Windows 11 Update KB5040527 breaks app startup

Open marco-kretz opened this issue 1 year ago • 4 comments

Description

Hey there, I just installed Windows 11 Update KB5040527 and cannot run my .NET MAUI Application from VS2022 anymore. I get the following error without changing any code:

This element does not have a XamlRoot. Either set the XamlRoot property or add the element to a tree."} System.ArgumentException

The app (Windows, x64) flashes for a second and then throws this exception. After reverting the update, everything runs fine again. VS2022 updated to latest version. Before that update, the app worked totally fine.

If u need anything which can help to hunt that error down, just ask.

Steps to Reproduce

  1. Install Windows 11 update KB5040527
  2. Try to run Windows App in Debugging or Release Mode

Link to public reproduction project repository

No response

Version with bug

8.0.61 SR6.1

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 11 Enterprise

Did you find any workaround?

Revert update KB5040527

Relevant log output

Exception: {"Falscher Parameter.\r\n\r\nThis element does not have a XamlRoot. Either set the XamlRoot property or add the element to a tree."}

Error: {Microsoft.UI.Xaml.UnhandledExceptionEventArgs}
Message: Wrong Parameter. This element does not have a XamlRoot. Either set the XamlRoot property or add the element to a tree.
Sender: {SalesAppMaui.WinUI.App}
Source: WinRT.Runtime
ParamName: null
HResult: -2147024809

StackTrace:
   at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|39_0(Int32 hr)
   at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr)
   at ABI.Microsoft.UI.Xaml.Controls.IContentDialogMethods.ShowAsync(IObjectReference _obj)
   at Microsoft.UI.Xaml.Controls.ContentDialog.ShowAsync()
   at Microsoft.Maui.Controls.Platform.AlertManager.AlertRequestHelper.<ShowAlert>d__14.MoveNext()
   at Microsoft.Maui.Controls.Platform.AlertManager.AlertRequestHelper.<OnAlertRequested>d__11.MoveNext()
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext.<>c__DisplayClass2_0.<Post>b__0()

marco-kretz avatar Aug 01 '24 09:08 marco-kretz

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!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

github-actions[bot] avatar Aug 01 '24 09:08 github-actions[bot]

Just wanted to add that I am running into this exact issue as well. I never ran my app on Windows, it is primarily for mobile but was curious to see if it would work on Windows. When I attempt to run the app for windows it gives a window but immediately displays the error.

tstrausbaugh-dev avatar Aug 19 '24 15:08 tstrausbaugh-dev

It looks like that release is

OS Builds 22621.3958 and 22631.3958

I'm running 22631.4037

And haven't seen any issues launching windows.

Can you run a File => new MAUI app?

Maybe it's something specific with your app?

PureWeen avatar Aug 28 '24 19:08 PureWeen

It looks like that release is

OS Builds 22621.3958 and 22631.3958

I'm running 22631.4037

And haven't seen any issues launching windows.

Can you run a File => new MAUI app?

Maybe it's something specific with your app?

When I create a blank project it works. It's weird, I'm using the same versions. But ofc I have some additional libraries. Will check if any of them cause this problem because it still exists.

It also started breaking without any changes to my code. When I revert the update I mentioned, it works perfectly fine.

marco-kretz avatar Sep 19 '24 10:09 marco-kretz

I'm a step further now. In my project I set the MainPage within the App.xaml.cs like this:

MainPage = new NavigationPage(new MainPage());

When I revert to using the AppShell the App no longer crashes. I don't know why. I will try to get around my problems with the AppShell instead of just using NavigationPage, but that's just fighting symptoms I guess?

Edit: Okay, now I get the same error again after restarting the app.

marco-kretz avatar Sep 19 '24 10:09 marco-kretz

Okay, I fixed the error by deleting the App's data folder under %appdata%\..\Local\Packages\<my-app>. This did not just fixed it on my PC, it also worked on all my clients devices. I don't know what this caused but I'm glad it's working again.

marco-kretz avatar Sep 24 '24 07:09 marco-kretz

I have the same problem, all solutions proposed doesn't work

criss02-cs avatar Oct 14 '24 17:10 criss02-cs