-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
On .NET Framework the AppDomain.AssemblyResolve event offered the ResolveEventArgs.RequestingAssembly so that the resolver can consider the party requesting the assembly to help determine what assembly to load. In particular this would be useful to help find the assembly to be loaded by looking in the same directory as the requesting assembly. This in fact is the behavior of .NET Framework itself, which even without a custom resolver will load assemblies based on codebase path, base directory, probing paths, and the directory containing the requesting assembly.
On .NET Core I'm trying to emulate .NET Framework assembly loading behavior. I have implemented an AssemblyLoadContext.Resolving handler that considers the content of an .exe.config file including probing directories, codebase paths, binding redirects, etc. But I'm getting assembly load failures in cases where a .dll was only found on .NET Framework because the dll was in the same directory as the dll that requested it.
Because the ALC.Resolving event doesn't disclose who the requesting assembly is, I can't emulate .NET Framework behavior here. Why was this information left out of the new event? Presumably if I hooked the AppDomain.AssemblyResolve even on .NET Core I guess I'd still get the data, but I'm trying to use ALC APIs exclusively so that it works in any ALC instead of only the default one as using the AppDomain APIs would presumably limit me to.