public static void DestroyResolver(AppDomainTypeResolver resolver) { if (resolver == null) throw new ArgumentNullException("resolver"); ThreadPool.QueueUserWorkItem(delegate { AppDomain.Unload(resolver.Domain); }); }
public static AppDomainTypeResolver GetIntoNewAppDomain(string baseDir) { AppDomainSetup info = new AppDomainSetup(); info.ApplicationBase = Environment.CurrentDirectory; AppDomain domain = AppDomain.CreateDomain("AppDomainTypeResolver", null, info, new PermissionSet(PermissionState.Unrestricted)); AppDomainTypeResolver resolver = (AppDomainTypeResolver)domain.CreateInstanceAndUnwrap(typeof(AppDomainTypeResolver).Assembly.FullName, typeof(AppDomainTypeResolver).FullName, false, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.CreateInstance, null, new object[] { domain, baseDir }, null, null, null); return(resolver); }
public static void DestroyResolver(AppDomainTypeResolver resolver) { if (resolver == null) { throw new ArgumentNullException("resolver"); } ThreadPool.QueueUserWorkItem(delegate { AppDomain.Unload(resolver.Domain); }); }