azos icon indicating copy to clipboard operation
azos copied to clipboard

Core-only problem loading ad-hock non-ref plugin assemblies

Open g8sun opened this issue 3 years ago • 2 comments

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??

g8sun avatar Jun 20 '21 22:06 g8sun

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

itadapter avatar Jun 20 '21 22:06 itadapter

Still not convinced this needs to go into app code..

itadapter avatar Jul 30 '21 18:07 itadapter