Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try fixing the PTVS crash #8066

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Build/debugpy-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.7
1.8.8
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ public override async Task CheckAsync() {
Context = InfoBarContexts.Project;
MissingEnvName = null;

if (Project == null || Project.IsDisposed) {
return;
}

if (Project.GetProjectProperty(PythonConstants.SuppressEnvironmentCreationPrompt).IsTrue()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ internal partial class PythonProjectNode :

private bool _infoBarCheckTriggered = false;
private bool _asyncInfoBarCheckTriggered = false;
private bool _isDisposed = false;
private readonly CondaEnvCreateInfoBar _condaEnvCreateInfoBar;
private readonly VirtualEnvCreateInfoBar _virtualEnvCreateInfoBar;
private readonly PackageInstallInfoBar _packageInstallInfoBar;
Expand All @@ -95,6 +96,8 @@ internal partial class PythonProjectNode :
private readonly SemaphoreSlim _recreatingAnalyzer = new SemaphoreSlim(1);
private bool _isRefreshingInterpreters = false;

public bool IsDisposed => _isDisposed;

public event EventHandler LanguageServerInterpreterChanged;

public event EventHandler LanguageServerSearchPathsChanged;
Expand Down Expand Up @@ -1035,6 +1038,12 @@ public void AddActionOnClose(object key, Action<object> action) {
}

protected override void Dispose(bool disposing) {
if (_isDisposed) {
throw new ObjectDisposedException(nameof(PythonProjectNode));
}

_isDisposed = true;

if (disposing) {
var actions = _actionsOnClose;
_actionsOnClose = null;
Expand Down Expand Up @@ -1082,7 +1091,6 @@ protected override void Dispose(bool disposing) {

_recreatingAnalyzer.Dispose();
}

base.Dispose(disposing);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "ptvs",
"private": true,
"devDependencies": {
"@pylance/pylance": "2024.10.1"
"@pylance/pylance": "2024.11.1"
}
}