private void Shutdown() { if (_scriptRuntime != null) { if (BeforeUnload != null) { // アンロード時に出るExceptionはとりあえず全部握りつぶす foreach (EventHandler handler in BeforeUnload.GetInvocationList()) { try { handler.Invoke(this, EventArgs.Empty); } catch (Exception e) { CurrentSession.Logger.Error("Exception at BeforeUnload(Ignore): " + e.Message); } } } _scriptRuntime.Shutdown(); _scriptRuntime = null; BeforeUnload = null; _sessionProxy.RemoveAllEvents(); _serverProxy.RemoveAllEvents(); } }
public void Unload() { if (IsLoaded) { BeforeUnload?.Invoke(this); if (_managedDomain) { AppDomain.Unload(_domain); } _domain = null; } }