public static async Task <RemoteHostClient> CreateAsync(Workspace workspace, bool runCacheCleanup) { var inprocServices = new InProcRemoteServices(runCacheCleanup); // Create the RemotableDataJsonRpc before we create the remote host: this call implicitly sets up the remote IExperimentationService so that will be available for later calls var remotableDataRpc = new RemotableDataJsonRpc(workspace, inprocServices.Logger, await inprocServices.RequestServiceAsync(WellKnownServiceHubServices.SnapshotService).ConfigureAwait(false)); var remoteHostStream = await inprocServices.RequestServiceAsync(WellKnownRemoteHostServices.RemoteHostService).ConfigureAwait(false); var current = CreateClientId(Process.GetCurrentProcess().Id.ToString()); var instance = new InProcRemoteHostClient(current, workspace, inprocServices, new ReferenceCountedDisposable <RemotableDataJsonRpc>(remotableDataRpc), remoteHostStream); // make sure connection is done right string?telemetrySession = null; var uiCultureLCIDE = 0; var cultureLCID = 0; var host = await instance._endPoint.InvokeAsync <string>( nameof(IRemoteHostService.Connect), new object?[] { current, uiCultureLCIDE, cultureLCID, telemetrySession }, CancellationToken.None).ConfigureAwait(false); // TODO: change this to non fatal watson and make VS to use inproc implementation Contract.ThrowIfFalse(host == current.ToString()); instance.Started(); // return instance return(instance); }
public static async Task <RemoteHostClient> CreateAsync(Workspace workspace, bool runCacheCleanup) { var inprocServices = new InProcRemoteServices(runCacheCleanup); var remoteHostStream = await inprocServices.RequestServiceAsync(WellKnownServiceHubServices.RemoteHostService).ConfigureAwait(false); var current = CreateClientId(Process.GetCurrentProcess().Id.ToString()); var instance = new InProcRemoteHostClient(current, workspace, inprocServices, remoteHostStream); // make sure connection is done right string?telemetrySession = null; var uiCultureLCIDE = 0; var cultureLCID = 0; var host = await instance._endPoint.InvokeAsync <string>( nameof(IRemoteHostService.Connect), new object?[] { current, uiCultureLCIDE, cultureLCID, telemetrySession }, CancellationToken.None).ConfigureAwait(false); // TODO: change this to non fatal watson and make VS to use inproc implementation Contract.ThrowIfFalse(host == current.ToString()); instance.Started(); // return instance return(instance); }
public static async Task <RemoteHostClient> CreateAsync(Workspace workspace, bool runCacheCleanup, CancellationToken cancellationToken) { var inprocServices = new InProcRemoteServices(runCacheCleanup); var remoteHostStream = await inprocServices.RequestServiceAsync(WellKnownRemoteHostServices.RemoteHostService, cancellationToken).ConfigureAwait(false); var remotableDataRpc = new RemotableDataJsonRpc(workspace, inprocServices.Logger, await inprocServices.RequestServiceAsync(WellKnownServiceHubServices.SnapshotService, cancellationToken).ConfigureAwait(false)); var current = CreateClientId(Process.GetCurrentProcess().Id.ToString()); var instance = new InProcRemoteHostClient(current, workspace, inprocServices, new ReferenceCountedDisposable <RemotableDataJsonRpc>(remotableDataRpc), remoteHostStream); // make sure connection is done right var telemetrySession = default(string); var uiCultureLCIDE = 0; var cultureLCID = 0; var host = await instance._rpc.InvokeAsync <string>(nameof(IRemoteHostService.Connect), current, uiCultureLCIDE, cultureLCID, telemetrySession).ConfigureAwait(false); // TODO: change this to non fatal watson and make VS to use inproc implementation Contract.ThrowIfFalse(host == current.ToString()); instance.Started(); // return instance return(instance); }
private InProcRemoteHostClient( HostWorkspaceServices services, InProcRemoteServices inprocServices, RemoteServiceCallbackDispatcherRegistry callbackDispatchers) { _workspaceServices = services; _callbackDispatchers = callbackDispatchers; _inprocServices = inprocServices; }
private InProcRemoteHostClient(Workspace workspace, InProcRemoteServices inprocServices, Stream stream) : base(workspace) { _inprocServices = inprocServices; _rpc = JsonRpc.Attach(stream, target: this); // handle disconnected situation _rpc.Disconnected += OnRpcDisconnected; }
public static RemoteHostClient Create(HostWorkspaceServices services, RemoteServiceCallbackDispatcherRegistry callbackDispatchers, TraceListener?traceListener, RemoteHostTestData testData) { var inprocServices = new InProcRemoteServices(services, traceListener, testData); var instance = new InProcRemoteHostClient(services, inprocServices, callbackDispatchers); instance.Started(); // return instance return(instance); }
private InProcRemoteHostClient(Workspace workspace, InProcRemoteServices inprocServices, Stream stream) : base(workspace) { _inprocServices = inprocServices; _rpc = JsonRpc.Attach(stream, target: this); // handle disconnected situation _rpc.Disconnected += OnRpcDisconnected; }
private InProcRemoteHostClient(Workspace workspace, InProcRemoteServices inprocServices, Stream stream) : base(workspace) { _inprocServices = inprocServices; _rpc = JsonRpc.Attach(stream, target: this); _rpc.JsonSerializer.Converters.Add(AggregateJsonConverter.Instance); // handle disconnected situation _rpc.Disconnected += OnRpcDisconnected; }
private InProcRemoteHostClient(Workspace workspace, InProcRemoteServices inprocServices, Stream stream) : base(workspace) { _inprocServices = inprocServices; _rpc = JsonRpc.Attach(stream, target: this); _rpc.JsonSerializer.Converters.Add(AggregateJsonConverter.Instance); // handle disconnected situation _rpc.Disconnected += OnRpcDisconnected; }
private InProcRemoteHostClient(Workspace workspace, InProcRemoteServices inprocServices, Stream stream) : base(workspace) { _inprocServices = inprocServices; _rpc = new JsonRpc(new JsonRpcMessageHandler(stream, stream), target: this); _rpc.JsonSerializer.Converters.Add(AggregateJsonConverter.Instance); // handle disconnected situation _rpc.Disconnected += OnRpcDisconnected; _rpc.StartListening(); }
private InProcRemoteHostClient( HostWorkspaceServices services, InProcRemoteServices inprocServices, Stream stream) { _workspaceServices = services; _logger = new TraceSource("Default"); _inprocServices = inprocServices; _endPoint = new RemoteEndPoint(stream, _logger, incomingCallTarget: this); _endPoint.Disconnected += OnDisconnected; _endPoint.StartListening(); }
private InProcRemoteHostClient( string clientId, Workspace workspace, InProcRemoteServices inprocServices, Stream stream) : base(workspace) { ClientId = clientId; _inprocServices = inprocServices; _endPoint = new RemoteEndPoint(stream, inprocServices.Logger, incomingCallTarget: this); _endPoint.Disconnected += OnDisconnected; _endPoint.StartListening(); }
private InProcRemoteHostClient( string clientId, Workspace workspace, InProcRemoteServices inprocServices, ReferenceCountedDisposable <RemotableDataJsonRpc> remotableDataRpc, Stream stream) : base(workspace) { Contract.ThrowIfNull(remotableDataRpc); ClientId = clientId; _inprocServices = inprocServices; _remotableDataRpc = remotableDataRpc; _endPoint = new RemoteEndPoint(stream, inprocServices.Logger, incomingCallTarget: this); _endPoint.Disconnected += OnDisconnected; _endPoint.StartListening(); }
private InProcRemoteHostClient( Workspace workspace, InProcRemoteServices inprocServices, ReferenceCountedDisposable <RemotableDataJsonRpc> remotableDataRpc, Stream stream) : base(workspace) { Contract.ThrowIfNull(remotableDataRpc); _inprocServices = inprocServices; _remotableDataRpc = remotableDataRpc; _rpc = new JsonRpc(new JsonRpcMessageHandler(stream, stream), target: this); _rpc.JsonSerializer.Converters.Add(AggregateJsonConverter.Instance); // handle disconnected situation _rpc.Disconnected += OnRpcDisconnected; _rpc.StartListening(); }
public static async Task <RemoteHostClient> CreateAsync(Workspace workspace, CancellationToken cancellationToken) { var inprocServices = new InProcRemoteServices(); var remoteHostStream = await inprocServices.RequestServiceAsync(WellKnownRemoteHostServices.RemoteHostService, cancellationToken).ConfigureAwait(false); var instance = new InProcRemoteHostClient(workspace, inprocServices, remoteHostStream); // make sure connection is done right var current = $"VS ({Process.GetCurrentProcess().Id})"; var host = await instance._rpc.InvokeAsync <string>(WellKnownRemoteHostServices.RemoteHostService_Connect, current).ConfigureAwait(false); // TODO: change this to non fatal watson and make VS to use inproc implementation Contract.ThrowIfFalse(host == current.ToString()); instance.Connected(); // return instance return(instance); }
public static async Task<RemoteHostClient> CreateAsync(Workspace workspace, bool runCacheCleanup, CancellationToken cancellationToken) { var inprocServices = new InProcRemoteServices(runCacheCleanup); var remoteHostStream = await inprocServices.RequestServiceAsync(WellKnownRemoteHostServices.RemoteHostService, cancellationToken).ConfigureAwait(false); var instance = new InProcRemoteHostClient(workspace, inprocServices, remoteHostStream); // make sure connection is done right var current = $"VS ({Process.GetCurrentProcess().Id})"; var host = await instance._rpc.InvokeAsync<string>(WellKnownRemoteHostServices.RemoteHostService_Connect, current).ConfigureAwait(false); // TODO: change this to non fatal watson and make VS to use inproc implementation Contract.ThrowIfFalse(host == current.ToString()); instance.Connected(); // return instance return instance; }
private InProcRemoteHostClient( string clientId, Workspace workspace, InProcRemoteServices inprocServices, ReferenceCountedDisposable <RemotableDataJsonRpc> remotableDataRpc, Stream stream) : base(workspace) { Contract.ThrowIfNull(remotableDataRpc); ClientId = clientId; _inprocServices = inprocServices; _remotableDataRpc = remotableDataRpc; _rpc = stream.CreateStreamJsonRpc(target: this, inprocServices.Logger); // handle disconnected situation _rpc.Disconnected += OnRpcDisconnected; _rpc.StartListening(); }
public static async Task <RemoteHostClient> CreateAsync(HostWorkspaceServices services, RemoteServiceCallbackDispatcherRegistry callbackDispatchers, TraceListener?traceListener, RemoteHostTestData testData) { var inprocServices = new InProcRemoteServices(services, traceListener, testData); var remoteHostStream = await inprocServices.RequestServiceAsync(WellKnownServiceHubService.RemoteHost).ConfigureAwait(false); var instance = new InProcRemoteHostClient(services, inprocServices, callbackDispatchers, remoteHostStream); // make sure connection is done right var uiCultureLCIDE = 0; var cultureLCID = 0; await instance._endPoint.InvokeAsync( nameof(IRemoteHostService.InitializeGlobalState), new object?[] { uiCultureLCIDE, cultureLCID }, CancellationToken.None).ConfigureAwait(false); instance.Started(); // return instance return(instance); }
public static async Task <RemoteHostClient> CreateAsync(HostWorkspaceServices services, RemoteHostTestData testData) { var inprocServices = new InProcRemoteServices(testData); var remoteHostStream = await inprocServices.RequestServiceAsync(WellKnownServiceHubService.RemoteHost).ConfigureAwait(false); var clientId = $"InProc ({Guid.NewGuid()})"; var instance = new InProcRemoteHostClient(clientId, services, inprocServices, remoteHostStream); // make sure connection is done right var uiCultureLCIDE = 0; var cultureLCID = 0; await instance._endPoint.InvokeAsync( nameof(IRemoteHostService.InitializeGlobalState), new object?[] { uiCultureLCIDE, cultureLCID }, CancellationToken.None).ConfigureAwait(false); instance.Started(); // return instance return(instance); }
public static async Task <RemoteHostClient> CreateAsync(HostWorkspaceServices services, bool runCacheCleanup) { var inprocServices = new InProcRemoteServices(runCacheCleanup); var remoteHostStream = await inprocServices.RequestServiceAsync(WellKnownServiceHubService.RemoteHost).ConfigureAwait(false); var clientId = CreateClientId(Process.GetCurrentProcess().Id.ToString()); var instance = new InProcRemoteHostClient(clientId, services, inprocServices, remoteHostStream); // make sure connection is done right string?telemetrySession = null; var uiCultureLCIDE = 0; var cultureLCID = 0; await instance._endPoint.InvokeAsync( nameof(IRemoteHostService.InitializeGlobalState), new object?[] { clientId, uiCultureLCIDE, cultureLCID, telemetrySession }, CancellationToken.None).ConfigureAwait(false); instance.Started(); // return instance return(instance); }
public InProcServiceBroker(InProcRemoteServices services) { _services = services; }