我写了一个简单的行来创建单独的 AppDomain,但是得到了 FileNotFound 的奇怪异常:无法加载文件或程序集...考虑到必要的参数已填充,这个问题让我很困惑:
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase = Assembly.GetExecutingAssembly().CodeBase;
Evidence evidence = new Evidence(AppDomain.CurrentDomain.Evidence);
evidence.AddAssembly(Assembly.GetExecutingAssembly().FullName);
evidence.AddHost(new Zone(SecurityZone.MyComputer));
AppDomain hostedAppDomain = AppDomain.CreateDomain("Demo", evidence, setup);
hostedAppDomain.AssemblyResolve += new ResolveEventHandler(hostedAppDomain_AssemblyResolve); **// Exception in this line**