Discovering which assemblies are loading which dependencies (at runtime)

440 views Asked by At

What's the easiest way to discover which assembly is triggering certain dependencies to be loaded at runtime? I've got a stray reference to an old assembly somewhere, in one of the 100+ assemblies that get loaded as part of our application.

Using FUSLOGVW I can see the old assembly being loaded - but the logs don't tell me which assembly has caused it to load. I've used CheckASM which allows me to browse the dependencies of the primary assembly, and explore down the tree - but these are all fine.

So it must be an assembly that's being loaded dynamically at runtime, or a configuration file somewhere. But I can't find it for the life of me.

Was wondering if there was a smarter way to do this?

2

There are 2 answers

1
Andrey Taptunov On BEST ANSWER

Perhaps you can subscribe to AssemblyResolve event in all app domains (if there are not too many). ResolveEventArgs contains special field for this - ResolveEventArgs.RequestingAssembly

0
Mark Cidade On

How about deleting (or renaming) the assembly to see if an exception is thrown at the point where the program attempts to load it? The stack trace should contain a reference to a method from the calling assembly.