Skip to content

Commit 7f0b4b2

Browse files
committed
Remove cancellation support
AsyncLazy doesn't pass a cancellation token to the func. I tried to work around this with a CTS, but that doesn't work. If one caller cancels, it'll cancel all other callers, which isn't correct. Instead, we remove cancellation from the GetService calls, as these are cheap and cancellation is unlikely. Anyone waiting on the value would be correctly cancelled still.
1 parent c0b81f7 commit 7f0b4b2

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/UpToDate/UpToDateCheckHost.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ internal sealed class UpToDateCheckHost : IUpToDateCheckHost
1212
{
1313
private readonly IVsService<IVsAppId> _vsAppId;
1414
private readonly IVsService<IVsAppCommandLine> _vsAppCommandLine;
15-
1615
private readonly AsyncLazy<bool> _hasDesignTimeBuild;
17-
private readonly CancellationTokenSource _cancellationTokenSource = new();
1816

1917
[ImportingConstructor]
2018
public UpToDateCheckHost(
@@ -30,16 +28,12 @@ public UpToDateCheckHost(
3028

3129
public async ValueTask<bool> HasDesignTimeBuildsAsync(CancellationToken cancellationToken)
3230
{
33-
cancellationToken.Register(_cancellationTokenSource.Cancel);
34-
3531
return await _hasDesignTimeBuild.GetValueAsync(cancellationToken);
3632
}
3733

3834
private async Task<bool> HasDesignTimeBuildsInternalAsync()
3935
{
40-
CancellationToken token = _cancellationTokenSource.Token;
41-
42-
IVsAppCommandLine vsAppCommandLine = await _vsAppCommandLine.GetValueAsync(token);
36+
IVsAppCommandLine vsAppCommandLine = await _vsAppCommandLine.GetValueAsync();
4337

4438
if (ErrorHandler.Succeeded(vsAppCommandLine.GetOption("populateSolutionCache", out int populateSolutionCachePresent, out string _)))
4539
{
@@ -50,7 +44,7 @@ private async Task<bool> HasDesignTimeBuildsInternalAsync()
5044
}
5145
}
5246

53-
IVsAppId vsAppId = await _vsAppId.GetValueAsync(token);
47+
IVsAppId vsAppId = await _vsAppId.GetValueAsync();
5448

5549
if (ErrorHandler.Succeeded(vsAppId.GetProperty((int)__VSAPROPID10.VSAPROPID_IsInCommandLineMode, out object value)))
5650
{

0 commit comments

Comments
 (0)