Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I enable Assembly binding logging?

I'm getting, "Could not load file or assembly 'Bla' or one of its dependencies. An attempt was made to load a program with an incorrect format."

A portion of the detailed info says:

"WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]."

So, thinking this may give me some insight in why I'm getting the error above (maybe the next YSOD would contain more explicit information about exactly why it's failing), I navigated to that location in the registry, but there is no such key that I can see. What it does have is:

\Fusion      (Default)   value not set     \GACChangeNotification     \NativeImagesIndex     \PublisherPolicy 

What am I missing?

like image 309
B. Clay Shannon-B. Crow Raven Avatar asked Jul 16 '13 15:07

B. Clay Shannon-B. Crow Raven


People also ask

How do I disable assembly binding logging?

Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion! EnableLog]. Include the backslash after the folder name and that the Folder exists.

How do I open Fuslogvw?

You must run fuslogvw.exe with administrator privileges. This tool is automatically installed with Visual Studio. To run the tool, use Visual Studio Developer Command Prompt or Visual Studio Developer PowerShell with administrator credentials. The viewer displays an entry for each failed assembly bind.

What is FusionLog?

FusionLog folder is not part of SolarWinds and is a folder created by Microsoft. The way this works is Microsoft has its libraries and we use them as a client. Fusion logging is extra logging that we can sometimes use to see underlying issues that our logs might have not caught.


1 Answers

A good place to start your investigation into any failed binding is to use the "fuslogvw.exe" utility. This may give you the information you need related to the binding failure so that you don't have to go messing around with any registry values to turn binding logging on.

Fuslogvw MSDN page

The utility should be in your Microsoft SDKs folder, which would be something like this, depending on your operating system: "C:\Program Files (x86)\Microsoft SDKs\Windows\v{SDK version}A\Bin\FUSLOGVW.exe"

  1. Run this utility as Administrator, from Developer Command Prompt (as Admin) type FUSLOGVW a new screen appears

  2. Go to Settings to and select Enable all binds to disk also select Enable custom log path and select the path of the folder of your choice to store the binding log.

  3. Restart IIS.

  4. From the FUSLOGVW window click Delete all to clear the list of any previous bind failures

  5. Reproduce the binding failure in your application

  6. In the utility, click Refresh. You should then see the bind failure logged in the list.

  7. You can view information about the bind failure by selecting it in the list and clicking View Log

The first thing I look for is the path in which the application is looking for the assembly. You should also make sure the version number of the assembly in question is what you expect.

like image 106
Scampbell Avatar answered Sep 28 '22 08:09

Scampbell