问题
I currently have a problem where if I set up a new App Domain and use AppDomain.Load
, The Assembly gets loaded twice (Once into the new App Domain, and once into the default App Domain)
The code I am using to load the Assembly is as follows:
AppDomain dom = AppDomain.CreateDomain(_dllname);
AssemblyName assemblyName = new AssemblyName();
assemblyName.CodeBase = directory + _dllname;
Assembly a = dom.Load(assemblyName);
When I use this code the Assembly
loads correctly into my new AppDomain
(with the same name as the dll) but for some reason, always loads into the default AppDomain
(in this occasion, IQUS_Main.vshost.exe
)
Here is a screenshot of the issue, immediately after the dom.Load
line:
来源:https://stackoverflow.com/questions/40213755/assembly-load-duplicates-the-assembly-when-loaded-into-a-new-appdomain