private void UpdateHostProjectForeground(object state)
        {
            _foregroundDispatcher.AssertForegroundThread();

            var newHostProject = (HostProject)state;

            if (_currentHostProject == null && newHostProject == null)
            {
                // This is a no-op. This project isn't using Razor.
            }
            else if (_currentHostProject == null && newHostProject != null)
            {
                _projectSnapshotManager.ProjectAdded(newHostProject);
            }
            else if (_currentHostProject != null && newHostProject == null)
            {
                _projectSnapshotManager.ProjectRemoved(HostProject);
            }
            else
            {
                _projectSnapshotManager.ProjectConfigurationChanged(newHostProject);
            }

            _currentHostProject = newHostProject;
        }
        public async Task DisposeAsync()
        {
            _hostProjectManagerProxy.Changed -= HostProxyProjectManager_Changed;

            await _joinableTaskFactory.SwitchToMainThreadAsync();

            var projects = _projectSnapshotManager.Projects.ToArray();

            foreach (var project in projects)
            {
                try
                {
                    _projectSnapshotManager.ProjectRemoved(((DefaultProjectSnapshot)project).HostProject);
                }
                catch (Exception ex)
                {
                    _projectSnapshotManager.ReportError(ex, project);
                }
            }
        }