By user32736

2008-11-01 08:58:30 8 Comments

How do I enable assembly bind failure logging (Fusion) in .NET?


@Tereza Tomcova 2015-10-08 10:26:24

You can run this Powershell script as administrator to enable FL:

Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name ForceLog         -Value 1               -Type DWord
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogFailures      -Value 1               -Type DWord
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogResourceBinds -Value 1               -Type DWord
Set-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogPath          -Value 'C:\FusionLog\' -Type String
mkdir C:\FusionLog -Force

and this one to disable:

Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name ForceLog
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogFailures
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogResourceBinds
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogPath

@Oliver 2015-10-30 21:44:23

Thanks! I've allowed myself to put your commands into this gist. And I added creation of the c:\FusionLog dir so that people don't forget that ;-)

@r.pankevicius 2019-01-17 09:32:05

Command line rules! I could quickly replay this using the best invented so far code reusability technology called "cut and paste". Thanks.

@Waescher 2019-05-09 21:39:14

Since my tweet about Fusion++ got retweetet from Scott Hanselman himself, I think I am confident enough to tell you about it.

I wrote an assembly binding log viewer named Fusion++ and put it on GitHub.

I hope you and some of the visitors in here can save some worthy lifetime minutes with it.


@Sylvain Girard 2019-06-03 10:14:30

Dear sir, you are a god!

@Igor Meszaros 2019-05-08 15:46:15

For those who are a bit lazy, I recommend running this as a bat file for when ever you want to enable it:

reg add "HKLM\Software\Microsoft\Fusion" /v EnableLog /t REG_DWORD /d 1 /f
reg add "HKLM\Software\Microsoft\Fusion" /v ForceLog /t REG_DWORD /d 1 /f
reg add "HKLM\Software\Microsoft\Fusion" /v LogFailures /t REG_DWORD /d 1 /f
reg add "HKLM\Software\Microsoft\Fusion" /v LogResourceBinds /t REG_DWORD /d 1 /f
reg add "HKLM\Software\Microsoft\Fusion" /v LogPath /t REG_SZ /d C:\FusionLog\

if not exist "C:\FusionLog\" mkdir C:\FusionLog

@Vlad 2019-01-21 09:45:16

In my case helped type disk name in lower case

Wrong - C:\someFolder

Correct - c:\someFolder

@Dikshit Kathuria 2018-10-27 15:31:11

Just in case you're wondering about the location of FusionLog.exe - You know you have it, but you cannot find it? I was looking for FUSLOVW in last few years over and over again. After move to .NET 4.5 number of version of FUSION LOG has exploded. Her are places where it can be found on your disk, depending on software which you have installed:

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\x64

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin

@Mike Goatly 2010-07-15 14:49:48

I usually use the Fusion Log Viewer (Fuslogvw.exe from a Visual Studio command prompt or Fusion Log Viewer from the start menu) - my standard setup is:

  • Open Fusion Log Viewer as administrator
  • Click settings
  • Check the Enable custom log path checkbox
  • Enter the location you want logs to get written to, for example, c:\FusionLogs (Important: make sure that you have actually created this folder in the file system.)
  • Make sure that the right level of logging is on (I sometimes just select Log all binds to disk just to make sure things are working right)
  • Click OK
  • Set the log location option to Custom

Remember to turn of logging off once you're done!

(I just posted this on a similar question - I think it's relevant here too.)

@jpierson 2012-10-04 03:34:50

Note that in cases where you are hosting the runtime yourself from a native application you will be required to use a custom log path for some reason otherwise you won't get anything logged.

@Josh 2014-07-31 20:11:43

At least in my situation, I didn't actually have to set the custom log paths. All I had to do was turn logging on, e.g., "Log all binds to disk" on the settings dialog.

@vezenkov 2016-08-12 12:32:45

Run as Administrator was required in my case, otherwise all options were disabled.

@Spidermain50 2016-12-15 20:27:10

I have spent all day trying to figure out how to use this tool and you solved it!

@The Senator 2017-03-23 16:17:09

If you are trying to use the Fusion Log Viewer in conjunction with Visual Studio I've found that I had to launch the log viewer and then restart Visual Studio as otherwise the viewer doesn't seem to log VS bind fails.

@Tabrock 2017-05-10 21:07:05

Note: create the folder as Admin!

@Veverke 2017-06-12 14:28:32

Make sure you are running fuslogvw not only as admin but also from the correct Windows SDK path the Visual Studio project throwing the exception is using. Check its csproj and search for SDK within (my sdk node is named TargetFrameworkSDKToolsDirectory). Using a non matching fuslogvw version seems to not catch the exceptions (which makes sense...)

@Tristan van Dam 2017-11-09 10:05:04

Thanks for the reminder to turn off logging once you're done. I assumed (very silly to just assume) that it only logged when running fusion log

@ToolmakerSteve 2018-04-10 11:56:01

Adding to @Veverke's comment: "Search everything" app says latest ones on my pc are under "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.1 Tools"; AFAIK using the highest listed SDK version is a good strategy (I don't think you need to use an OLDER fuslogvw, even if you are using an older VS.)

@Gary Kindel 2009-10-06 18:23:54

Add the following values to

DWORD ForceLog set value to 1
DWORD LogFailures set value to 1
DWORD LogResourceBinds set value to 1
DWORD EnableLog set value to 1
String LogPath set value to folder for logs (e.g. C:\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.

BTW, don't forget to turn off fusion logging off when not needed.

@Michhes 2010-07-30 02:21:58

Gary's solutions worked for me although I also had to follow by resetting IIS. Note I configured this in a clean environment where I didn't want to install SDKs and the like.

@newman 2010-11-11 02:27:20

I added those entries, but my c# express (2010) still tells me "Assembly binding logging is turned OFF". How to make it work?

@Gary Kindel 2010-12-06 20:18:38

Been reported by some that registry change does not take right away. Have you tried turning Fusion logging on then rebooting?

@Orion Edwards 2011-03-28 22:29:48

You need to restart whatever program it is you're running for it to read those registry settings

@Art F 2012-11-16 16:19:16

Where exactly is the HKEY_LOCAL_MACHINE folder located?

@David Schmitt 2012-12-11 12:12:49

@ArtF: That's a location in the registry.

@r3mark 2013-06-04 03:09:04

The Fusion Log Viewer does all that for you. Go to Start -> Programs -> Visual Studio xxxx > Visual Studio Tools > Visual Studio Command Prompt (run as admin) and type "fuslogvw". In Settings you adjust the logging.

@Igor Kustov 2013-11-19 07:16:49

To turn on/off logging handy, I've created .reg files, which are based on Gary Kindel's answer: enabling and disabling.

@Chandermani 2014-07-11 06:10:21

Enabling fusion log can have severe performance impact over time. My Visual Studio experience deteriorated over time, only to find that fusion logging was enable. Remember to disable it after use.

@Fosna 2014-10-16 13:11:40

When using Fusion Log on Azure machine make sure to put log files on the same disk as application. Ex. web app is deployed to F:\sitesroot\0. Log to `F:\fusionlog`. Create that dir before.

@James Poulose 2015-08-31 02:25:41

@r3mark It doesn't put the trailing slash for the folder though.

@Gumzle 2015-10-13 07:35:43

But.. REMEMBER TO TURN IT OFF. I just lost a day troubleshooting slow IIS, and it's due to me turning on Fusion Logging but not turning it off. 10 Gb of files later.... Procmon.exe saved the day.

@gkakas 2015-10-13 20:31:06

The "EnableLog=1" is missing from this list.

@AJ Richardson 2017-04-12 20:31:38

From my experience, you should NOT put this under the Wow6432Node key, even if your application runs 32-bit.

@Tarik 2017-06-15 19:33:13

If you don't disable logging, it starts taking gigs in a short amount of time.

@magicandre1981 2015-03-31 17:22:02

Instead of using a ugly log file, you can also activate Fusion log via ETW/xperf by turning on the DotnetRuntime Private provider (Microsoft-Windows-DotNETRuntimePrivate) with GUID 763FD754-7086-4DFE-95EB-C01A46FAF4CA and the FusionKeyword keyword (0x4) on.

@echo off
echo Press a key when ready to start...
echo .
echo ...Capturing...
echo .

"C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\xperf.exe" -on PROC_THREAD+LOADER+PROFILE -stackwalk Profile -buffersize 1024 -MaxFile 2048 -FileMode Circular -f Kernel.etl
"C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\xperf.exe" -start ClrSession -on Microsoft-Windows-DotNETRuntime:0x8118:0x5:'stack'+763FD754-7086-4DFE-95EB-C01A46FAF4CA:0x4:0x5 -f clr.etl -buffersize 1024

echo Press a key when you want to stop...
echo .
echo ...Stopping...
echo .

"C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\xperf.exe" -start ClrRundownSession -on Microsoft-Windows-DotNETRuntime:0x8118:0x5:'stack'+Microsoft-Windows-DotNETRuntimeRundown:0x118:0x5:'stack' -f clr_DCend.etl -buffersize 1024 

timeout /t 15

set XPERF_CreateNGenPdbs=1

"C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\xperf.exe" -stop ClrSession ClrRundownSession 
"C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\xperf.exe" -stop
"C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\xperf.exe" -merge kernel.etl clr.etl clr_DCend.etl Result.etl -compress
del kernel.etl
del clr.etl
del clr_DCend.etl

When you now open the ETL file in PerfView and look under the Events table, you can find the Fusion data:

Fusion events in PerfView

@magicandre1981 2015-09-17 04:04:02

@YuriBondarchuk this activates it on demand and you have more data in the ETL (other processes, fileversion data) so that you can give the files t other users and they can get MUCH more information compared to the normal fusion log

@andrerav 2013-07-18 15:03:37

Just a tiny bit of info that might help others; if you do something along the lines of searching all assemblies in some directory for classes that inherit/implement classes/interfaces, then make sure you clean out stale assemblies if you get this error pertaining to one of your own assemblies.

The scenario would be something like:

  1. Assembly A loads all assemblies in some folder
  2. Assembly B in this folder is stale, but references assembly C
  3. Assembly C exists, but namespaces, class names or some other detail might have changed in the time that has passed since assembly B became stale (in my case a namespace was changed through a refactoring process)

In short: A ---loads--> B (stale) ---references---> C

If this happens, the only telltale sign is the namespace and classname in the error message. Examine it closely. If you can't find it anywhere in your solution, you are likely trying to load a stale assembly.

@user32736 2008-11-01 09:00:13

Set the following registry value:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion!EnableLog] (DWORD) to 1

To disable, set to 0 or delete the value.

[edit ]:Save the following text to a file, e.g FusionEnableLog.reg, in Windows Registry Editor Format:

Windows Registry Editor Version 5.00


Then run the file from windows explorer and ignore the warning about possible damage.

@Jon Skeet 2008-11-01 15:54:51

Not that the entry probably won't exist - you'll have to create it. At least, I did when I was about to answer this question just before the crash this morning :)

@Bruno Martinez 2009-07-14 15:21:50

What does the ! mean? Key or value? What about 64 bits systems?

@Marchy 2009-11-16 22:04:38

this doesn't actually work. the value is ForceLog not EnableLog, and there is an additional step needed here (see:…)

@Nick DeMayo 2010-06-22 13:02:53

actually, this does just need to run iisreset afterwords to get it to work.

@Norman H 2010-07-08 19:55:36

iisreset? Really? Why would you reset IIS to get Fusion bind logging to work?

@Brian 2011-02-08 21:53:00

@Norman: Because this particular setting is used to make the Asp.Net errors show assembly binding error messages in the error pages, not to save the logs to file. @OP: +1. Edited to include a .reg file. The ! format is one I had never seen, except in the error message that sent me to this page looking for answers.

@Kenny Evitt 2015-01-23 16:54:09

You don't need to reset IIS – just the relevant application pool. Or at least that was all I needed to do.

@Shesha 2016-03-30 05:36:40

what is Windows Registry Editor Format: ?

@Ian Kemp 2018-07-04 09:47:35

@Samuel Jack 2010-05-19 08:26:46

If you have the Windows SDK installed on your machine, you'll find the "Fusion Log Viewer" under Microsoft SDK\Tools (just type "Fusion" in the start menu on Vista or Windows 7/8). Launch it, click the Settings button, and select "Log bind failure" or "Log all binds".

If these buttons are disabled, go back to the start menu, right-click the Log Viewer, and select "Run as Administrator".

@Tim Lovell-Smith 2010-08-24 22:11:37

Those buttons are disabled for me - why?

@Samuel Jack 2010-09-24 15:35:18

@Tim, not seen that before - could it be to do with Admin privileges? It is HKEY_LOCAL_MACHINE that is being modified after all.

@pauloya 2011-08-16 12:00:04

"Settings, Log bind failures" was enough to find my problem.

@Edward Wilde 2013-02-20 09:27:40

Make sure the folder allows write access. UAC and c:\logs do not play nice with the fusion log

@Bruno Lopes 2013-03-07 19:33:48

Just as a note, if the buttons are disabled, re-run fusion log viewer with admin privileges.

@GilesDMiddleton 2015-09-08 14:58:41

If you aren't seeing any output Reboot your PC. I experienced this with .NET 4.6 + VS2015 on clean PC just with .NET 4.6 tools folder copied over. Note if you are told errors about the custom path when you set it (and you think it's telling you lies) press OK on the settings dialog a few times anyway and it'll ignore the error.

@Veverke 2017-06-13 08:52:19

As I wrote in a comment to @MikeGoatly's answer, I think you need to make sure you are picking the correct fuslogvw.exe, from the correct Windows SDK folder. Check which SDK folder is in use by looking into the .csproj of the project you are running.

@Adam Mendoza 2012-04-17 23:50:38

If you already have logging enabled and you still get this error on Windows 7 64 bit, try this in IIS 7.5:

  1. Create a new application pool

  2. Go to the Advanced Settings of this application pool

  3. Set the Enable 32-Bit Application to True

  4. Point your web application to use this new pool

@Adam Tuliper - MSFT 2011-10-21 05:37:21

The Fusion Log Settings Viewer changer script is bar none the best way to do this.

In ASP.NET, it has been tricky at times to get this to work correctly. This script works great and was listed on Scott Hanselman's Power Tool list as well. I've personally used it for years and its never let me down.

@Adam Tuliper - MSFT 2012-09-19 00:32:45

ps MAKE SURE you disable it after running or this folder could get quite large

@magicandre1981 2015-04-03 06:58:59

this is why I use ETW, to only log data if I really need them, not all the time in an ugly large log file.

Related Questions

Sponsored Content

26 Answered Questions

[SOLVED] How can I get the application's path in a .NET console application?

19 Answered Questions

38 Answered Questions

6 Answered Questions

[SOLVED] How can I get the assembly file version

17 Answered Questions

[SOLVED] How do I get the current username in .NET using C#?

  • 2009-08-06 17:40:27
  • Yves
  • 511296 View
  • 536 Score
  • 17 Answer
  • Tags:   c# .net

14 Answered Questions

[SOLVED] How to determine if a .NET assembly was built for x86 or x64?

14 Answered Questions

[SOLVED] How do I use WPF bindings with RelativeSource?

18 Answered Questions

[SOLVED] What are .NET Assemblies?

  • 2010-06-04 09:03:49
  • John
  • 208262 View
  • 187 Score
  • 18 Answer
  • Tags:   c# .net

2 Answered Questions

[SOLVED] WRN: Assembly binding logging is turned OFF

  • 2013-09-05 12:58:11
  • user2750785
  • 42051 View
  • 10 Score
  • 2 Answer
  • Tags:   c# wcf wcf-binding

Sponsored Content