azos
azos copied to clipboard
Core-only problem loading ad-hock non-ref plugin assemblies
We need to load assemblies which are not referenced by application entry assembly. The core does not load it automatically. He is the trick that fixes:
... in main
System.Runtime.Loader.AssemblyLoadContext.Default.Resolving += RefAssemblyResolver;
private static Assembly RefAssemblyResolver(System.Runtime.Loader.AssemblyLoadContext loadContext, System.Reflection.AssemblyName asmName)
{
//System.Console.WriteLine("NAME===============================: {0}".Args(asmName.Name));
return Assembly.LoadFrom("{0}.dll".Args(asmName.Name));
}
Why is this not built-in to your package? itc? etc??
Re: https://docs.microsoft.com/en-us/dotnet/core/dependency-loading/understanding-assemblyloadcontext not sure this belongs into system code at all, as it is very app-specific
Still not convinced this needs to go into app code..