AppDomain.AssemblyLoad alternative for AssemblyLoadContext #45155
-
I'm currently still using AppDomains (even if we have switched to .NET Core) since the AssemblyLoadContext does not provide an event AssemblyLoad as the AppDomain had it. I need this to intercept the loading and extract custom type and attribute information where I set up properties of the application. I could also live with a custom AssemblyLoadContext that acts as a default, but I cannot override the default AssemblyLoadContext. Is there any idea of how this can be done? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Maybe I'm misunderstanding the question, but you can still use
|
Beta Was this translation helpful? Give feedback.
-
@PathogenDavid: Thanks for the hint. I was under the impression AppDomain will slowly move to AssemblyLoadContext. Obviously this is wrong. Thanks a lot! |
Beta Was this translation helpful? Give feedback.
-
Can you load all assemblies in interest in your own context and simply get the notification by overriding |
Beta Was this translation helpful? Give feedback.
Maybe I'm misunderstanding the question, but you can still use
AppDomain.CurrentDomain
in .NET Core, you just can't create new ones. You can still use theAppDomain.CurrentDomain.AssemblyLoad
event on .NET Core.AssemblyLoadContext
is only meant to replace the isolation mechanisms provided by .NET Framework AppDomains, it doesn't replaceAppDomain
entirely. (IE: You shouldn't feel like you need to move all code fromAppDomain
toAssemblyLoadContext
.)