Is there a way in .NET to enable Assembly.Load?

Is there a way in .NET to enable Assembly.Load? I know that while working under the debugger, it gives you a nice message, for example, "Loaded" assembly X ", but I want to get the assembly load log of my running application outside the debugger, preferably by mixing with Debug / Trace log messages.

I track various things in my application, and I basically want to know what action caused the particular assembly to load.

+3
source share
3 answers

Get the AppDomain for your application and attach it to the AssemblyLoad event.

Example (C #):

AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(OnAssemblyLoad);
+13
source

Fusion Log Viewer is your friend.

[edit] , AssemblyResolve [edit]

+4

MS Visual Studio .

Select "Load Modules" from the context menu of the output window in MS Visual Studio and display something like:

Loaded 'C:\Windows\assembly\GAC_64\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll'
Loaded 'C:\projects\trunk\bin\Tester.exe', Symbols loaded.
Loaded 'C:\projects\trunk\bin\log4net.dll'
+2
source

Source: https://habr.com/ru/post/1697799/


All Articles