private IHopeRunner InstantiateRunner(string dllName, AppDomain domain) { IHopeRunner runner = domain.CreateInstanceAndUnwrap(dllName, "HopeRunner.Runner") as IHopeRunner; runner.Processing += (sender, args) => Processing.Fire(this, args); return(runner); }
public void Unload() { if (appDomain != null) { appDomain.DomainUnload -= AppDomainUnloading; Assert.SilentTry(() => AppDomain.Unload(appDomain)); appDomain = null; appDomainRunner = null; } }
public void Load(string fullDllName) { if (appDomainRunner == null) { string dll = fullDllName.LeftOf("."); appDomain = CreateAppDomain(dll); appDomainRunner = InstantiateRunner(dll, appDomain); appDomain.DomainUnload += AppDomainUnloading; } }
/// <summary> /// Unexpected app domain unload. Unfortunately, the stack trace doesn't indicate where this is coming from! /// </summary> private void AppDomainUnloading(object sender, EventArgs e) { appDomain = null; appDomainRunner = null; }