WinUI 3 App Runs on Development Machine, Crashes Elsewhere

Mark Olbert 1 Reputation point
2022-04-05T20:31:07.52+00:00

I have a WinUI3/Windows App executable which runs fine on my development machine. After it's signed it can be installed on the development machine and it also runs fine. So, basically, no problems encountered.

However, when the signed MSIX file is used to install the app on either a Windows 11 or a Windows 10 machine that doesn't have Visual Studio installed it crashes on startup. In fact, it crashes silently.

I ran the app under WinDbg (preview edition) on both the development machine and the Windows 10 machine. I'm not an expert on WinDbg (nor on having to debug apps that pass muster within Visual Studio but fall silently on test machines; I don't understand how that can even happen). But from looking at the WinDbg output it seems like the fatal exception involves a failure to load System.Text.Encodings.Web:

from the development machine (where it works):

ModLoad: 00007ffe`19e70000 00007ffe`19f16000   C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.0_1.440.209.0_x64__8wekyb3d8bbwe\Microsoft.DirectManipulation.dll
onecoreuap\windows\frameworkudk\dxprivatescommon.cpp(53)\Microsoft.Internal.FrameworkUdk.System.dll!00007FFE397D4989: (caller: 00007FFE24C1966D) ReturnHr(1) tid(cc20) 80004002 No such interface supported
onecoreuap\windows\frameworkudk\dxprivatescommon.cpp(53)\Microsoft.Internal.FrameworkUdk.System.dll!00007FFE397D4989: (caller: 00007FFE24C1966D) ReturnHr(2) tid(cc20) 80004002 No such interface supported
ModLoad: 00000220`3e7f0000 00000220`3e7f8000   C:\Program Files\WindowsApps\24075JumpForJoySoftware.49446A8871E87_1.0.0.0_x64__4ene0yq67pf8g\System.Threading.Thread.dll
ModLoad: 00007fff`1b650000 00007fff`1b7fe000   C:\Windows\system32\windowscodecs.dll
ModLoad: 00007ffe`eda30000 00007ffe`edaae000   C:\Windows\SYSTEM32\PhotoMetadataHandler.dll
ModLoad: 00007fff`20b00000 00007fff`20bf7000   C:\Windows\SYSTEM32\PROPSYS.dll
ModLoad: 00000220`3eba0000 00000220`3ebb4000   C:\Program Files\WindowsApps\24075JumpForJoySoftware.49446A8871E87_1.0.0.0_x64__4ene0yq67pf8g\Microsoft.AspNetCore.WebUtilities.dll
ModLoad: 00007ffe`7f0c0000 00007ffe`7f0e0000   C:\Program Files\WindowsApps\24075JumpForJoySoftware.49446A8871E87_1.0.0.0_x64__4ene0yq67pf8g\System.Text.Encodings.Web.dll
ModLoad: 00000220`3ebc0000 00000220`3ebc8000   C:\Program Files\WindowsApps\24075JumpForJoySoftware.49446A8871E87_1.0.0.0_x64__4ene0yq67pf8g\System.Xml.XDocument.dll
ModLoad: 00007ffe`19e00000 00007ffe`19e63000   C:\Program Files\WindowsApps\24075JumpForJoySoftware.49446A8871E87_1.0.0.0_x64__4ene0yq67pf8g\System.Private.Xml.Linq.dll
ModLoad: 00007ffe`195e0000 00007ffe`19dfc000   C:\Program Files\WindowsApps\24075JumpForJoySoftware.49446A8871E87_1.0.0.0_x64__4ene0yq67pf8g\System.Private.Xml.dll
ModLoad: 00007ffe`19530000 00007ffe`195de000   C:\Windows\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_44dc4eefedc0d082\NvCamera\NvCameraAllowlisting64.dll
ModLoad: 00007ffe`19530000 00007ffe`195de000   C:\Windows\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_44dc4eefedc0d082\NvCamera\NvCameraAllowlisting64.dll
ModLoad: 00007ffe`ec8d0000 00007ffe`ec8e5000   C:\Windows\System32\threadpoolwinrt.dll

from the test machine (where it fails):

ModLoad: 00007ffa`7bce0000 00007ffa`7bd86000   C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.0_1.440.209.0_x64__8wekyb3d8bbwe\Microsoft.DirectManipulation.dll
onecoreuap\windows\frameworkudk\dxprivatescommon.cpp(53)\Microsoft.Internal.FrameworkUdk.dll!00007FFA9C9898A5: (caller: 00007FFA9C9C966D) ReturnHr(1) tid(14f8) 80004002 No such interface supported
onecoreuap\windows\frameworkudk\dxprivatescommon.cpp(53)\Microsoft.Internal.FrameworkUdk.dll!00007FFA9C9898A5: (caller: 00007FFA9C9C966D) ReturnHr(2) tid(14f8) 80004002 No such interface supported
ModLoad: 000001fd`b7340000 000001fd`b7348000   C:\Program Files\WindowsApps\24075JumpForJoySoftware.49446A8871E87_1.0.0.0_x64__4ene0yq67pf8g\System.Threading.Thread.dll
ModLoad: 00007ffa`d4ca0000 00007ffa`d4e54000   C:\WINDOWS\system32\windowscodecs.dll
ModLoad: 00007ffa`cd1b0000 00007ffa`cd231000   C:\WINDOWS\SYSTEM32\PhotoMetadataHandler.dll
ModLoad: 000001fd`b7370000 000001fd`b7384000   C:\Program Files\WindowsApps\24075JumpForJoySoftware.49446A8871E87_1.0.0.0_x64__4ene0yq67pf8g\Microsoft.AspNetCore.WebUtilities.dll
ModLoad: 00007ffa`7bb70000 00007ffa`7bcda000   C:\Program Files\WindowsApps\24075JumpForJoySoftware.49446A8871E87_1.0.0.0_x64__4ene0yq67pf8g\System.Text.Json.dll
ModLoad: 00007ffa`bc190000 00007ffa`bc1b0000   C:\Program Files\WindowsApps\24075JumpForJoySoftware.49446A8871E87_1.0.0.0_x64__4ene0yq67pf8g\System.Text.Encodings.Web.dll
onecoreuap\windows\frameworkudk\dxprivatescommon.cpp(53)\Microsoft.Internal.FrameworkUdk.dll!00007FFA9C9898A5: (caller: 00007FFA9C9C966D) ReturnHr(3) tid(29b8) 80004002 No such interface supported
(1b68.ab8): CLR exception - code e0434352 (first chance)
(1b68.14f8): CLR exception - code e0434352 (first chance)
(1b68.ab8): CLR exception - code e0434352 (first chance)
(1b68.ab8): CLR exception - code e0434352 (first chance)
ModLoad: 00007ffa`c5260000 00007ffa`c5289000   C:\WINDOWS\SYSTEM32\Cabinet.dll
(1b68.ab8): CLR exception - code e0434352 (first chance)
(1b68.ab8): CLR exception - code e0434352 (first chance)
(1b68.14f8): Windows Runtime Originate Error - code 40080201 (first chance)
onecore\com\combase\winrt\error\restrictederror.cpp(1016)\combase.dll!00007FFAD924BEE3: (caller: 00007FFAD9255BC9) ReturnHr(1) tid(14f8) 8007007E The specified module could not be found.
onecore\com\combase\winrt\error\restrictederror.cpp(1016)\combase.dll!00007FFAD924BEE3: (caller: 00007FFAD93CCC47) ReturnHr(2) tid(14f8) 8007007E The specified module could not be found.
onecore\com\combase\winrt\error\restrictederror.cpp(1016)\combase.dll!00007FFAD924BEE3: (caller: 00007FFAD93CC6B3) ReturnHr(3) tid(14f8) 8007007E The specified module could not be found.

Assuming this is the problem, how do I get VS to include the necessary file in the installer package it creates? The only change I made to the package configuration was to turn off auto incrementing. Everything else is, so far as I can remember, a default. The package is built to support x86, x64 and ARM64 architectures and then signed with my code-signing certificate (manually, because for some reason VS rejects my certificate -- without explanation -- but signing with signtool.exe works fine).

Thoughts?

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
728 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Xiaopo Yang - MSFT 11,501 Reputation points Microsoft Vendor
    2022-04-07T02:06:26.783+00:00

    The framework-dependent deployment app depends on the Windows App SDK runtime and/or Framework package being present on the target machine. As for as I'm concerned, I encountered an error when installing the package in a blank system.
    190754-image.png
    But error is gone after installing the WindowsAppSDK residing in PackageDirectory\Dependencies\x64\Microsoft.WindowsAppSDK.1.0-experimental1
    Again, by @Castorix31 indicated, Perhaps you need the self-contained deployment where your app carries the Windows App SDK dependencies with it.

    0 comments No comments

  2. Mark Olbert 1 Reputation point
    2022-04-07T22:44:33.917+00:00

    Hi XiaopoYang,

    Leaving aside that there's no documented way of creating an MSIX which contains the necessary WindowsApp runtimes (at least, I couldn't find one despite reading a lot of web pages), installing the WindowsApp runtimes manually on the test machine (Windows 10) did not solve the problem. App still crashes, silently.

    Of course, running it under WinDbg (Preview) now shows an unrecoverable exception about a problem occurring when loading hostxfr.dll. The error message helpfully suggests that installing the right NET runtime might help.

    So just to confirm, I re-installed the Net6 (x64), Net5 (x64) and Net3.1 (x64) runtimes. As well as the Net6 (x86) runtime. None of which helped. Same problem.

    I have a sneaking suspicion that Microsoft doesn't actually test any of this junk before they ship it (as in, assigning v1.0 status to it). I guess I shouldn't be surprised. Ballmer once admitted that anything below version 3 from Microsoft is basically barely functional, and riddled with bugs.

    Too bad. WinUI3 looks kind of cool. Maybe by 2025 it will actually deliver.