diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/DefaultEditorSettingsManagerInternalFactory.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/DefaultEditorSettingsManagerInternalFactory.cs index 0ad8908b90..a5a2f83750 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/DefaultEditorSettingsManagerInternalFactory.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/DefaultEditorSettingsManagerInternalFactory.cs @@ -12,6 +12,19 @@ namespace Microsoft.CodeAnalysis.Razor.Editor [ExportLanguageServiceFactory(typeof(EditorSettingsManagerInternal), RazorLanguage.Name)] internal class DefaultEditorSettingsManagerInternalFactory : ILanguageServiceFactory { + private readonly ForegroundDispatcher _foregroundDispatcher; + + [ImportingConstructor] + public DefaultEditorSettingsManagerInternalFactory(ForegroundDispatcher foregroundDispatcher) + { + if (foregroundDispatcher == null) + { + throw new ArgumentNullException(nameof(foregroundDispatcher)); + } + + _foregroundDispatcher = foregroundDispatcher; + } + public ILanguageService CreateLanguageService(HostLanguageServices languageServices) { if (languageServices == null) @@ -19,9 +32,7 @@ namespace Microsoft.CodeAnalysis.Razor.Editor throw new ArgumentNullException(nameof(languageServices)); } - var foregroundDispatcher = languageServices.WorkspaceServices.GetRequiredService(); - - return new DefaultEditorSettingsManagerInternal(foregroundDispatcher); + return new DefaultEditorSettingsManagerInternal(_foregroundDispatcher); } } } diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ForegroundDispatcher.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ForegroundDispatcher.cs index 7f7dac2130..bf9b0f59a4 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ForegroundDispatcher.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ForegroundDispatcher.cs @@ -8,7 +8,7 @@ using Microsoft.CodeAnalysis.Host; namespace Microsoft.CodeAnalysis.Razor { - internal abstract class ForegroundDispatcher : IWorkspaceService + internal abstract class ForegroundDispatcher { public abstract bool IsForegroundThread { get; } diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManagerFactory.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManagerFactory.cs index 82d0bcdb53..d82d82cd7c 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManagerFactory.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManagerFactory.cs @@ -14,11 +14,24 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem internal class DefaultProjectSnapshotManagerFactory : ILanguageServiceFactory { private readonly IEnumerable _triggers; + private readonly ForegroundDispatcher _foregroundDispatcher; [ImportingConstructor] public DefaultProjectSnapshotManagerFactory( + ForegroundDispatcher foregroundDispatcher, [ImportMany] IEnumerable triggers) { + if (foregroundDispatcher == null) + { + throw new ArgumentNullException(nameof(foregroundDispatcher)); + } + + if (triggers == null) + { + throw new ArgumentNullException(nameof(triggers)); + } + + _foregroundDispatcher = foregroundDispatcher; _triggers = triggers; } @@ -30,7 +43,7 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem } return new DefaultProjectSnapshotManager( - languageServices.WorkspaceServices.GetRequiredService(), + _foregroundDispatcher, languageServices.WorkspaceServices.GetRequiredService(), languageServices.GetRequiredService(), _triggers, diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotWorkerFactory.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotWorkerFactory.cs index c2dd1f4052..ca1946c19e 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotWorkerFactory.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotWorkerFactory.cs @@ -11,10 +11,23 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem [ExportLanguageServiceFactory(typeof(ProjectSnapshotWorker), RazorLanguage.Name)] internal class DefaultProjectSnapshotWorkerFactory : ILanguageServiceFactory { + private readonly ForegroundDispatcher _foregroundDispatcher; + + [ImportingConstructor] + public DefaultProjectSnapshotWorkerFactory(ForegroundDispatcher foregroundDispatcher) + { + if (foregroundDispatcher == null) + { + throw new System.ArgumentNullException(nameof(foregroundDispatcher)); + } + + _foregroundDispatcher = foregroundDispatcher; + } + public ILanguageService CreateLanguageService(HostLanguageServices languageServices) { return new DefaultProjectSnapshotWorker( - languageServices.WorkspaceServices.GetRequiredService(), + _foregroundDispatcher, languageServices.GetRequiredService(), languageServices.GetRequiredService()); } diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactoryFactory.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactoryFactory.cs index e8d2f426bc..7657e1599f 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactoryFactory.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactoryFactory.cs @@ -14,16 +14,23 @@ namespace Microsoft.VisualStudio.Editor.Razor [ExportLanguageServiceFactory(typeof(BraceSmartIndenterFactory), RazorLanguage.Name, ServiceLayer.Default)] internal class DefaultBraceSmartIndenterFactoryFactory : ILanguageServiceFactory { + private readonly ForegroundDispatcher _foregroundDispatcher; private readonly IEditorOperationsFactoryService _editorOperationsFactory; [ImportingConstructor] - public DefaultBraceSmartIndenterFactoryFactory(IEditorOperationsFactoryService editorOperationsFactory) + public DefaultBraceSmartIndenterFactoryFactory(ForegroundDispatcher foregroundDispatcher, IEditorOperationsFactoryService editorOperationsFactory) { + if (foregroundDispatcher == null) + { + throw new ArgumentNullException(nameof(foregroundDispatcher)); + } + if (editorOperationsFactory == null) { throw new ArgumentNullException(nameof(editorOperationsFactory)); } + _foregroundDispatcher = foregroundDispatcher; _editorOperationsFactory = editorOperationsFactory; } @@ -34,8 +41,7 @@ namespace Microsoft.VisualStudio.Editor.Razor throw new ArgumentNullException(nameof(languageServices)); } - var dispatcher = languageServices.WorkspaceServices.GetRequiredService(); - return new DefaultBraceSmartIndenterFactory(dispatcher, _editorOperationsFactory); + return new DefaultBraceSmartIndenterFactory(_foregroundDispatcher, _editorOperationsFactory); } } } diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManagerFactory.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManagerFactory.cs index 3cb0ead39a..480374c4f8 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManagerFactory.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManagerFactory.cs @@ -13,6 +13,19 @@ namespace Microsoft.VisualStudio.Editor.Razor [ExportLanguageServiceFactory(typeof(ImportDocumentManager), RazorLanguage.Name, ServiceLayer.Default)] internal class DefaultImportDocumentManagerFactory : ILanguageServiceFactory { + private readonly ForegroundDispatcher _foregroundDispatcher; + + [ImportingConstructor] + public DefaultImportDocumentManagerFactory(ForegroundDispatcher foregroundDispatcher) + { + if (foregroundDispatcher == null) + { + throw new ArgumentNullException(nameof(foregroundDispatcher)); + } + + _foregroundDispatcher = foregroundDispatcher; + } + public ILanguageService CreateLanguageService(HostLanguageServices languageServices) { if (languageServices == null) @@ -20,13 +33,12 @@ namespace Microsoft.VisualStudio.Editor.Razor throw new ArgumentNullException(nameof(languageServices)); } - var dispatcher = languageServices.WorkspaceServices.GetRequiredService(); var errorReporter = languageServices.WorkspaceServices.GetRequiredService(); var fileChangeTrackerFactory = languageServices.GetRequiredService(); var templateEngineFactoryService = languageServices.GetRequiredService(); return new DefaultImportDocumentManager( - dispatcher, + _foregroundDispatcher, errorReporter, fileChangeTrackerFactory, templateEngineFactoryService); diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorDocumentManagerFactory.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorDocumentManagerFactory.cs index 834092ae72..593bd8fb35 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorDocumentManagerFactory.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorDocumentManagerFactory.cs @@ -13,16 +13,23 @@ namespace Microsoft.VisualStudio.Editor.Razor [ExportLanguageServiceFactory(typeof(RazorDocumentManager), RazorLanguage.Name, ServiceLayer.Default)] internal class DefaultRazorDocumentManagerFactory : ILanguageServiceFactory { + private readonly ForegroundDispatcher _foregroundDispatcher; private readonly RazorEditorFactoryService _editorFactoryService; [ImportingConstructor] - public DefaultRazorDocumentManagerFactory(RazorEditorFactoryService editorFactoryService) + public DefaultRazorDocumentManagerFactory(ForegroundDispatcher foregroundDispatcher, RazorEditorFactoryService editorFactoryService) { + if (foregroundDispatcher == null) + { + throw new ArgumentNullException(nameof(foregroundDispatcher)); + } + if (editorFactoryService == null) { throw new ArgumentNullException(nameof(editorFactoryService)); } + _foregroundDispatcher = foregroundDispatcher; _editorFactoryService = editorFactoryService; } @@ -33,10 +40,9 @@ namespace Microsoft.VisualStudio.Editor.Razor throw new ArgumentNullException(nameof(languageServices)); } - var dispatcher = languageServices.WorkspaceServices.GetRequiredService(); var projectService = languageServices.GetRequiredService(); - return new DefaultRazorDocumentManager(dispatcher, _editorFactoryService, projectService); + return new DefaultRazorDocumentManager(_foregroundDispatcher, _editorFactoryService, projectService); } } } diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactoryFactory.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactoryFactory.cs index a43d02eb98..684d858582 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactoryFactory.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactoryFactory.cs @@ -16,16 +16,23 @@ namespace Microsoft.VisualStudio.Editor.Razor [ExportLanguageServiceFactory(typeof(VisualStudioDocumentTrackerFactory), RazorLanguage.Name, ServiceLayer.Default)] internal class DefaultVisualStudioDocumentTrackerFactoryFactory : ILanguageServiceFactory { + private readonly ForegroundDispatcher _foregroundDispatcher; private readonly ITextDocumentFactoryService _textDocumentFactory; [ImportingConstructor] - public DefaultVisualStudioDocumentTrackerFactoryFactory(ITextDocumentFactoryService textDocumentFactory) + public DefaultVisualStudioDocumentTrackerFactoryFactory(ForegroundDispatcher foregroundDispatcher, ITextDocumentFactoryService textDocumentFactory) { + if (foregroundDispatcher == null) + { + throw new ArgumentNullException(nameof(foregroundDispatcher)); + } + if (textDocumentFactory == null) { throw new ArgumentNullException(nameof(textDocumentFactory)); } + _foregroundDispatcher = foregroundDispatcher; _textDocumentFactory = textDocumentFactory; } @@ -36,14 +43,13 @@ namespace Microsoft.VisualStudio.Editor.Razor throw new ArgumentNullException(nameof(languageServices)); } - var dispatcher = languageServices.WorkspaceServices.GetRequiredService(); var projectManager = languageServices.GetRequiredService(); var editorSettingsManager = languageServices.GetRequiredService(); var projectService = languageServices.GetRequiredService(); var importDocumentManager = languageServices.GetRequiredService(); return new DefaultVisualStudioDocumentTrackerFactory( - dispatcher, + _foregroundDispatcher, projectManager, editorSettingsManager, projectService, diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs index cdbdafd818..d1f2d94cdc 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs @@ -13,6 +13,18 @@ namespace Microsoft.VisualStudio.Editor.Razor [ExportLanguageServiceFactory(typeof(VisualStudioRazorParserFactory), RazorLanguage.Name, ServiceLayer.Default)] internal class DefaultVisualStudioRazorParserFactoryFactory : ILanguageServiceFactory { + private readonly ForegroundDispatcher _foregroundDispatcher; + + [ImportingConstructor] + public DefaultVisualStudioRazorParserFactoryFactory(ForegroundDispatcher foregroundDispatcher) + { + if (foregroundDispatcher == null) + { + throw new ArgumentNullException(nameof(foregroundDispatcher)); + } + + _foregroundDispatcher = foregroundDispatcher; + } public ILanguageService CreateLanguageService(HostLanguageServices languageServices) { if (languageServices == null) @@ -21,13 +33,12 @@ namespace Microsoft.VisualStudio.Editor.Razor } var workspaceServices = languageServices.WorkspaceServices; - var dispatcher = workspaceServices.GetRequiredService(); var errorReporter = workspaceServices.GetRequiredService(); var completionBroker = languageServices.GetRequiredService(); var templateEngineFactoryService = languageServices.GetRequiredService(); return new DefaultVisualStudioRazorParserFactory( - dispatcher, + _foregroundDispatcher, errorReporter, completionBroker, templateEngineFactoryService); diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorTextViewConnectionListener.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorTextViewConnectionListener.cs index 9bc492047b..040bbb5adc 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/RazorTextViewConnectionListener.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorTextViewConnectionListener.cs @@ -20,14 +20,14 @@ namespace Microsoft.VisualStudio.Editor.Razor private readonly RazorDocumentManager _documentManager; [ImportingConstructor] - public RazorTextViewConnectionListener(VisualStudioWorkspaceAccessor workspaceAccessor) + public RazorTextViewConnectionListener(ForegroundDispatcher foregroundDispatcher, VisualStudioWorkspaceAccessor workspaceAccessor) { if (workspaceAccessor == null) { throw new ArgumentNullException(nameof(workspaceAccessor)); } - _foregroundDispatcher = workspaceAccessor.Workspace.Services.GetRequiredService(); + _foregroundDispatcher = foregroundDispatcher; var languageServices = workspaceAccessor.Workspace.Services.GetLanguageServices(RazorLanguage.Name); _documentManager = languageServices.GetRequiredService(); diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs index e4253e2ab7..4ecc2a7230 100644 --- a/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs @@ -17,15 +17,22 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor internal class DefaultFileChangeTrackerFactoryFactory : ILanguageServiceFactory { private readonly IVsFileChangeEx _fileChangeService; + private readonly ForegroundDispatcher _foregroundDispatcher; [ImportingConstructor] - public DefaultFileChangeTrackerFactoryFactory(SVsServiceProvider serviceProvider) + public DefaultFileChangeTrackerFactoryFactory(ForegroundDispatcher foregroundDispatcher, SVsServiceProvider serviceProvider) { + if (foregroundDispatcher == null) + { + throw new ArgumentNullException(nameof(foregroundDispatcher)); + } + if (serviceProvider == null) { throw new ArgumentNullException(nameof(serviceProvider)); } + _foregroundDispatcher = foregroundDispatcher; _fileChangeService = serviceProvider.GetService(typeof(SVsFileChangeEx)) as IVsFileChangeEx; } @@ -36,9 +43,8 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor throw new ArgumentNullException(nameof(languageServices)); } - var foregroundDispatcher = languageServices.WorkspaceServices.GetRequiredService(); var errorReporter = languageServices.WorkspaceServices.GetRequiredService(); - return new DefaultFileChangeTrackerFactory(foregroundDispatcher, errorReporter, _fileChangeService); + return new DefaultFileChangeTrackerFactory(_foregroundDispatcher, errorReporter, _fileChangeService); } } } diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs index e0f8400e27..6b80023b68 100644 --- a/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs @@ -1,16 +1,15 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Composition; +using System.ComponentModel.Composition; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Razor; using Microsoft.VisualStudio.Shell; namespace Microsoft.VisualStudio.LanguageServices.Razor { - [Shared] - [ExportWorkspaceService(typeof(ForegroundDispatcher), ServiceLayer.Host)] + [System.Composition.Shared] + [Export(typeof(ForegroundDispatcher))] internal class VisualStudioForegroundDispatcher : ForegroundDispatcher { public override TaskScheduler BackgroundScheduler { get; } = TaskScheduler.Default; diff --git a/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs index 54d708b118..d30ae0e667 100644 --- a/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs +++ b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs @@ -14,6 +14,19 @@ namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor [ExportLanguageServiceFactory(typeof(FileChangeTrackerFactory), RazorLanguage.Name, ServiceLayer.Default)] internal class DefaultFileChangeTrackerFactoryFactory : ILanguageServiceFactory { + private readonly ForegroundDispatcher _foregroundDispatcher; + + [ImportingConstructor] + public DefaultFileChangeTrackerFactoryFactory(ForegroundDispatcher foregroundDispatcher) + { + if (foregroundDispatcher == null) + { + throw new ArgumentNullException(nameof(foregroundDispatcher)); + } + + _foregroundDispatcher = foregroundDispatcher; + } + public ILanguageService CreateLanguageService(HostLanguageServices languageServices) { if (languageServices == null) @@ -21,9 +34,7 @@ namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor throw new ArgumentNullException(nameof(languageServices)); } - var foregroundDispatcher = languageServices.WorkspaceServices.GetRequiredService(); - var errorReporter = languageServices.WorkspaceServices.GetRequiredService(); - return new DefaultFileChangeTrackerFactory(foregroundDispatcher); + return new DefaultFileChangeTrackerFactory(_foregroundDispatcher); } } } diff --git a/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectBuildChangeTrigger.cs b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectBuildChangeTrigger.cs index 88a112c84c..3d36a2dae6 100644 --- a/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectBuildChangeTrigger.cs +++ b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectBuildChangeTrigger.cs @@ -19,14 +19,19 @@ namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor private ProjectSnapshotManagerBase _projectManager; [ImportingConstructor] - public ProjectBuildChangeTrigger(VisualStudioWorkspaceAccessor workspaceAccessor) + public ProjectBuildChangeTrigger(ForegroundDispatcher foregroundDispatcher, VisualStudioWorkspaceAccessor workspaceAccessor) { + if (foregroundDispatcher == null) + { + throw new ArgumentNullException(nameof(foregroundDispatcher)); + } + if (workspaceAccessor == null) { throw new ArgumentNullException(nameof(workspaceAccessor)); } - _foregroundDispatcher = workspaceAccessor.Workspace.Services.GetRequiredService(); + _foregroundDispatcher = foregroundDispatcher; var languageServices = workspaceAccessor.Workspace.Services.GetLanguageServices(RazorLanguage.Name); _projectService = languageServices.GetRequiredService(); diff --git a/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs index 32a5939dfd..789171cf05 100644 --- a/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs +++ b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs @@ -1,15 +1,14 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.Composition; +using System.ComponentModel.Composition; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Razor; namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor { - [Shared] - [ExportWorkspaceService(typeof(ForegroundDispatcher), ServiceLayer.Host)] + [System.Composition.Shared] + [Export(typeof(ForegroundDispatcher))] internal class VisualStudioForegroundDispatcher : ForegroundDispatcher { public override TaskScheduler BackgroundScheduler { get; } = TaskScheduler.Default;