コード例 #1
0
        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();
            }
        }
コード例 #2
0
ファイル: AssemblyShim.cs プロジェクト: decay88/Shiminy
 public void Unload()
 {
     if (IsLoaded)
     {
         BeforeUnload?.Invoke(this);
         if (_managedDomain)
         {
             AppDomain.Unload(_domain);
         }
         _domain = null;
     }
 }