提交 32c0a66a 编写于 作者: S Sam Harwell

Fix inconsistent use of PinnedRemotableDataScope and the snapshot stream

上级 f634bef1
......@@ -63,7 +63,7 @@ protected override async Task<Session> TryCreateServiceSessionAsync(string servi
{
// get stream from service hub to communicate snapshot/asset related information
// this is the back channel the system uses to move data between VS and remote host
var snapshotStream = await _inprocServices.RequestServiceAsync(WellKnownServiceHubServices.SnapshotService, cancellationToken).ConfigureAwait(false);
var snapshotStream = getSnapshotAsync.Value == null ? null : await _inprocServices.RequestServiceAsync(WellKnownServiceHubServices.SnapshotService, cancellationToken).ConfigureAwait(false);
// get stream from service hub to communicate service specific information
// this is what consumer actually use to communicate information
......
......@@ -7,6 +7,7 @@
using System.Threading.Tasks;
using StreamJsonRpc;
using Microsoft.CodeAnalysis.Remote;
using Roslyn.Utilities;
namespace Microsoft.VisualStudio.LanguageServices.Remote
{
......@@ -22,6 +23,8 @@ internal class JsonRpcClient : IDisposable
public JsonRpcClient(
Stream stream, object callbackTarget, bool useThisAsCallback, CancellationToken cancellationToken)
{
Contract.Requires(stream != null);
var target = useThisAsCallback ? this : callbackTarget;
_cancellationToken = cancellationToken;
......
......@@ -72,6 +72,8 @@ internal class JsonRpcSession : RemoteHostClient.Session
CancellationToken cancellationToken) :
base(snapshot, cancellationToken)
{
Contract.Requires((snapshot == null) == (snapshotStreamOpt == null));
// get session id
_currentSessionId = Interlocked.Increment(ref s_sessionId);
......
......@@ -119,7 +119,7 @@ protected override async Task<Session> TryCreateServiceSessionAsync(string servi
{
// get stream from service hub to communicate snapshot/asset related information
// this is the back channel the system uses to move data between VS and remote host for solution related information
var snapshotStream = getSnapshotAsync.Value != null ? null : await RequestServiceAsync(_hubClient, WellKnownServiceHubServices.SnapshotService, _hostGroup, _timeout, cancellationToken).ConfigureAwait(false);
var snapshotStream = getSnapshotAsync.Value == null ? null : await RequestServiceAsync(_hubClient, WellKnownServiceHubServices.SnapshotService, _hostGroup, _timeout, cancellationToken).ConfigureAwait(false);
// get stream from service hub to communicate service specific information
// this is what consumer actually use to communicate information
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册