internal void UpdateRazorHostProject()
        {
            _ = _projectSnapshotManagerDispatcher.RunOnDispatcherThreadAsync(() =>
            {
                DetachCurrentRazorProjectHost();

                if (!_projectService.IsSupportedProject(_project))
                {
                    // Not a Razor compatible project.
                    return;
                }

                if (!TryGetProjectSnapshotManager(out var projectSnapshotManager))
                {
                    // Could not get a ProjectSnapshotManager for the current project.
                    return;
                }

                if (_project.IsCapabilityMatch(ExplicitRazorConfigurationCapability))
                {
                    // SDK >= 2.1
                    _razorProjectHost = new DefaultMacRazorProjectHost(_project, _projectSnapshotManagerDispatcher, projectSnapshotManager, _projectConfigurationFilePathStore, _languageServerFeatureOptions);
                    return;
                }

                // We're an older version of Razor at this point, SDK < 2.1
                _razorProjectHost = new FallbackMacRazorProjectHost(_project, _projectSnapshotManagerDispatcher, projectSnapshotManager, _projectConfigurationFilePathStore, _languageServerFeatureOptions);
            }, CancellationToken.None);
        }
 private void DetachCurrentRazorProjectHost()
 {
     _razorProjectHost?.Detach();
     _razorProjectHost = null;
 }