maui
maui copied to clipboard
Windows 11 Update KB5040527 breaks app startup
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
- Install Windows 11 update KB5040527
- 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()
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:
- Unable to deploy WinUI App after updating to 8.0.10, 8.0.14, 8.0.20, or installing VS 17.10 (#21744), similarity score: 0.76
Closed similar issues:
- Application crashes on Startup if installed as MSIX package (#7473), similarity score: 0.73
- MAUI apps crash on launch on Windows after Visual Studio update - code 2147942405 (0x80070005) (#12080), similarity score: 0.73
- Windows app installs on Wndows 10 but fails to install on Windows 11 as it keeps asking for .NET even after installation of .NET 8? (#20084), similarity score: 0.73
- Windows/UWP crashes on 8.0.10 (#21360), similarity score: 0.73
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
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.
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?
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.
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.
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.
I have the same problem, all solutions proposed doesn't work