Skip to content

Commit 2e4b22b

Browse files
authored
Fix integration tests, and razor, by using the correct cancellation token (#10301)
This reverts commit d76f5c5, humorously entitled "Check correct CancellationToken". Sorry @DustinCampbell 😁 What was happening was that when a project change was queued up, we cancelled any previous work that was in play. This used to check the disposal cancellation token, so we didn't try to release a semaphore that was disposed. The change to use the passed in cancellation token meant we never released the semaphore.
2 parents 2c422fe + 497f71a commit 2e4b22b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectWorkspaceStateGenerator.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ public void CancelUpdates()
109109

110110
private async Task UpdateWorkspaceStateAsync(Project? workspaceProject, IProjectSnapshot projectSnapshot, CancellationToken cancellationToken)
111111
{
112+
if (_disposeTokenSource.IsCancellationRequested)
113+
{
114+
return;
115+
}
116+
112117
try
113118
{
114119
// Only allow a single TagHelper resolver request to process at a time in order to reduce
@@ -172,7 +177,7 @@ await _projectManager
172177
{
173178
// Prevent ObjectDisposedException if we've disposed before we got here. The dispose method will release
174179
// anyway, so we're all good.
175-
if (!cancellationToken.IsCancellationRequested)
180+
if (!_disposeTokenSource.IsCancellationRequested)
176181
{
177182
_semaphore.Release();
178183
}

0 commit comments

Comments
 (0)