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

.NET Maui first Hello World for .Net 7.0 Windows target fails #12186

Closed
ILIA-BROUDNO opened this issue Dec 17, 2022 · 5 comments
Closed

.NET Maui first Hello World for .Net 7.0 Windows target fails #12186

ILIA-BROUDNO opened this issue Dec 17, 2022 · 5 comments
Labels

Comments

@ILIA-BROUDNO
Copy link

Problem encountered on https://dotnet.microsoft.com/en-us/learn/maui/first-app-tutorial/run
Operating System: windows

Windows 10
Visual Studio 2022 17.4.3
.NET Maui first Hello World for .Net 7.0
Windows target builds, but exits before I see it pop up its window. This is the output:

'MauiApp3.exe' (CoreCLR: clrhost): Loaded 'C:\Users\iliab\source\repos\MauiApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\Microsoft.Windows.ApplicationModel.WindowsAppRuntime.Projection.dll'.
'MauiApp3.exe' (CoreCLR: clrhost): Loaded 'C:\Users\iliab\source\repos\MauiApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Runtime.InteropServices.dll'.
'MauiApp3.exe' (CoreCLR: clrhost): Loaded 'C:\Users\iliab\source\repos\MauiApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\WinRT.Runtime.dll'.
'MauiApp3.exe' (CoreCLR: clrhost): Loaded 'C:\Users\iliab\source\repos\MauiApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Collections.Concurrent.dll'.
'MauiApp3.exe' (CoreCLR: clrhost): Loaded 'C:\Users\iliab\source\repos\MauiApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Collections.dll'.
'MauiApp3.exe' (CoreCLR: clrhost): Loaded 'C:\Users\iliab\source\repos\MauiApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Threading.dll'.
'MauiApp3.exe' (CoreCLR: clrhost): Loaded 'C:\Users\iliab\source\repos\MauiApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Runtime.CompilerServices.Unsafe.dll'.
'MauiApp3.exe' (CoreCLR: clrhost): Loaded 'C:\Users\iliab\source\repos\MauiApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Private.Uri.dll'.
'MauiApp3.exe' (CoreCLR: clrhost): Loaded 'C:\Users\iliab\source\repos\MauiApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.ObjectModel.dll'.
'MauiApp3.exe' (CoreCLR: clrhost): Loaded 'C:\Users\iliab\source\repos\MauiApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.ComponentModel.dll'.
'MauiApp3.exe' (CoreCLR: clrhost): Loaded 'C:\Users\iliab\source\repos\MauiApp3\bin\Debug\net7.0-windows10.0.19041.0\win10-x64\AppX\System.Numerics.Vectors.dll'.
The program '[34632] MauiApp3.exe' has exited with code 2147942405 (0x80070005).

@Dokug
Copy link

Dokug commented Dec 17, 2022

I think I have the same issue.
To reproduce just create a new MAUI app and try running it on net7.0-windows

Trying to run it on windows closes the app before it shows and the output says
"The program '[5868] MauiApp02.exe' has exited with code 2147942405 (0x80070005)."

Running as MacCatalyst works however.

This happens with the brand new template, as well as an app that has worked all the way since RC1.

  • Cleaning the solution does not work
  • Building through the CLI does not work

SDK info:
.NET 7.0.101
MAUI 7.0.52

@Dokug
Copy link

Dokug commented Dec 17, 2022

When using the CLI to build with the verbosity flag set to "diagnostic" the process seems to fail with the following stacktrace:

                Task "Exec" (TaskId:2)
                 Task Parameter:Command=C:\Users\[...]\source\repos\[...]\Solution\MauiApp02\bin\Debug\ne
                 t7.0-windows10.0.19041.0\win10-x64\MauiApp02.exe  (TaskId:2)
                 C:\Users\[...]\source\repos\[...]\Solution\MauiApp02\bin\Debug\net7.0-windows10.0.19041.
                 0\win10-x64\MauiApp02.exe  (TaskId:2)
                 Unhandled exception. System.TypeInitializationException: The type initializer for '<Module>' threw
                  an exception. (TaskId:2)
                  ---> System.TypeInitializationException: The type initializer for 'WinRT.ActivationFactory`1' threw an exception. (TaskId:2)
                  ---> System.Runtime.InteropServices.COMException (0x80040154): Class not registered (0x80040154 (
                 REGDB_E_CLASSNOTREG)) (TaskId:2)
                    at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode) (TaskId:2)
                    at WinRT.BaseActivationFactory..ctor(String typeNamespace, String typeFullName) (TaskId:2)
                    at WinRT.ActivationFactory`1..ctor() (TaskId:2)
                    at WinRT.ActivationFactory`1..cctor() (TaskId:2)
                    --- End of inner exception stack trace --- (TaskId:2)
                    at WinRT.ActivationFactory`1.ActivateInstance[I]() (TaskId:2)
                    at Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentInitializeOptions..ctor() (TaskId:2)
                    at Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentManagerCS.AutoInitialize.get_
                 Options() in C:\Users\mathi\.nuget\packages\microsoft.windowsappsdk\1.2.221109.1\include\Deploymen
                 tManagerAutoInitializer.cs:line 44 (TaskId:2)
                    at Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentManagerCS.AutoInitialize.Acce
                 ssWindowsAppSDK() in C:\Users\mathi\.nuget\packages\microsoft.windowsappsdk\1.2.221109.1\include\D
                 eploymentManagerAutoInitializer.cs:line 30 (TaskId:2)
                    at .cctor() (TaskId:2)
                    --- End of inner exception stack trace --- (TaskId:2)

@holecekp
Copy link

This is probably a duplicate of #12080

Try this workaround which worked for me: #12080 (comment)
I hope it will be fixed soon because it is a really bad issue.

@jsuarezruiz jsuarezruiz added t/bug Something isn't working platform/windows 🪟 labels Dec 19, 2022
@nk54
Copy link

nk54 commented Dec 19, 2022

Same here... Cannot deploy on windows even in debug since VS 17.4.3 even a blank new project with hello world : it doesn't start.

Since VS 17.4.3, I can't even deploy an Android release because it says it cannot optimize build

@mattleibow
Copy link
Member

Duplicate of #12080

@mattleibow mattleibow marked this as a duplicate of #12080 Jan 11, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Feb 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants