未验证 提交 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 ...@@ -30,6 +30,12 @@ private class WorkspaceHost : ForegroundThreadAffinitizedObject, IVisualStudioWo
// gone. // gone.
private SolutionId _currentSolutionId; 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) public WorkspaceHost(VisualStudioWorkspaceImpl workspace, KeepAliveSession session)
{ {
_workspace = workspace; _workspace = workspace;
...@@ -57,9 +63,12 @@ private void RegisterPrimarySolution() ...@@ -57,9 +63,12 @@ private void RegisterPrimarySolution()
var storageLocation = _workspace.DeferredState?.ProjectTracker.GetWorkingFolderPath(_workspace.CurrentSolution); var storageLocation = _workspace.DeferredState?.ProjectTracker.GetWorkingFolderPath(_workspace.CurrentSolution);
_session.TryInvokeAsync( _currentRemoteWorkspaceNotificationTask = _currentRemoteWorkspaceNotificationTask.SafeContinueWithFromAsync(_ =>
nameof(IRemoteHostService.RegisterPrimarySolutionId), {
new object[] { solutionId, storageLocation }, CancellationToken.None).Wait(CancellationToken.None); return _session.TryInvokeAsync(
nameof(IRemoteHostService.RegisterPrimarySolutionId),
new object[] { solutionId, storageLocation }, CancellationToken.None);
}, CancellationToken.None, TaskScheduler.Default);
} }
public void OnBeforeWorkingFolderChange() public void OnBeforeWorkingFolderChange()
...@@ -87,10 +96,18 @@ public void OnSolutionRemoved() ...@@ -87,10 +96,18 @@ public void OnSolutionRemoved()
private void UnregisterPrimarySolution( private void UnregisterPrimarySolution(
SolutionId solutionId, bool synchronousShutdown) SolutionId solutionId, bool synchronousShutdown)
{ {
_session.TryInvokeAsync( _currentRemoteWorkspaceNotificationTask = _currentRemoteWorkspaceNotificationTask.SafeContinueWith(_ =>
nameof(IRemoteHostService.UnregisterPrimarySolutionId), {
new object[] { solutionId, synchronousShutdown }, return _session.TryInvokeAsync(
CancellationToken.None).Wait(CancellationToken.None); nameof(IRemoteHostService.UnregisterPrimarySolutionId),
new object[] { solutionId, synchronousShutdown },
CancellationToken.None);
}, CancellationToken.None, TaskScheduler.Default);
if (synchronousShutdown)
{
_currentRemoteWorkspaceNotificationTask.Wait();
}
} }
public void ClearSolution() { } public void ClearSolution() { }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册