Skip to content
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

Upgraded AppSDK 0.8 App crashes on startup - Unable to load DLL 'Microsoft.UI.Xaml.dll' or one of its dependencies #974

Closed
ivberg opened this issue Jun 24, 2021 · 24 comments

Comments

@ivberg
Copy link

ivberg commented Jun 24, 2021

Describe the bug
Upgraded working 0.5.7 ReUnion app to 0.8. This app also used to run fine on 0.8 Preview.

Now it crashes on startup. I had a PITA time in order to try debug it and find the exception (due to running app as admin issues) but I temporarily removed that since the app appears to crash before it hits my code.

Indeed, now I can see it crashes on basic startup.

System.DllNotFoundException
HResult=0x80131524
Message=Unable to load DLL 'Microsoft.UI.Xaml.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)
Source=
StackTrace:

Steps to reproduce the bug

  1. Presumably you repro this with a C# 0.8 app created from scratch. However, I am repro'ing on my existing app
  2. Launch app, it crashes on startup before even running InitializeComponent(); in MainWindow.xaml.cs

Expected behavior
App doesn't crash on startup and all necessary .dlls are deployed

Screenshots

Version Info
PackageReference Include="Microsoft.ProjectReunion" Version="0.8.0" />
PackageReference Include="Microsoft.ProjectReunion.Foundation" Version="0.8.0" />
PackageReference Include="Microsoft.ProjectReunion.WinUI" Version="0.8.0" />

NuGet package version:
See above

Windows 10 version Saw the problem?
Insider Build (22000.41) Yes

Additional context

@ivberg
Copy link
Author

ivberg commented Jun 24, 2021

Callstack:
[Managed to Native Transition]
System.Private.CoreLib.dll!System.Runtime.InteropServices.NativeLibrary.LoadByName(string libraryName, System.Runtime.CompilerServices.QCallAssembly callingAssembly, bool hasDllImportSearchPathFlag, uint dllImportSearchPathFlag, bool throwOnError) Unknown

System.Private.CoreLib.dll!System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(string libraryName, System.Reflection.Assembly assembly, System.Runtime.InteropServices.DllImportSearchPath? searchPath, bool throwOnError) Line 14 C#
System.Private.CoreLib.dll!System.Runtime.InteropServices.NativeLibrary.Load(string libraryName, System.Reflection.Assembly assembly, System.Runtime.InteropServices.DllImportSearchPath? searchPath) Line 94 C#
Microsoft.WinUI.dll!WinRT.DllModule.DllModule(string fileName) Line 153 C#
Microsoft.WinUI.dll!WinRT.DllModule.Load(string fileName) Line 133 C#
Microsoft.WinUI.dll!WinRT.BaseActivationFactory.BaseActivationFactory(string typeNamespace, string typeFullName) Line 275 C#
Microsoft.WinUI.dll!Microsoft.UI.Xaml.Application._IApplicationStatics._IApplicationStatics() Line 270 C#
[Native to Managed Transition]
[Managed to Native Transition]
System.Private.CoreLib.dll!System.RuntimeType.CreateInstanceDefaultCtorSlow(bool publicOnly, bool wrapExceptions, bool fillCache) Line 4005 C#
System.Private.CoreLib.dll!System.Activator.CreateInstance<Microsoft.UI.Xaml.Application._IApplicationStatics>() Line 151 C#
Microsoft.WinUI.dll!WinRT.WeakLazy<Microsoft.UI.Xaml.Application._IApplicationStatics>.Value.get() Line 206 C#
Microsoft.WinUI.dll!Microsoft.UI.Xaml.Application._IApplicationStatics.Instance.get() Line 274 C#
Microsoft.WinUI.dll!Microsoft.UI.Xaml.Application.Start(Microsoft.UI.Xaml.ApplicationInitializationCallback callback) Line 282 C#
MyAppUI.dll!MyAppUI.Program.Main(string[] args) Line 26 C#

@ivberg
Copy link
Author

ivberg commented Jun 24, 2021

This is not good - this also repros on a blank new WinUI project created with the 0.8 templates.

Background:
I see that there is also now a new ReUnion 0.8 VSIX and I upgraded to that as well as checked all new manual upgrade steps.
https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/update-existing-projects-to-the-latest-release
https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/stable-channel

Same exact crash on startup as my app above

It's looking for a Microsoft.UI.Xaml.dll and I don't see that in the deployed app folder.

@asklar
Copy link
Member

asklar commented Jun 27, 2021

Do you have the package project set as startup or the app? should be the package project

@asklar
Copy link
Member

asklar commented Jun 27, 2021

There is a different bug that will crash reunion 0.8 apps in insider builds, tracked by microsoft/microsoft-ui-xaml#5295

@iceberg1370
Copy link

Pkg project

@JonPerkinsOldGit
Copy link

I had the same problem, but running "Clean Solution" solved it for me :-)

@btueffers
Copy link
Contributor

Please try 0.8.1 to verify if the issue is resolved! Please re-open if you're still facing the problem.

@ivberg
Copy link
Author

ivberg commented Jul 15, 2021

Yes - verified it's now resolved in 0.8.1!

@seanocali
Copy link

I'm getting this on 1.0.0-preview3.

@stewienj
Copy link

stewienj commented Nov 10, 2021

I'm getting this on 1.0.0-preview3.

I'm not getting this issue on my dev machine, but when I copy my app (unpackaged) to a virtual machine for testing, and install the Microsoft.WindowsAppRuntime.Redist.1.0.0 I seem to be missing this file that exists on my dev machine (as reported by event viewer):
C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.0-preview3_0.297.2018.0_x64__8wekyb3d8bbwe\Microsoft.ui.xaml.dll

(edit) However this is not the case, because I confirmed using procmon64 that the above DLL is being successfully loaded. Event Viewer is saying it is unable to load Microsoft.ui.xaml.dll in XamlCheckProcessRequirements()

I was following the instructions on this page https://docs.microsoft.com/en-us/windows/apps/winui/winui3/create-your-first-winui3-app?tabs=csharp%2Ccsharp-unpackaged#instructions-for-winui-3-unpackaged-desktop-apps excluding installing the VS2019 extension because my test VM is not a development machine.

@devlead
Copy link

devlead commented Nov 10, 2021

I'm getting this too on my Windows 10 VM, but works fine on Windows 11 Desktop, VM and Surface GO 3 Win11.

@seanocali
Copy link

I'm running Windows 10, not a VM.

@tinmac
Copy link

tinmac commented Nov 22, 2021

Im having this issue with a W10 instance running on Hyper-V. All (correct) dependencies installed.

image

Would be benefficial to be able to test apps on Hyper-V.

@tinmac
Copy link

tinmac commented Nov 22, 2021

The solution was to install VCRedist . Testing WinUI 3 desktop apps in Hyper-V works fine now thanks to @MikeHillberg's comment

@seanocali
Copy link

seanocali commented Dec 7, 2021

Reinstalling VCRedist didn't solve this for me. Now on WindowsAppSDK 1.0 still have the problem.
EDIT: I switched to a single-project package and am not experiencing the problem.

@yshteinm
Copy link

When I run Packaged app on my machine it works. When I run Unpackaged app it doesn't. When I run exe from console it doesn't work. When I deploy an app to another machine it doesn't work. When I say it doesn't work it means I am getting an error either in Event Viewer or dialog box "Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies".
I am running Released version 1.0.0

@jeremyVignelles
Copy link

@yshteinm : Did you find a solution for your issue ? It seems your comment gets upvoted, so I'm not alone having that issue, but is there an issue I can follow ?

@yshteinm
Copy link

@jeremyVignelles I gave up on WinSDK project and doing .Net 6 Core Win Forms

@rossirpaulo
Copy link

This is ridiculous. It should not be closed.

@davidbuckleyni
Copy link

Im still having the issue in 2023

System.DllNotFoundException: 'Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)'

image

@christoph-samuel
Copy link

Im still having the issue in 2023

System.DllNotFoundException: 'Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)'

image

I'm having the same issue...
Can someone help please?

@mlynch
Copy link

mlynch commented Apr 28, 2023

Okay so I just updated a project from WindowsAppSDK 1.0.2 to 1.3.0 and I ran into this issue immediately, but I was able to resolve it. I did these things:

And I was able to get my app to run again. Unfortunately, you can't just set the version to something like 1.3.0 as that breaks everything, you have to use the very specific version as shown in the samples (ex: 1.3.230331000). This feels like something that should be fixed either in docs or in releases.

@krishnainnani
Copy link

Did all these still facing the same issue. "Unable to load DLL 'Microsoft.ui.xaml.dll' or one of its dependencies"

@Kakao-Team
Copy link

I had the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests