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

Debug Unpackaged Winui3 template project gets COMException Class not registered #10147

Closed
ToolmakerSteve opened this issue Nov 9, 2024 · 1 comment
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners

Comments

@ToolmakerSteve
Copy link

ToolmakerSteve commented Nov 9, 2024

Describe the bug

The template "Blank App, Packaged (WinUI 3 in Desktop)" should include needed references so that "Debug | AppName (Unpackaged)" can be run and debugged.

Failing that, Getting Started documentation should describe what references are needed, and how to add them explicitly to the project.

Failing that, I need to know how to discover what references are missing, so I can add them manually to bin folder.

Why I care:
Porting a large legacy .Net Framework project to Windows App SDK.
For developer productivity, it is essential that the project be debuggable without performing packaging.
Making and testing changes has always been very quick; any step that slows this down is a significant development cost.

I have no idea how to find and fix whatever is missing.

Steps to reproduce the bug

  1. New Project from template "Blank App, Packaged (WinUI 3 in Desktop)".

  2. Deploy Debug | x64 | AppName (Package)
    => success: "WinUI Desktop" window with button "Click Me" that works.

  3. Deploy Debug | x64 | AppName (Unpackaged)

RESULT:

System.Runtime.InteropServices.COMException
  HResult=0x80040154
  Message=Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))
  Source=System.Private.CoreLib
  StackTrace:
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode) in /_/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs:line 849
   at WinRT.ActivationFactory.Get(String typeName, Guid iid)
   at Microsoft.UI.Xaml.Application.get__objRef_global__Microsoft_UI_Xaml_IApplicationStatics()
   at Microsoft.UI.Xaml.Application.Start(ApplicationInitializationCallback callback)
   at WinUI3_20241109.Program.Main(String[] args) in C:\Users\toolm\source\repos\WinUI3_20241109\obj\x64\Debug\net8.0-windows10.0.19041.0\win-x64\App.g.i.cs:line 26

Line that fails:

global::Microsoft.UI.Xaml.Application.Start((p) => {
    var context = new global::Microsoft.UI.Dispatching.DispatcherQueueSynchronizationContext(global::Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread());
    global::System.Threading.SynchronizationContext.SetSynchronizationContext(context);
    new App();
});

NOTE: I did not find any way to see what class is "not registered".

Expected behavior

App launches, exactly the same as "AppName (Package)" does.

Screenshots

No response

NuGet package version

None

Windows version

Windows 11 (22H2): Build 22621

Additional context

VS Community 2022, 17.11.5

@ToolmakerSteve ToolmakerSteve added the bug Something isn't working label Nov 9, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Nov 9, 2024
@ToolmakerSteve
Copy link
Author

I was not following the correct documentation.

The doc I needed to follow is:
Create your first WinUI 3 (Windows App SDK) project / Unpackaged.

I was missing this step:

Add the following property to your project file ...

<WindowsPackageType>None</WindowsPackageType>

@microsoft-github-policy-service microsoft-github-policy-service bot added needs-triage Issue needs to be triaged by the area owners and removed needs-triage Issue needs to be triaged by the area owners labels Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners
Projects
None yet
Development

No branches or pull requests

1 participant