microsoft / microsoft-ui-xaml

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

WinUI3 unmodified template crashes in release config: Unhandled exception at 0x00007FFBA70552F5 (Microsoft.ui.xaml.dll): 0xC000027B: An application-internal exception has occurred (parameters: 0x000001D814FC4330, 0x0000000000000002). #9793

Closed jcoliz closed 2 months ago

jcoliz commented 3 months ago

Describe the bug

Creating a brand new solution with the "Blank App, Packaged (WinUI3 in Desktop)" (C#) fails to launch when built in release config.

I made a repro repo here: https://github.com/jcoliz/WinUI3.Hello.

Steps to reproduce the bug

  1. In Visual Studio, create a new solution using template "Blank App, Packaged (WinUI3 in Desktop)" (C#)
  2. Start with Debugging (F5) on Debug X64 config (Packaged). All is well
  3. Enabled mixed mode debugging
  4. Start with Debugging (F5) on Release X64 config (Packaged)

Result: Unhandled exception at 0x00007FFBA70552F5 (Microsoft.ui.xaml.dll) in WinUI3.Hello.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x000001D814FC4330, 0x0000000000000002).

Debug output: Exception thrown at 0x00007FFBF082F39C (KernelBase.dll) in WinUI3.Hello.exe: WinRT originate error - 0x802B000A: 'The text associated with this error code could not be found.'.

Call stack

[External Code]
hostpolicy.dll!00007ffd9dca2784()
hostpolicy.dll!00007ffd9dca3ef0()
hostfxr.dll!00007ffd9ef11d5c()
hostfxr.dll!00007ffd9ef110a8()
hostfxr.dll!00007ffd9ef09ae0()
WinUI3.Hello.exe!00007ff69e9deff8()
WinUI3.Hello.exe!00007ff69e9e0cc0()
WinUI3.Hello.exe!00007ff69e9e0d64()
kernel32.dll!00007ffe2c162310()
ntdll.dll!00007ffe2d7d5b2c()

Just for fun, I repro'd this on an Arm64 device. Same result. Interesting that the call stack is deeper.

Unhandled exception at 0x00007FFDC46DA1E8 (Microsoft.ui.xaml.dll) in WinUI3.Hello.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x000001B997A89860, 0x0000000000000002). Exception thrown at 0x00007FFE2929CFA4 (KernelBase.dll) in WinUI3.Hello.exe: WinRT originate error - 0x802B000A : 'The text associated with this error code could not be found.'.

Call stack

KernelBase.dll!00007ffbf0930c02()
combase.dll!00007ffbf27cce09()
Microsoft.ui.xaml.dll!00007ffba70552f5()
Microsoft.ui.xaml.dll!00007ffba747085a()
Microsoft.ui.xaml.dll!00007ffba747014e()
twinapi.appcore.dll!00007ffbe69b0da4()
twinapi.appcore.dll!00007ffbe69b0e04()
twinapi.appcore.dll!00007ffbe699b97a()
twinapi.appcore.dll!00007ffbe699b081()
twinapi.appcore.dll!00007ffbe699b829()
twinapi.appcore.dll!00007ffbe69aa26d()
twinapi.appcore.dll!00007ffbe69cab91()
combase.dll!00007ffbf27cb85d()
Microsoft.ui.xaml.dll!00007ffba7470abf()
Microsoft.ui.xaml.dll!00007ffba6fcde01()
Microsoft.ui.xaml.dll!00007ffba6db23b5()
Microsoft.ui.xaml.dll!00007ffba6db2337()
Microsoft.ui.xaml.dll!00007ffba6ec3a97()
Microsoft.ui.xaml.dll!00007ffba6db7881()
Microsoft.ui.xaml.dll!00007ffba6cea3c3()
Microsoft.ui.xaml.dll!00007ffba6ed6514()
Microsoft.ui.xaml.dll!00007ffba6ed2178()
Microsoft.ui.xaml.dll!00007ffba6ed20bd()
Microsoft.ui.xaml.dll!00007ffba6ed2023()
Microsoft.ui.xaml.dll!00007ffba6e8d11c()
Microsoft.ui.xaml.dll!00007ffba6db2250()
[External Code]
hostpolicy.dll!00007ffb3ef82b76()
hostpolicy.dll!00007ffb3ef82e5c()
hostpolicy.dll!00007ffb3ef8379a()
hostfxr.dll!00007ffb3f59b5c9()
hostfxr.dll!00007ffb3f59e066()
hostfxr.dll!00007ffb3f5a02ec()
hostfxr.dll!00007ffb3f59e644()
hostfxr.dll!00007ffb3f5985a0()
WinUI3.Hello.exe!00007ff6d11bf998()
WinUI3.Hello.exe!00007ff6d11bfda6()
WinUI3.Hello.exe!00007ff6d11c12e8()
kernel32.dll!00007ffbf23c257d()
ntdll.dll!00007ffbf322af28()

Expected behavior

App build in release config should behave just like app build in debug config. Shouldn't crash on launch.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.5.4: 1.5.240607001

Windows version

Windows 11 (22H2): Build 22621

Additional context

github-actions[bot] commented 3 months 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!

Open similar issues:

Closed similar issues:

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

jcoliz commented 3 months ago

Ok, props to @github-actions bot who found the duplicate bug that I couldn't.

--- a/WinUI3.Hello/Properties/PublishProfiles/win-x64.pubxml
+++ b/WinUI3.Hello/Properties/PublishProfiles/win-x64.pubxml
@@ -14,6 +14,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
     <PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
     <PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
     <PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
-    <PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
+    <PublishTrimmed Condition="'$(Configuration)' != 'Debug'">False</PublishTrimmed>
   </PropertyGroup>
 </Project>
MartyIX commented 2 months ago

Helped me as well.

codendone commented 2 months ago

Closing as duplicate of #9675.