Exemple #1
0
        public void Dispose()
        {
            if (RemotePlugin != null)
            {
                try
                {
                    RemotePlugin.Dispose();
                }
                catch (Exception ex)
                {
                    _errorHandlingService.LogError("Error disposing remote plugin for " + _startupInfo.Name, ex);
                }
            }

            if (_pluginLoader != null)
            {
                try
                {
                    _pluginLoader.Dispose();
                }
                catch (Exception ex)
                {
                    _errorHandlingService.LogError("Error disposing plugin loader for " + _startupInfo.Name, ex);
                }
            }

            // this can take some time if we have many plugins; should be made asynchronous
            if (Process != null)
            {
                Process.WaitForExit(5000);
                if (!Process.HasExited)
                {
                    _errorHandlingService.LogError("Remote process for " + _startupInfo.Name + " did not exit within timeout period and will be terminated", null);
                    Process.Kill();
                }
            }
        }