Click here to Skip to main content
15,850,607 members
Articles / Programming Languages / C#

Investigating Managed Assembly Load Failures

Rate me:
Please Sign up or sign in to vote.
4.42/5 (6 votes)
16 Jul 2014CPOL3 min read 16.9K   10   4
How to troubleshoot managed assembly load failures?


We are often faced with a problem where an assembly fails to load. There could be various reasons for the load failure:

  1. An assembly being probed could not be located.
  2. Version mismatch or an assembly of diffrent version was already loaded by the process.
  3. A dependency could not be found or resolved.

It sometimes is cumbersome to troubleshoot such scenarios and, having had the similar experience a couple of times made me search for a way to achieve it especially on environments where there are no Visual Studio or .NET tools.

I came across Fusion Log Viewer (fuslogvw.exe) which is a part of .NET tools and helps in capturing all assembly binding information on the machine. However, good thing is that it's just a log viewer that comprehends the log files and dumps the information on a neat grid. But, it not required to enable or capture the logs which makes it a perfect fit for production environments.

Using the code

All we need to do is set a couple of registry entries to enable logging. Here are the keys that you can easily configure.

Add the following values to:


Add the following keys:

  • ForceLog [DWORD]: Set it to 1 to enable logging information of all assembly bindings on the machine.
  • LogFailures [DWORD]: Set it to 1 to enable logging failures during assembly loads.
  • LogResourceBinds [DWORD]: Set it to 1 to enable logging information about all resource bindings.
  • LogPath [String]: Set it to the folder where you want the log files to be created (e.g. C:\Logs\FusionLog\)


  • Make sure you include the backslash after the folder name and that the Folder exists.
  • You need to restart the program that you're running to force it to read those registry settings.

You may put these settings in a reg file to set/update the same quickly e.g.



Once again try and repro the scenario where the assembly load failed, open the log folder and there you go... the logs are very easy to read and understand :)

Interpreting the log files

Once you've enabled the logging and restarted your application which fails to load an assembly, you see some log files in fusion log path you have configured. Now:

  1. The logs are contained in a folder named by the host process which tried to load the assembly.
  2. The log files inside this folder are named by the assembly which failed to load.
  3. And, finally the data inside the log file will tell why/how the probing failed.

Here's a sample log content:

<meta http-equiv="Content-Type" content="charset=unicode-1-1-utf-8"><!-- saved from url=(0015)assemblybinder: --><html><pre>
*** Assembly Binder Log Entry  (7/3/2014 @ 4:11:21 PM) ***

The operation failed.
Bind result: hr = 0x80131040. No description available.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable  C:\Program Files\XXXX\YYYY.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = ABCD, Version=, Culture=neutral, PublicKeyToken=a38ab61cdab78c6a
LOG: Appbase = file:///C:/Program Files/XXXX
LOG: Initial PrivatePath = C:\Program Files\XXXX
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = YYYY.exe
Calling assembly : PQRS, Version=, Culture=neutral, PublicKeyToken=a38ab61cdab78c6a.
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files\XXXX\YYYY.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: ABCD, Version=, Culture=neutral, PublicKeyToken=a38ab61cdab78c6a
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files/XXXX/ABCD.DLL.
LOG: Assembly download was successful. Attempting setup of file: C:\Program Files\XXXX\ABCD.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: ABCD, Version=, Culture=neutral, PublicKeyToken=a38ab61cdab78c6a
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Here, YYYY.exe loaded an assembly PQRS.dll which has a dependency on ABCD.dll (version but on the machine it could only find ABCD.dll (version

The log indicates the failure in load because of mismatch in Minor Version of the assembly. Hence, the load of PQRS.dll fails as it's dependent assembly could not be loaded.


[16-Jul-2014 Update]: Added the section <Interpreting the log files> as requested.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer (Senior)
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

Generalnice ... Pin
Sharath C V15-Jul-14 21:30
professionalSharath C V15-Jul-14 21:30 
... and useful ...
Generaluseful Pin
Akhil Mittal15-Jul-14 20:26
professionalAkhil Mittal15-Jul-14 20:26 
GeneralThoughts Pin
PIEBALDconsult15-Jul-14 7:26
mvePIEBALDconsult15-Jul-14 7:26 
GeneralRe: Thoughts Pin
himanshu agarwal16-Jul-14 19:28
himanshu agarwal16-Jul-14 19:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.