Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Determine Which Dll Dependency is Failing to Load in Windows Store/Universal Apps?

When running a UWP project I'm working on I receive the following dialog.

"Unable to activate Windows Store app 'MyAppsMangledName'. The 'MyExeName' process started, but the activation request failed with error 'The App didn't start'."

The Visual Studio output has the following.

The thread 0x3d4c has exited with code -1073741515 (0xc0000135). The thread 0x3b50 has exited with code -1073741515 (0xc0000135). The program 'MyExeName' has exited with code -1073741515 (0xc0000135) 'A dependent dll was not found'.

The Event Viewer has 3 events that basically restate the popup dialog in 3 different ways and nothing else.

Running Process Monitor during the startup shows me many dlls being successfully loaded but nothing indicating failure besides some NAMENOTFOUND events which unfortunately don't show what name wasn't found.

In Win32 a helpful dialog usually indicates which dll could not be loaded. And of course with .Net apps the fusion logs make tracing this very straight forward. But for Store/UWP apps I can't seem to find a good way to track down the offending dependency.

like image 298
DubiousPusher Avatar asked Mar 30 '16 17:03

DubiousPusher


People also ask

How does .NET determine DLL dependencies?

Load your DLL into it, right click, and chose 'Analyze' - you'll then see a "Depends On" item which will show you all the other dll's (and methods inside those dll's) that it needs.

What is DLL dependency?

When a program uses a DLL, an issue that is called dependency may cause the program not to run. When a program uses a DLL, a dependency is created. If another program overwrites and breaks this dependency, the original program may not successfully run.

Why can't I load a DLL?

Unfortunately the error could indicate an issue with dependencies of the dll you're trying to load, and if logging is enabled you should be able to see exactly which one this is. Note that a dependency loaded into the loading application is not sufficient for giving a dll access to it in all cases (if they do not share the same application domain).

How do I check if a DLL or EXE is running in R?

Drag a .DLL or .EXE into the application window and it will show you the dependencies, what type of loading mechanism they use (e.g. eager or delay load), and also what exported functions from the dependent DLLs are actually used by the .DLL or .EXE you have selected. Here is a screenshot of depends.exe operating on my R extension DLL.

How do I find all DLLs in a program?

One way to collect the list of dynamically loaded DLLs is to run Dependency Walker (depends.exe) on your app, as described in Understanding the Dependencies of a Visual C++ Application. Unfortunately, this tool is outdated and may report that it can't find certain DLLs.

How do I check if a file has a dependency?

Dependency Walker is a free and portable tool that can analyze any Windows module such as EXE, DLL, OCX, SYS and tell you the file’s dependencies. Simply run the program, click on File > Open and select the file that you want to check.


Video Answer


1 Answers

This just hit me too on a project I'm working on. And after much digging, someone on my team was able to figure it out. So figured I'd share it for others struggling with the same issue.

We're doing UWP with C++ using VS2015. So with that in mind, there is a program called gflags located for me at C:\program Files (x86)\Windows Kits 10\Debuggers\x64\gflags.exe

So you'll want a cmd window with admin, and run the command gflags.exe -i your-program-name.exe +sls

Note: gflags wasn't in my path so either add the path or navigate to where it is before executing the command.

Just pass in the name of the exe without directories. What it does is sets a registry setting for VS that turns on sls (show loader snaps) for exe's matching that name. Then run your application in VS and and you'll get a large amount of dll loading information including names of the dlls that fail to load in your output window. In our case it was this:

5038:34f4 @ 789320468 - LdrpProcessWork - ERROR: Unable to load DLL: "vccorlib140d_app.DLL", Parent Module: "E:\projects---\Source\Builds\vs2015_Debug_UWP_x64\AppX---.exe", Status: 0xc0000135

Another quicker alternative way to test this (YMMV) was to compare the output with another build config that does work. In our case, we can run release builds just fine, but debug builds barf. And the release output showed vccorlib140_app.dll loaded while the debug had it missing.

like image 196
Kris Morness Avatar answered Oct 27 '22 20:10

Kris Morness