public static async Task<RemoteHostClient> CreateAsync( Workspace workspace, CancellationToken cancellationToken) { using (Logger.LogBlock(FunctionId.ServiceHubRemoteHostClient_CreateAsync, cancellationToken)) { var primary = new HubClient("ManagedLanguage.IDE.RemoteHostClient"); var remoteHostStream = await primary.RequestServiceAsync(WellKnownRemoteHostServices.RemoteHostService, cancellationToken).ConfigureAwait(false); var instance = new ServiceHubRemoteHostClient(workspace, primary, 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(); // Create a workspace host to hear about workspace changes. We'll // remote those changes over to the remote side when they happen. RegisterWorkspaceHost(workspace, instance); // return instance return instance; } }
public static async Task<RemoteHostClient> CreateAsync(Workspace workspace, CancellationToken cancellationToken) { var primary = new HubClient("ManagedLanguage.IDE.RemoteHostClient"); var remoteHostStream = await primary.RequestServiceAsync(WellKnownServiceHubServices.RemoteHostService, cancellationToken).ConfigureAwait(false); var instance = new ServiceHubRemoteHostClient(workspace, primary, remoteHostStream); // make sure connection is done right var current = $"VS ({Process.GetCurrentProcess().Id})"; var host = await instance._rpc.InvokeAsync<string>(WellKnownServiceHubServices.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 Task <RemoteHostClient> CreateAsync(Workspace workspace, CancellationToken cancellationToken) { // this is the point where we can create different kind of remote host client in future (cloud or etc) return(ServiceHubRemoteHostClient.CreateAsync(workspace, cancellationToken)); }
public ServiceHubRemoteHostClientProvider(HostWorkspaceServices services) { _services = services; _lazyClient = new AsyncLazy <RemoteHostClient>(cancellationToken => ServiceHubRemoteHostClient.CreateAsync(_services, cancellationToken), cacheResult: true); }
private Task <RemoteHostClient> CreateHostClientAsync(CancellationToken cancellationToken) => ServiceHubRemoteHostClient.CreateAsync(_services, cancellationToken);
public async Task <RemoteHostClient?> CreateAsync(HostWorkspaceServices services, CancellationToken cancellationToken) { // this is the point where we can create different kind of remote host client in future (cloud or etc) return(await ServiceHubRemoteHostClient.CreateAsync(services, cancellationToken).ConfigureAwait(false)); }