CommunityToolkit / MVVM-Samples

Sample repo for MVVM package
Other
1.11k stars 222 forks source link

Cannot Start Maui Tutorial on Windows #130

Open markgr opened 8 months ago

markgr commented 8 months ago

Ok so this is really weird

So Env: - Visual Studio 17.8.3 Dotnet SDKS: 8.0.100 All workloads up to date

I download the whole Git repo - I then open the DotNet MAUI tutorial project maui-samples\8.0\Tutorials\CreateNetMauiApp - Step 1

Build for windows - I get the following exception

image

If I try it from a command line

Unhandled exception. System.TypeInitializationException: The type initializer for '<Module>' threw an exception.
 ---> System.TypeInitializationException: The type initializer for 'WinRT.ActivationFactory`1' threw an exception.
 ---> System.Runtime.InteropServices.COMException (0x80040154): Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
   at WinRT.BaseActivationFactory..ctor(String typeNamespace, String typeFullName)
   at WinRT.ActivationFactory`1..ctor()
   at WinRT.ActivationFactory`1..cctor()
   --- End of inner exception stack trace ---
   at WinRT.ActivationFactory`1.ActivateInstance[I]()
   at Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentInitializeOptions..ctor()
   at Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentManagerCS.AutoInitialize.get_Options() in C:\Users\saa\.nuget\packages\microsoft.windowsappsdk\1.3.230724000\include\DeploymentManagerAutoInitializer.cs:line 44
   at Microsoft.Windows.ApplicationModel.WindowsAppRuntime.DeploymentManagerCS.AutoInitialize.AccessWindowsAppSDK() in C:\Users\saa\.nuget\packages\microsoft.windowsappsdk\1.3.230724000\include\DeploymentManagerAutoInitializer.cs:line 30
   at .cctor()
   --- End of inner exception stack trace ---

However - if I create a brand new MAUI project in VS and attempt to run it on Windows - it works just fine.....

Any ideas of what to look for?

markgr commented 8 months ago

I should note that it all works on Android on my machine

I'm quite willing to accept that it's my machine somehow - but nothing obvious in Event Viewer etc - the one thing that I might have done was install DotNet 8.0 outside of VS - but even if I do the whole build through the Terminal only I still get the same result....

markgr commented 8 months ago

If I try from command line

PS C:\temp\maui\maui-samples\8.0\Tutorials\CreateNetMauiApp\step1> dotnet run -f:net8.0-windows10.0.19041.0
The launch profile "(Default)" could not be applied.
A usable launch profile could not be located.
Unhandled exception: System.ComponentModel.Win32Exception (31): An error occurred trying to start process 'C:\temp\maui\maui-samples\8.0\Tutorials\CreateNetMauiApp\step1\bin\Debug\net8.0-windows10.0.19041.0\win10-x64\Notes.exe' with working directory 'C:\temp\maui\maui-samples\8.0\Tutorials\CreateNetMauiApp\step1'. A device attached to the system is not functioning.
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at Microsoft.DotNet.Cli.Utils.Command.Execute(Action`1 processStarted)
   at Microsoft.DotNet.Tools.Run.RunCommand.Execute()
   at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)