Assembly.Load duplicates the Assembly when loaded

2019-09-14 10:39发布

问题:

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: