I have a situation where AppDomain.CurrentDomain.AssemblyResolve
is called for an assembly that has already been loaded into the current domain using Assembly.Load(myAssemblyMemStream.ToArray())
.
Why is that?
I need to do the following to get it to work. How does this differ from what .NET does automatically?
Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
return AppDomain.CurrentDomain
.GetAssemblies()
.First(x => x.FullName == args.Name);
}
Load contexts http://blogs.msdn.com/b/suzcook/archive/2003/05/29/57143.aspx. Loading the byte[] doesn't cause assemblies in other load contexts to be able to see it. It is a security feature.