Hi,
In the full .NET Framework I cam subscribe to the AppDomain.AssemblyResolve event and handle the discovery of assemblies that have failed to load.
If .NET Core fails to find an assembly how can this be handled? There's a Resolving event available via AssemblyLoadContext.Default but this isn't really what I'm after. I thought the following code might do the the job but of course "var assembly = assemblyLoadContext.LoadFromAssemblyName(assemblyName);" results in a cyclic loop.
Does anyone have any ideas?
AssemblyLoadContext.Default.Resolving += this.OnAssemblyResolve; protected virtual Assembly OnAssemblyResolve(AssemblyLoadContext assemblyLoadContext, AssemblyName assemblyName) { var assembly = assemblyLoadContext.LoadFromAssemblyName(assemblyName); if (assembly == null) { assembly = this.HandleDiscovery(assemblyName); } return assembly; }