void IDisposable.Dispose()
        {
            if (!_isDisposed)
            {
                _isDisposed = true;
                _deferredTestChangeNotification.Dispose();

                if (_testFilesUpdateWatcher != null)
                {
                    _testFilesUpdateWatcher.FileChangedEvent -= OnWorkspaceFileChanged;
                    _testFilesUpdateWatcher.Dispose();
                    _testFilesUpdateWatcher = null;
                }

                if (_workspaceContextProvider != null)
                {
                    _workspaceContextProvider.WorkspaceClosed      -= OnWorkspaceClosed;
                    _workspaceContextProvider.WorkspaceInitialized -= OnWorkspaceLoaded;

                    if (_workspaceContextProvider.Workspace != null)
                    {
                        _workspaceContextProvider.Workspace.SearchPathsSettingChanged -= OnWorkspaceSettingsChange;
                        _workspaceContextProvider.Workspace.InterpreterSettingChanged -= OnWorkspaceSettingsChange;
                        _workspaceContextProvider.Workspace.TestSettingChanged        -= OnWorkspaceSettingsChange;
                    }
                }
            }
        }
Beispiel #2
0
        void IDisposable.Dispose()
        {
            if (!_isDisposed)
            {
                _isDisposed = true;
                _deferredTestChangeNotification.Dispose();
                _projectMap.Clear();
                _packageManagerEventSink.InstalledPackagesChanged -= OnInstalledPackagesChanged;
                _packageManagerEventSink.Dispose();

                if (_solutionListener != null)
                {
                    _solutionListener.ProjectLoaded    -= OnProjectLoaded;
                    _solutionListener.ProjectUnloading -= OnProjectUnloaded;
                    _solutionListener.ProjectClosing   -= OnProjectUnloaded;
                    _solutionListener.Dispose();
                }

                if (_testFilesUpdateWatcher != null)
                {
                    _testFilesUpdateWatcher.FileChangedEvent -= OnProjectItemChanged;
                    _testFilesUpdateWatcher.Dispose();
                    _testFilesUpdateWatcher = null;
                }

                if (_testFilesAddRemoveListener != null)
                {
                    _testFilesAddRemoveListener.TestFileChanged -= OnProjectItemChanged;
                    _testFilesAddRemoveListener.Dispose();
                    _testFilesAddRemoveListener = null;
                }
            }
        }