未验证 提交 abf60261 编写于 作者: A Abhitej John 提交者: GitHub

Merge pull request #24797 from dotnet/merges/dev15.6.x-to-dev15.7.x

Merge dev15.6.x to dev15.7.x
......@@ -30,6 +30,12 @@ private class WorkspaceHost : ForegroundThreadAffinitizedObject, IVisualStudioWo
// gone.
private SolutionId _currentSolutionId;
/// <summary>
/// A task that represents the most recent queued work to notify the remote process
/// about working folder paths.
/// </summary>
private Task _currentRemoteWorkspaceNotificationTask = Task.CompletedTask;
public WorkspaceHost(VisualStudioWorkspaceImpl workspace, KeepAliveSession session)
{
_workspace = workspace;
......@@ -57,9 +63,12 @@ private void RegisterPrimarySolution()
var storageLocation = _workspace.DeferredState?.ProjectTracker.GetWorkingFolderPath(_workspace.CurrentSolution);
_session.TryInvokeAsync(
nameof(IRemoteHostService.RegisterPrimarySolutionId),
new object[] { solutionId, storageLocation }, CancellationToken.None).Wait(CancellationToken.None);
_currentRemoteWorkspaceNotificationTask = _currentRemoteWorkspaceNotificationTask.SafeContinueWithFromAsync(_ =>
{
return _session.TryInvokeAsync(
nameof(IRemoteHostService.RegisterPrimarySolutionId),
new object[] { solutionId, storageLocation }, CancellationToken.None);
}, CancellationToken.None, TaskScheduler.Default);
}
public void OnBeforeWorkingFolderChange()
......@@ -87,10 +96,18 @@ public void OnSolutionRemoved()
private void UnregisterPrimarySolution(
SolutionId solutionId, bool synchronousShutdown)
{
_session.TryInvokeAsync(
nameof(IRemoteHostService.UnregisterPrimarySolutionId),
new object[] { solutionId, synchronousShutdown },
CancellationToken.None).Wait(CancellationToken.None);
_currentRemoteWorkspaceNotificationTask = _currentRemoteWorkspaceNotificationTask.SafeContinueWith(_ =>
{
return _session.TryInvokeAsync(
nameof(IRemoteHostService.UnregisterPrimarySolutionId),
new object[] { solutionId, synchronousShutdown },
CancellationToken.None);
}, CancellationToken.None, TaskScheduler.Default);
if (synchronousShutdown)
{
_currentRemoteWorkspaceNotificationTask.Wait();
}
}
public void ClearSolution() { }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册