Troubleshooting Assembly Binding Issues in .NET

When dealing with third party libraries we frequently get into assembly binding/loading issues. It would take quite lot of time to understand the problem, if you don’t know where to look for.


.NET Framework provides several tools, which can help us to troubleshoot assembly binding issues.

1. IL Disassembler

You can use the default GUI in the IL Disassembler to view the metadata and disassembled code of any managed file (.EXE/.DLL) in a hierarchical tree view.

It gives all referenced assemblies information along with version information that it was compiled against.

Installation

This tool is automatically installed with Visual Studio.

Launching

To run the tool, use the Developer Command Prompt or the Visual Studio Command Prompt.

At the command prompt, type the following:

ildasm <<dll/exe name>>

 
 
 
 

2. Assembly Binding Log Viewer (Fusion Log Viewer)

The Assembly Binding Log Viewer displays details for assembly binds. This information helps you diagnose why the .NET Framework cannot locate an assembly at run time.

These failures are usually the result of an assembly deployed to the wrong location, a native image that is no longer valid, or a mismatch in version numbers or cultures.

Installation

Fusion Log Viewer is not a separate install. It is rather a .net framework tool which is installed with Visual Studio and Windows SDK.

Launching

To run the tool, use the Developer Command Prompt or the Visual Studio Command Prompt.

At the command prompt, type the following:

Fuslogvw

Note:

You must run fuslogvw.exe with administrator privileges. 
 
 
 

Using The Viewer

After launching the viewer, the tool's setting would determine what kind of log do you want to see for assembly binding.

You have the following options:

  1. Log Disabled: No logging for assembly binding.
  2. Log in exception text: Logs minimum binding information to the disk.
  3. Log assembly binding failures: Generally used options. Logs in only those libraries which have binding issues.
  4. Log all binds to disk: Even those assemblies which don't have any binding failures.

 

The number of entries in the list for an application would depend upon the number of assemblies which can not be loaded.

If we had selected the option to log all bindings then an entry would represent an assembly loaded in an application.

By default, these logs are created in Temporary Internet folders. It is also the recommended way because you wouldn't have to worry about cleaning this up.

Alternatively, we can change the location in Settings view.

 
 
Note:

Make sure that the folder given in Custom log path already exists.

 
 
Ebook Download
View all
Learn
View all