-
Notifications
You must be signed in to change notification settings - Fork 669
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
WinUI 3 - Blank App, Packaged (WinUI 3 in Desktop) C# project template crashes in Release configuration #9675
Comments
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:
|
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. |
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.: public static partial class Program
{
[LibraryImport("Microsoft.ui.xaml.dll")]
private static partial void XamlCheckProcessRequirements();
[STAThread]
public static void Main(string[] args)
{
XamlCheckProcessRequirements();
WinRT.ComWrappersSupport.InitializeComWrappers();
Application.Start(_ =>
{
try
{
var context = new DispatcherQueueSynchronizationContext(DispatcherQueue.GetForCurrentThread());
SynchronizationContext.SetSynchronizationContext(context);
var app = new App();
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
}
});
}
} You get the following:
|
Thanks for the report! For now you can workaround this by editing the .pubxml files so that the |
I also tried several options and builds. The strange thing that unpackaged app in release mode works fine. |
Do you mean the pubxml files?
LaunchSettings:
|
Apologies, yes, I meant the pubxml. I've updated my original comment. :) |
@evelynwu-msft thank you, I confirmed that the workaround is working. |
I don't know what I'm doing differently.
On my development machine i'm running the following commands and copy the output to Windows Sandbox and install the msix. Fails
Fails (trick that i use with .Net Maui build for Windows, regular win-x64 doesn't work there either)
Succeeds (Sort of. It's runnable)
This is the unpackaged version, but i cannot use it for store submission. |
Btw also the MSbuild commands doesn't work.
|
@IsmailHassani https://drive.google.com/file/d/1XTKQTb6-pbjYkf6yX8FKS00ZpTwgy1ze/view?usp=sharing you can try the steps. |
Another strategy, if full trimming is desired, is to update to Windows App SDK 1.6 (currently in experimental release) and also include a C#/WinRT package reference. Windows App SDK 1.6 C# projection assemblies now have support for trimming, and the latest C#/WinRT provides source generation to also support trimming. |
Closing with several options to resolve |
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:
The exceptions:
And in Event Viewer there is a crash event:
Steps to reproduce the bug
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
The text was updated successfully, but these errors were encountered: