How to enable assembly bind failure logging (Fusion) in .NET

后端 未结 13 3213
难免孤独
难免孤独 2020-11-21 04:50

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

13条回答
  •  萌比男神i
    2020-11-21 05:38

    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.

提交回复
热议问题