From 94ef69361916dbdc407f7beeff0ca49d0ba2b7bc Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 18 Jun 2025 15:11:38 -0700 Subject: [PATCH] Revert "Avoid acquiring the workspace lock on the UI thread if unneeded (#79025)" This reverts commit f479243b5639e0d052f8dff9babc449abe23da6b, reversing changes made to 438638eb1200d89f4f8e927648833a9d3dbeaddb. --- .../VisualStudioWorkspaceImpl.OpenFileTracker.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.OpenFileTracker.cs b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.OpenFileTracker.cs index 937222ccd41d8..88cf462acc8ed 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.OpenFileTracker.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.OpenFileTracker.cs @@ -369,15 +369,9 @@ public Task CheckForAddedFileBeingOpenMaybeAsync(bool useAsync, ImmutableArray= 2) - { - // Update the context on the UI thread as necessary. - var token = _asynchronousOperationListener.BeginAsyncOperation(nameof(UpdateContextAfterOpenAsync)); - UpdateContextAfterOpenAsync(newFileName).CompletesAsyncOperation(token); - } + // The files are now tied to the buffer, but let's schedule work to correctly update the context. + var token = _asynchronousOperationListener.BeginAsyncOperation(nameof(CheckForAddedFileBeingOpenMaybeAsync)); + UpdateContextAfterOpenAsync(newFileName).CompletesAsyncOperation(token); } } }