microsoft-ui-xaml: WinUI 3 - Blank App, Packaged (WinUI 3 in Desktop) C# project template crashes in Release configuration
Describe the bug
The app created by Blank App, Packaged (WinUI 3 in Desktop) C# project template crashes in Release configuration with exception on App.g.i.cs Line 32:
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();
});
The exceptions:
Unhandled exception at 0x00007FFB31F75175 (Microsoft.ui.xaml.dll) in App1.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x000001B067EF58C0, 0x0000000000000002).
Unhandled exception at 0x00007FFB994F4470 (combase.dll) in App1.exe: 0xC0000602: A fail fast exception occurred. Exception handlers will not be invoked and the process will be terminated immediately.
Unhandled exception at 0x00007FFB31F75175 (Microsoft.ui.xaml.dll) in App1.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x000001B0031031D0, 0x0000000000000002).
Unhandled exception at 0x00007FFB994F4470 (combase.dll) in App1.exe: 0xC0000602: A fail fast exception occurred. Exception handlers will not be invoked and the process will be terminated immediately.
And in Event Viewer there is a crash event:
Faulting application name: App1.exe, version: 1.0.0.0, time stamp: 0x65f90000
Faulting module name: Microsoft.ui.xaml.dll, version: 3.1.5.0, time stamp: 0x5c2afe3b
Exception code: 0xc000027b
Fault offset: 0x0000000000405175
Faulting process id: 0x20278
Faulting application start time: 0x1DAAF3D091E67FA
Faulting application path: E:\Shirasagi\CSharp\App1\App1\bin\x64\Release\net8.0-windows10.0.19041.0\win-x64\AppX\App1.exe
Faulting module path: C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.5_5001.119.156.0_x64__8wekyb3d8bbwe\Microsoft.ui.xaml.dll
Report Id: 945b6cf3-6710-47f2-aa22-e8377a178e2e
Faulting package full name: b064c45c-ec11-40e2-b3f2-7d0ca5daf8e5_1.0.0.0_x64__kkjvz6qjy8mej
Faulting package-relative application ID: App
Steps to reproduce the bug
- Create a new project using the “Blank App, Packaged (WinUI 3 in Desktop)” C# project template. Both Visual Studio 17.10 and 17.11 Preview 1 are able to reproduce the bug.
- Switch the Solution Configuration to “Release”.
- In the debug properties, check the “Enable native code debugging” option so we can see the exception.
- Run “App1(Packaged)” with debuging, and the app crashes.
- If you switch the configuration back to Debug, the app runs fine.
Expected behavior
The app should run out-of-the-box in both Release and Debug configurations.
Screenshots
NuGet package version
WinUI 3 - Windows App SDK 1.5.3: 1.5.240428000
Windows version
Windows Insider Build (xxxxx)
Additional context
OS build 26120.670 Windows App SDK 1.5.240428000 Microsoft.Windows.SDK.BuildTools 10.0.22621.756
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 15 (5 by maintainers)
I get the same issue. A few of the similar issues linked above seem like they match this, but none of them have a solution.
Not working for me still by adding the following and several other variations:
I have the same issue.
Windows Version: 23H2 22631.3593
Microsoft Visual Studio Community 2022 (64-bit) Version 17.10.1
If you disable Xaml generated main and replace with your own, i.e.:
You get the following: