Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,15 @@ public async Task<bool> ShouldRunAsync(Task? waitExecutionCompletion, Cancellati
return false;
}

cancellationToken.Register(() => s_shutdownProcess = true);
using CancellationTokenRegistration registration = cancellationToken.Register(RequestShutdown);

if (waitExecutionCompletion is not null)
{
await waitExecutionCompletion.ConfigureAwait(false);
await _outputDevice.DisplayAsync(_outputDeviceDataProducer, new TextOutputDeviceData(ExtensionResources.HotReloadSessionCompleted), cancellationToken).ConfigureAwait(false);
}

try
{
await SemaphoreSlim.WaitAsync(cancellationToken).ConfigureAwait(false);
}
catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested)
{
// We're closing
}
await SemaphoreSlim.WaitAsync(CancellationToken.None).ConfigureAwait(false);

if (!_console.IsOutputRedirected && !IsClearNotSupported())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ public async Task ShouldRunAsync_WaiterIsBlockedAndCancellationIsRequested_Stops
await cancellationTokenSource.CancelAsync();

Assert.IsFalse(await shouldRunTask.WaitAsync(TimeSpan.FromSeconds(30), TestContext.CancellationToken));
Assert.IsTrue(IsShutdownRequested());
Assert.IsFalse(await handler.ShouldRunAsync(waitExecutionCompletion: null, CancellationToken.None));
}
#else
[TestMethod]
Expand Down
Loading