开发者

Discovering which assemblies are loading which dependencies (at runtime)

开发者 https://www.devze.com 2023-02-07 23:07 出处:网络
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 somew开发者_如何学编程here, in one of the

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 somew开发者_如何学编程here, 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?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消