public void Dispose() { _site.MustBeCalledFromUIThread(); _deferredModulesChangeNotification.Dispose(); _deferredWorkspaceFileChangeNotification.Dispose(); _recreatingAnalyzer.Dispose(); _pythonWorkspace.ActiveInterpreterChanged -= OnActiveInterpreterChanged; _pythonWorkspace.SearchPathsSettingChanged -= OnSearchPathsChanged; if (_analyzer != null) { _analyzer.ClearAllTasks(); if (_analyzer.RemoveUser()) { _analyzer.AbnormalAnalysisExit -= OnAnalysisProcessExited; _analyzer.Dispose(); } _analyzer = null; } UnsubscribePackageManagers(); var watcher = _workspaceFileWatcher; _workspaceFileWatcher = null; watcher?.Dispose(); }