microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.36k stars 678 forks source link

Published unpackaged app in Single File does not execute #10173

Open UltraWelfare opened 2 hours ago

UltraWelfare commented 2 hours ago

Describe the bug

Publishing an unpackaged application with it being a Single File makes the executable not being able to launch... Publishing it without it being Single File works correctly and it launches fine. Trimming and ReadyToRun have no change on whether the single file works or not.

Steps to reproduce the bug

  1. Create new project

  2. Open .csproj file and add:

    <WindowsPackageType>None</WindowsPackageType>
    <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
  3. Make a new profile (debug / release doesn't matter) Target framework: net8.0-windows10.0.19041.0 Deployment mode: self-contained Target runtime: win-x64 File publish options: Check Produce single file, the rest don't matter

  4. Publish (it will build correctly) but opening the executable does not work.

Expected behavior

The executable to launch correctly.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.2: 1.6.241106002

Windows version

No response

Additional context

Windows version is: 23H2 (for some reason it wasn't an option in the select dropdown) VS2022 version: 17.12.0 dotnet sdk: 8.0.404

Project is attached: project.zip (edit: had to reupload the project.zip because it didn't include the publish profile)

github-actions[bot] commented 2 hours ago

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. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

UltraWelfare commented 2 hours ago

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. Thank you!

Closed similar issues:

* [Using Win2D breaks publishing unpackaged app as single file (#6400)](https://github.com/microsoft/microsoft-ui-xaml/issues/6400),  similarity score: 0.81

* [Publishing an unpackaged winUI 3 project yields an exe that causes an error on run (#6735)](https://github.com/microsoft/microsoft-ui-xaml/issues/6735),  similarity score: 0.81

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

I've just taken a look at the second issue here. The difference is I get no error on launching the executable. It shows the "loading spinner" in the mouse, and then just disappears without ever launching. Launching the exe from the terminal (PS / cmd) shows no output as well

UltraWelfare commented 2 hours ago

I've tried debugging the executable, separate from the project. Image I'm not sure what to do with this information, but I tried digging in more deeply but it seems like there's something going outside the application code: Image

Although I can't go on further because I don't have some pdbs for System.Private.CoreLib.ni.pdb

Update: Image

Seems like the inner exception is coming from NameHandle::GetTypeToken(void) but I can't find any other information about it

Update 2: Image This is what I got from the Event Viewer