Why is AssemblyResolve called when Assembly is in

2019-07-15 15:22发布

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);
}

1条回答
神经病院院长
2楼-- · 2019-07-15 15:59

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.

查看更多
登录 后发表回答