-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
MAUI apps crash on launch on Windows after Visual Studio update - code 2147942405 (0x80070005) #12080
Comments
And I also noticed that the apk for android has become about 3MB more |
I can confirm this problem for MAUI Blazor Hybrid as well. Doesn't matter for me if its in Release or Debug mode. |
Could be one of these |
Can confirm, running the app once as admin works. |
Windows 10 or Windows 11? In my Win11 22621 VM I don't have the issue. |
Windows 10 Pro 22H2 |
1 similar comment
Windows 10 Pro 22H2 |
I have the same problem. The app deployment worked normally in VS 17.4.2. Windows 10 22H2 |
ok, so this looks like a Windows 10 Bug in combination with WinApp SDK 1.2.x which will be fixed in 2023
|
I cannot understand how this is passed. So, now no one can build Windows apps until 2023? The fix is to what: rollback VS version? |
Same Problem here too ! |
Rollback VS version did not work for me, instead it led to a broken MAUI installation. |
What worked for me: Build your app in any mode. It will crash on startup as expected. Now go to the windows start menu, right click the app you just build: More => Run as Admin. The app will start and so will every other MAUI app from now on even when started within Visual Studio. |
Yes, that worked for me too. I was overlooking this solution because I am still in the process of developing the MAUI app in Visual Studio. Thanks! |
My solution was to manually install the Microsoft.WindowsAppRuntime.1.2 redist |
Current workaround is to run the app once as admin. Or manually installing the Microsoft.WindowsAppRuntime 1.2 redist. Fix is coming automatically on Win 10 in Feb 2023:
|
@jpreece6 did you install the runtime from here? https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads#windows-app-sdk-12 |
Hi @holecekp. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Yep, runtime version 1.2.1.2.221116.1 |
I had this issue too, and running the app once as an admin didn't fix it. In fact, I was unable to even run the app as admin. I just installed Visual Studio Community 2022 today, running the latest version. Edition: Windows 10 Home |
@luizparente are you sure it is the same issue? Running as admin should fix it. Can you check your event log (EventViewer) and see whatthe app crash error is? |
I have very similar OS version as luiz. MAUI apps had been working for me until I upgraded to Visual Studio v17.4.3. A vanilla MAUI app from project template does not run and debug output window has this
Running VS as admin does not resolve the issue. Is there a way to continue MAUI development without undoing this VS upgrade? Correction run MAUI app as admin worked. I missed that you have to choose the app that got deployed and run that (instead of thru VS). |
@mattleibow positive. Here is what I did:
Seems to be an issue with an unregistered class in InteropServices... Or something along those lines. When I try to run the generated .exe as admin, the Event Viewer logs an error with source on .NET Runtime:
It also logs another error with source "Application Error":
And an Event Viewer Information entry:
Below my VS instance info: Microsoft Visual Studio Community 2022 |
@mattleibow |
There is now a January Preview Update for Windows 10: January 19, 2023—KB5019275 (OS Builds 19042.2546, 19044.2546, and 19045.2546) Preview Support page doesn't mention the fix, so maybe some Win10 users who still have the issue can try the update? |
I tried adding the following. |
remove the entry and try to install the Windows 10 update. |
I'll try it now. Where in the file should I paste that line? Or is it just a case of not updating Windows? |
MAUI 7.0.58 does not yet include this fix, however the upcoming 7.0.59 release will include it. We've made a couple of changes to mitigate the Windows OS bug:
Ultimately the Windows OS level bug was causing the Deployment Manager's Initialize call to return a failed result (due to an Access Denied error, which is why running the app as Admin would fix this). The generated code from the Windows App SDK would abrubtly invoke Environment.Exit on a failed result and did not log any useful information when this happened. Previous versions of WindowsAppSDK (1.1.x) had a different order of evaluating MSBuild properties and did not automatically include the generated code to call this initialize method which is why we didn't see the bug in MAUI before this. Since we are calling this Deployment Manager Initialize method ourselves now within MAUI instead, we are choosing to not exit immediately on a failed result, since in many cases the app will still work as expected. This call is mostly important for apps using windows specific notification API's and a few others, which many MAUI apps will not be using as it installs the additional framework references that ship with the windows app runtime but can't be installed in all distribution scenarios. It's correct to have this call in a MAUI app regardless of if you think you need it, the bug isn't in the fact that the deployment manager is being called, but rather in that on Windows 10 there was a bug where that call required elevation. The reason this change works around the Windows 10 OS bug is that we are choosing to not fail if the deployment manager cannot complete because it's possible the app will still execute normally, which is the same behaviour MAUI apps had in previous releases. To summarize, there are a few ways this issue can be mitigated:
|
Of all suggested workarounds, these worked for me:
And these did not work:
I am using VS Community 17.4.3 with MAUI 7.0.52. Also as suggested for the future to update to MAUI 7.0.59 is it possible to just update MAUI version or we have to wait until a VS update is available with updated version of MAUI? |
MAUI 7.0.59 is now released as part of 17.5 Preview 5 @danielkraut |
Manually installing latest Windows App SDK runtime helped |
Thanks. Just adding |
We still cannot get an installable Release build from our Azure Pipeline to start normally on a Windows 10 machine, following all the workarounds from this issue:
Nevertheless: Whenever we try to install & start the generated msix file, the app will not be started at all. Not even a window pops up and there is no error recorded in the Windows event viewer either. We have to manually build for Release mode on a developer's machine in Visual Studio for now, but we really would like to produce our Release builds in a more streamlined fashion. |
install the updates from todays Patchday, it includes the optional update from end January 2023. |
And it would be really great to get meaningful error messages. It seems
that when the mix fails it fails silently.
…On Tue, 14 Feb 2023, 3:44 pm Helmut Schmidt, ***@***.***> wrote:
We *still* cannot get an installable Release build from our Azure
Pipeline to start normally on a Windows 10 machine, following all the
workarounds from this issue:
- Install latest Windows App SDK Runtime on target machine
- Include
<WindowsAppSdkDeploymentManagerInitialize>false</WindowsAppSdkDeploymentManagerInitialize>
in csproj file
- Run app as Administrator
dotnet workload install ... installs .Net SDK 7.0.102 on the build
machine and we see the output Installing workload manifest
microsoft.net.sdk.maui version 7.0.59… in the build logs, meaning this
*is* the version that should produce a flawless release build, if I read
this issue correctly, right?
Nevertheless: Whenever we try to install & start the generated msix file,
the app will not be started at all. Not even a window pops up and there is
no error recorded in the Windows event viewer either.
We have to manually build for Release mode on a developer's machine in
Visual Studio for now, but we really would like to produce our Release
builds in a more streamlined fashion.
Does anyone have an idea if there is an obscure/special switch for the dotnet
workloads install or dotnet publish commands that needs to be flipped for
this to work?
—
Reply to this email directly, view it on GitHub
<#12080 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABCSC7OTXWS3WOIL5733QOLWXOK5JANCNFSM6AAAAAAS6BBRYM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Negative. We updated 2 Windows 10 target machines with the latest from Windows Update (including optionals) and the behaviour persists. Admitted: Since this is the output from |
VS 2022 17.4.5 also includes the MAUI 7.0 SR3 7.0.59:
Ask @Redth what else is needed to get this fixed. |
Sorry, maybe I'm a bit slow on the uptake, but I don't see how updating my Visual Studio is gonna help me fix the problems with our Azure build, where (according to build logs) MAUI 7.0.59 is already being used. I suggest we leave it at that for now. We'll see how the next release of MAUI behaves in our Azure Pipeline and if that still produces unstartable binaries on Windows, I'll open another issue. |
This problem still exists to this day :( I have tried the following methods, not working:
My development environment: Microsoft Visual Studio Community 2022 Version 17.4.5 Windows 11 Pro 22H2 I can't understand why Microsoft's testers didn't find this problem. |
UPDATE: Jan 20, 2023 (Link to Comment)
Description
All apps stopped working on Windows after updating Visual Studio to the version 17.4.3 (which probably also updated MAUI). When I press F5, any app will not run and the following error message is displayed in the Output windows:
The usual steps such as deleting bin and obj folders do not help. This affects all projects. Even an empty project created by Visual Studio template does not run.
Everything worked well with the previous version of VS/MAUI (I think it was MAUI 7.0.49 and VS 17.4.2).
Steps to Reproduce
... I can see that the issue cannot be saved without a link to a repro project. Because any project can be used to reproduce the issue I have added a link to a repro project for another issue to save time. This bug can be reproduced on it but as I have said before, it crashes even on an blank new project.
Link to public reproduction project repository
https://github.com/holecekp/MauiBugToolbar
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Windows 21H2
Did you find any workaround?
#12080 (comment)
OR #12080 (comment)
OR #12080 (comment)
Relevant log output
The text was updated successfully, but these errors were encountered: