'How to fix Win UI C# application has exited with code -1073740791 (0xc0000409)

I have two issues, I am trying to do the WIN UI tutorial (https://docs.microsoft.com/en-us/windows/apps/winui/winui3/create-your-first-winui3-app) for creating my first WINUI 3 application. I follow all of the steps but get the error "application has exited with code -1073740791 (0xc0000409)." I have added the WindowPackageType as none to the csproj file and still I get nothing.

 The other issue I am having is  that the SDK is showing yellow triangles, how to go about correcting that?

SDK showing yellow triangle

Any help would be greatly appreciated.

Thank you,

Bill O.



Solution 1:[1]

  1. Select x64 build configuration
  2. Add these properties to your project
      <PropertyGroup>
       <WindowsSdkPackageVersion>10.0.19041.18</WindowsSdkPackageVersion>
        <WindowsPackageType>None</WindowsPackageType>
        <PlatformTarget>x64</PlatformTarget>
        <GeneratePackageOnBuild>False</GeneratePackageOnBuild>
      </PropertyGroup>
  1. Make sure your VS isn't started elevated.

  2. Upgrade to Windows App SDK 1.1 pre2.

  3. Optional you can add these properties as well for troubleshooting purposes

  <PropertyGroup>
    <WindowsAppSDKBootstrapAutoInitializeOptions_Default>true</WindowsAppSDKBootstrapAutoInitializeOptions_Default>
    <WindowsAppSDKBootstrapAutoInitializeOptions_OnNoMatch_ShowUI>true</WindowsAppSDKBootstrapAutoInitializeOptions_OnNoMatch_ShowUI>
    <WindowsAppSDKBootstrapAutoInitializeOptions_OnError_DebugBreak>true</WindowsAppSDKBootstrapAutoInitializeOptions_OnError_DebugBreak>
    <WindowsAppSDKBootstrapAutoInitializeOptions_OnError_DebugBreak_IfDebuggerAttached>true</WindowsAppSDKBootstrapAutoInitializeOptions_OnError_DebugBreak_IfDebuggerAttached>
  </PropertyGroup>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tommy