Every one of us, software developers, experienced situations where the .Net Framework could not locate an assembly and ended up facing the TypeLoadException. These failures usually happen due to an assembly deployed to the wrong location or a mismatch in version numbers or cultures. A quick way to check what went wrong is to open the module window (Visual Studio) during debugging but that may be sometimes impossible or inconvenient because:

  • We may not have Visual Studio installed. 
  • We installed the product in the customer site and we don’t have the code available.
  • It is some third party assemblies which causes the problems.

Luckily, there is an assembly binding log viewer which displays information that helps us diagnose why the .NET Framework can not locate an assembly at run time. This tool is called Fuslogvw (short for Fusion Log Viewer) and can be launched from the Visual Studio Command Prompt. Go to Start->Microsoft Visual Studio 2005/2008->Visual Studio tools->Visual Studio Command prompt and type fuslogvw. This is what you get:


Here is how to use it:image

  • Press “Settings” (in the main window).
  • Choose “Log bind failures to disk”.
  • Check the “Enable custom log path”.
  • Enter a custom log path, notice that it should be an existing folder and press OK.
  • Run the application that crashes to reproduce the binding failure.
  • After the failure happens press “Refresh.” One or more lines should appear in the list view.
  • Identify the relevant line and either double-click it or press “View Log”.
  • A window with a detailed log of what caused the binding failure appears. Read it carefully to understand the problem.

Although this tool is already installed with the .NET Framework, many developers don’t know about it, so I hope that this post will help spread the word about fuslogvw because it may become very helpful sometimes.

Tags :

3 Responses to “Diagnose Assembly Binding Failures”

  1. Will

    Said on June 18, 2008 :

    I believe that after you configure you have to reboot in order to start logging. I’m not entirely sure, but the last time I used fuslogvw that’s what I had to do…

  2. Shahar Y

    Said on June 18, 2008 :

    Hi Will,

    I started using it lately, and you don’t have to reboot in order to start logging.

1 Trackback(s)

  1. Jun 20, 2008: Reflective Perspective - Chris Alcock » The Morning Brew #119

Post a Comment