Domain Neutral Assemblies and AssemblyResolveEvent handler

Please read my blog domain neutral assemblies on background information.


We have learned that


The assembly can be shared, as long as all the available assemblies in the binding closure are the same in the two appdomains, and the missing assemblies in the binding closure are also the same.


The binding closure is evaluated by fusion.


But even if an assembly cannot be found by fusion, the application can still subscribe to AssemblyResolveEvent, and provide the assembly there.


That means the decision fusion makes isn’t necessary correct.


To fix this problem, for each assembly that cannot be found in the binding closure, loader will explicitly invoke the AssemblyResolveEvent handler if any. If the event handler returns an assembly, loader will refuse to share this assembly.


For AssemblyResolveEvent handler, this means the event handler can be called for assemblies that the application did not reference directly.

Comments (2)

  1. JohnL says:

    I’m currently handling AssemblyResolve on an appication I run in a seperate AppDomain. If that application then creates a new AppDomain, will the AssemblyResolve event "bubble up" to the top domain’s event handler?

  2. AssemblyResolveEvent handler is per domain. It won’t bubble up to the other domain.

Skip to main content