Ejemplo n.º 1
0
        public static async Task <RemoteHostClient> CreateAsync(Workspace workspace, bool runCacheCleanup)
        {
            var inprocServices = new InProcRemoteServices(runCacheCleanup);

            var remoteHostStream = await inprocServices.RequestServiceAsync(WellKnownRemoteHostServices.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);
        }
Ejemplo n.º 2
0
        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
            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);
        }
Ejemplo n.º 3
0
        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 telemetrySession = default(string);
            var host             = await instance._rpc.InvokeAsync <string>(nameof(IRemoteHostService.Connect), current, 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);
        }
        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 = $"InProc ({Guid.NewGuid()})";
            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);
        }