Last post Sep 11, 2019 05:16 PM by maherjendoubi
Sep 11, 2019 12:45 PM|Hadad82|LINK
I'm developing .net core 2.2 web API, I'm using a separate custom assemblyLoadContext to load my controllers at run time. Each controller(or service)loaded in separate Context but I get below error in resolving SDK assembly!
System.IO.FileLoadException: 'Could not load file or assembly 'System.Data.Common, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. An operation is not legal in the current state. (Exception from HRESULT: 0x80131509)'
when I use the Default context to load all assemblies everything works well.
in the design document of AssemblyLoadContext microsoft mentioned that if resolving assembly failed in the costume context core will fallback to default context which is not happened in my case.
Sep 11, 2019 05:07 PM|bruce (sqlwork.com)|LINK
you should load all dependent assemblies in the default context, as the caller probably does not know about your custom context.
unlike old .net which a process could have separate appdomains that you loaded assemblies in, .net core does not. assemblies are just loaded into the process. the AssemblyContext is a simple technique to dynamically load an assembly opaquely.
Sep 11, 2019 05:16 PM|maherjendoubi|LINK
System.Data.Common is not compatible with the version 2.2 of .NET Core :