Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows 11 Update KB5040527 breaks app startup #23963

Closed
marco-kretz opened this issue Aug 1, 2024 · 7 comments
Closed

Windows 11 Update KB5040527 breaks app startup #23963

marco-kretz opened this issue Aug 1, 2024 · 7 comments
Labels
platform/windows 🪟 potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-repro Attach a solution or code which reproduces the issue t/bug Something isn't working

Comments

@marco-kretz
Copy link

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 marco-kretz added the t/bug Something isn't working label Aug 1, 2024
Copy link
Contributor

github-actions bot commented Aug 1, 2024

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.

@tstrausbaugh-dev
Copy link

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.

@PureWeen PureWeen added potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-repro Attach a solution or code which reproduces the issue labels Aug 28, 2024
@PureWeen
Copy link
Member

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?

@dotnet-policy-service dotnet-policy-service bot added the s/no-recent-activity Issue has had no recent activity label Sep 2, 2024
@marco-kretz
Copy link
Author

marco-kretz commented Sep 19, 2024

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.

@dotnet-policy-service dotnet-policy-service bot removed the s/no-recent-activity Issue has had no recent activity label Sep 19, 2024
@marco-kretz
Copy link
Author

marco-kretz commented Sep 19, 2024

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
Copy link
Author

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.

@criss02-cs
Copy link

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

@github-actions github-actions bot locked and limited conversation to collaborators Nov 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform/windows 🪟 potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-repro Attach a solution or code which reproduces the issue t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants