Thursday, May 14, 2009

Using Fusion Logs to debug the assembly binding failures

While working with WCF i wrote a custom Client Message level interceptor and as usual WCF tries to load the assembly containing the interceptor type using reflection.
While doing this WCF runtime threw an exception which suggested that the Assembly Binding failed however no information is supplied regarding why the binding is failing except that it failed with HRESULT 0x80131040
In order to find the exact reason we can enable the fusion logs and check the actual binding steps going on in order to find the actual problem in binding
To do this following steps should be used to check the binding process
1) Make a DWORD entry to the Registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\FusionEnableLog and change its value to 1
2) Open the fusion log viewer fuslogvw from the command prompt
3) In the settings of log viewer select the option to log the binding failures to disk
4) Restart the process which is having binding failures
5) Refresh the log viewer and you'd see the exact reasons why the bindings are failing

Happy coding :)


No comments: