diff --git a/src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/LanguageServices/LanguageServiceHost.cs b/src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/LanguageServices/LanguageServiceHost.cs index 1a8f7b59e8..4a4dea9919 100644 --- a/src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/LanguageServices/LanguageServiceHost.cs +++ b/src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/LanguageServices/LanguageServiceHost.cs @@ -45,8 +45,6 @@ internal sealed class LanguageServiceHost : OnceInitializedOnceDisposedAsync, IP private readonly IUnconfiguredProjectTasksService _tasksService; private readonly ISafeProjectGuidService _projectGuidService; private readonly IProjectFaultHandlerService _projectFaultHandler; - private readonly JoinableTaskCollection _joinableTaskCollection; - private readonly JoinableTaskFactory _joinableTaskFactory; private readonly AsyncLazy _isEnabled; private DisposableBag? _disposables; @@ -88,10 +86,6 @@ public LanguageServiceHost( || await vsShell.IsPopulateSolutionCacheModeAsync(); }, threadingService.JoinableTaskFactory); - - _joinableTaskCollection = threadingService.JoinableTaskContext.CreateCollection(); - _joinableTaskCollection.DisplayName = "LanguageServiceHostTasks"; - _joinableTaskFactory = new JoinableTaskFactory(_joinableTaskCollection); } public Task LoadAsync() @@ -175,7 +169,7 @@ protected override async Task InitializeCoreAsync(CancellationToken cancellation linkOptions: DataflowOption.PropagateCompletion, cancellationToken: cancellationToken), - ProjectDataSources.JoinUpstreamDataSources(_joinableTaskFactory, _projectFaultHandler, _activeConfiguredProjectProvider, _activeConfigurationGroupSubscriptionService), + ProjectDataSources.JoinUpstreamDataSources(JoinableFactory, _projectFaultHandler, _activeConfiguredProjectProvider, _activeConfigurationGroupSubscriptionService), new DisposableDelegate(() => { @@ -211,7 +205,7 @@ async Task OnSlicesChangedAsync(IProjectVersionedValue<(ConfiguredProject Active Guid projectGuid = await _projectGuidService.GetProjectGuidAsync(cancellationToken); // New slice. Create a workspace for it. - workspace = _workspaceFactory.Create(source, slice, _joinableTaskCollection, _joinableTaskFactory, projectGuid, cancellationToken); + workspace = _workspaceFactory.Create(source, slice, JoinableCollection, JoinableFactory, projectGuid, cancellationToken); if (workspace is null) { @@ -282,7 +276,7 @@ public async Task WhenInitialized(CancellationToken token) { await ValidateEnabledAsync(token); - using (_joinableTaskCollection.Join()) + using (JoinableCollection.Join()) { await _firstPrimaryWorkspaceSet.Task.WithCancellation(token); } @@ -350,7 +344,7 @@ public async Task AfterLoadInitialConfigurationAsync() // Ensure the project is not considered loaded until our first publication. Task result = _tasksService.PrioritizedProjectLoadedInHostAsync(async () => { - using (_joinableTaskCollection.Join()) + using (JoinableCollection.Join()) { await WhenInitialized(_tasksService.UnloadCancellationToken); }