visual-c++dllwindows-store-appswin-universal-appnative

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.


Solution

  • 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 EXEs 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.