Diagnose Assembly Loading Failures
Majority of the time, you can use fuslogvw.exe to find out why an assembly load failed.
There are times when fusion binding log tells you that the assembly is found successfully, but you still get an FileLoadException.
One of the common case is that one of the unmanaged dlls the assembly depends on cannot be found. After fusion finds the assembly, CLR Loader will try to call LoadLibrary on the assembly to load it. If one of the unmanaged dlls cannot be found, LoadLibrary will fail, and you will receive the FileLoadException.
If that happens, use depends.exe to find out which unmanaged dll is missing. And put it somewhere the OS can find it.
Comments
- Anonymous
September 23, 2004
The comment has been removed - Anonymous
September 23, 2004
Thankyou Junfeng for your response to my posting on the Whidbey newsgroup, and for this blog posting.
When i finally reach my development machine, I will look into what you have suggested.
Regardless if I do find the problem or not...how did you find this potential problem? I've scoured the net for this, and found no answer. It worries me somewhat, that the fileloadexception information I was provided, was so vague. How would I go debugging something like this in the future? Or is it just something you must remember?
Perhaps providing diagnostics information for CLR assembly loading is just simply lacking :( - Anonymous
September 24, 2004
The comment has been removed - Anonymous
September 26, 2004
"But it is way out of contect for this post".
I wonder how assembly loading issues can be out of context of his post, and this weblog. The problem is dealing with this, not in a pure .NET world, where 100% assemblies are under control and fully managed.
A kind of POC I'd like to hear more about is how .NET apps integrate existing unmanaged apps, especially with respect to assembly loading. For instance, you want to write a Lotus Notes plugin in .NET. - Anonymous
September 26, 2004
Stephane,
When I say "out of context", I mean this post is about to help you diagnose assembly loading failures. We cannot dictate how an application developer/administrator deploys bits, though we do have our probing rules. Ultimately it is the application developer/administrator's responsibility to make sure the assembly can be discovered and loaded by CLR.
That said, I am very interested in knowing your scenario, and how can we help you to solve your problem.
Plugin itself is a huge issue and needs very careful design.