Failing module Microsoft.ui.xaml.dll

See original GitHub issue

Description

When running an app deployed with msix, the app crashes (see log output).

I tried many combinations of project properties, here is the current one:

  <!--WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained-->
  <!--WinUISDKReferences>false</WinUISDKReferences-->
  <!--SelfContained>true</SelfContained-->

  <GenerateAppxPackageOnBuild>true</GenerateAppxPackageOnBuild>

I also tried to add package dependencies in appxmanifest, here is the current one:

  <Dependencies>
    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
	<PackageDependency Name="Microsoft.WindowsAppRuntime.1.1" MinVersion="1004.584.2120.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
	<PackageDependency Name="Microsoft.VCLibs.140.00.UWPDesktop" MinVersion="14.0.30035.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"/>
	<PackageDependency Name="Microsoft.UI.Xaml.2.7" MinVersion="7.2208.15002.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"/>
  </Dependencies>

I see that only Microsoft.WindowsAppRuntime.1.1.msix is copied in AppPackage/MyApp/Dependencies. I don’t know if it’s normal.

The app was deployed with the following command:

dotnet publish -c Release -f net6.0-windows10.0.19041.0 -p:Platform=x64

I don’t reproduce with the simple MAUI template project, so I suppose it comes from my package references:

	<ItemGroup>
		<PackageReference Include="Humanizer.Core.fr" Version="2.14.1" />
		<PackageReference Include="Plugin.LocalNotification" Version="10.0.1" />
		<PackageReference Include="System.Text.Json" Version="6.0.5" />
	  <PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
		<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
		<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
		<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
	
		<PackageReference Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'" Include="Microsoft.WindowsAppSDK" Version="1.1.4">
			<!--IncludeAssets>build</IncludeAssets-->
		</PackageReference>
	</ItemGroup>

Steps to Reproduce

  1. Publish the MAUI app

dotnet publish -c Release -f net6.0-windows10.0.19041.0 -p:Platform=x64

  1. Intall from msix or Install.ps1
  2. Run it from start menu
  3. The app crashes (from event log)

Link to public reproduction project repository

https://github.com/sinsedrix/NoRepo

Version with bug

6.0.486 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 11 Pro, Windows 10 Enterprise

Did you find any workaround?

No

Relevant log output

Event log:

Nom de l’application défaillante MyApp.Maui.exe, version : 4.2.0.0, horodatage : 0x62cf0990
Nom du module défaillant : Microsoft.ui.xaml.dll, version : 3.0.0.2208, horodatage : 0x8d698c4e
Code d’exception : 0xc000027b
Décalage d’erreur : 0x000000000033eda6
ID du processus défaillant : 0x3a18
Heure de début de l’application défaillante : 0x01d8bdd3d8b82617
Chemin d’accès de l’application défaillante : C:\Program Files\WindowsApps\fr.myapp_4.2.0.0_x64__132r1tgtcmz60\MyApp.Maui.exe
Chemin d’accès du module défaillant: C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1004.584.2120.0_x64__8wekyb3d8bbwe\Microsoft.ui.xaml.dll
ID de rapport : c23cf8e7-e17a-4af6-adb9-0ea7714d1b17
Nom complet du package défaillant : fr.myapp_4.2.0.0_x64__132r1tgtcmz60
ID de l’application relative au package défaillant : App


WinDbg stack:

[0x0]   KERNELBASE!RaiseFailFastException + 0x152   
[0x1]   combase!RoFailFastWithErrorContextInternal2 + 0x4d9   
[0x2]   Microsoft_ui_xaml!DirectUI::FrameworkApplication::StartDesktop + 0x17c3ba   
[0x3]   Microsoft_ui_xaml!DirectUI::FrameworkApplicationFactory::Start + 0x63   
[0x4]   0x7ffd69a93a4d   
[0x5]   Microsoft_WinUI!ABI.Microsoft.UI.Xaml.IApplicationStaticsMethods.Start + 0x102   
[0x6]   Microsoft_WinUI!Microsoft.UI.Xaml.Application.Start + 0x2a   
[0x7]   MyApp_Maui!MyApp.Maui.WinUI.Program.Main + 0x179   
[0x8]   coreclr!CallDescrWorkerInternal + 0x83   
[0x9]   coreclr!MethodDescCallSite::CallTargetWorker + 0x176   
[0xa]   coreclr!MethodDescCallSite::Call + 0xb   
[0xb]   coreclr!RunMainInternal + 0x11f   
[0xc]   coreclr!RunMain + 0xd2   
[0xd]   coreclr!Assembly::ExecuteMainMethod + 0x1c9   
[0xe]   coreclr!CorHost2::ExecuteAssembly + 0x1c6   
[0xf]   coreclr!coreclr_execute_assembly + 0xe2   
[0x10]   hostpolicy!coreclr_t::execute_assembly + 0x2a   
[0x11]   hostpolicy!run_app_for_context + 0x56b   
[0x12]   hostpolicy!run_app + 0x3c   
[0x13]   hostpolicy!corehost_main + 0x107   
[0x14]   hostfxr!execute_app + 0x2e9   
[0x15]   hostfxr!`anonymous namespace'::read_config_and_execute + 0xa6   
[0x16]   hostfxr!fx_muxer_t::handle_exec_host_command + 0x161   
[0x17]   hostfxr!fx_muxer_t::execute + 0x482   
[0x18]   hostfxr!hostfxr_main_startupinfo + 0xab   
[0x19]   apphost!exe_start + 0x8d8   
[0x1a]   apphost!wmain + 0xab   
[0x1b]   apphost!invoke_main + 0x22   
[0x1c]   apphost!__scrt_common_main_seh + 0x10c   
[0x1d]   KERNEL32!BaseThreadInitThunk + 0x10   
[0x1e]   ntdll!RtlUserThreadStart + 0x2b

VS bug #1867112

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:28 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
sinsedrixcommented, Sep 14, 2022

I found multiple origins for my issue:

  1. I was trying to write my appsettings.json in the app directory which was forbidden. => I moved appsettings from Path.GetDirectoryName(CurrentProcess.MainModule.FileName) to FileSystem.AppDataDirectory
  2. The package dependency on Microsoft.UI.Xaml is not needed as it’s included with Microsoft.WindowsAppRuntime dependency
  3. The package dependency on Microsoft.VCLibs is not copied in the AppPackage output directory => For the moment, I copy it manually:
  • Dependencies\x64\Microsoft.VCLibs.x64.14.00.Desktop.appx
  • Dependencies\x86\Microsoft.VCLibs.x86.14.00.Desktop.appx

I hope, it will be fixed soon.

1reaction
MagicAndre1981commented, Sep 6, 2022

again, make sure you handle exceptions correctly because unhandled exception handler is broken in WinUI

Read more comments on GitHub >

github_iconTop Results From Across the Web

Faulting Module: microsoft.ui.xaml.dll - Microsoft Q&A
Faulting Module : microsoft.ui.xaml.dll ... A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows ......
Read more >
Many Windows programs crashes with Windows.UI.Xaml. ...
Many Windows programs crashes with Windows.UI.Xaml.dll error. Most programs on Windows open and crashes immediately. Then I open the event ...
Read more >
Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its ...
Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies: Access is denied ... I am trying to get a WinUI3 app to...
Read more >
Debugging errors thrown in Microsoft.UI.Xaml.dll
Dear Colleagues, I'm trying to debug a WinUI 3 (v1.2) desktop app (.NET 7, VS Enterprise 17.4.1) that opens a secondary Window for...
Read more >
Windows.UI.Xaml.dll error
Found following error that refers to a faulting module: "Faulting module name: Windows.UI.Xaml.dll, version: 10.0.10240.16426".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found