public InProcRemoteHostClientProvider(
            HostWorkspaceServices services,
            RemoteServiceCallbackDispatcherRegistry callbackDispatchers
            )
        {
            _services = services;

            _lazyManager = new Lazy <WorkspaceManager>(
                () =>
                new WorkspaceManager(
                    RemoteAssetStorage ?? new SolutionAssetCache(),
                    AdditionalRemoteParts
                    )
                );
            _lazyClient = new AsyncLazy <RemoteHostClient>(
                cancellationToken =>
                InProcRemoteHostClient.CreateAsync(
                    _services,
                    callbackDispatchers,
                    TraceListener,
                    new RemoteHostTestData(_lazyManager.Value, isInProc: true)
                    ),
                cacheResult: true
                );
        }
 public Factory(
     SVsServiceProvider vsServiceProvider,
     AsynchronousOperationListenerProvider listenerProvider,
     [ImportMany] IEnumerable <Lazy <IRemoteServiceCallbackDispatcher, RemoteServiceCallbackDispatcherRegistry.ExportMetadata> > callbackDispatchers)
 {
     _vsServiceProvider   = (IAsyncServiceProvider)vsServiceProvider;
     _listenerProvider    = listenerProvider;
     _callbackDispatchers = new RemoteServiceCallbackDispatcherRegistry(callbackDispatchers);
 }
 private InProcRemoteHostClient(
     HostWorkspaceServices services,
     InProcRemoteServices inprocServices,
     RemoteServiceCallbackDispatcherRegistry callbackDispatchers)
 {
     _workspaceServices   = services;
     _callbackDispatchers = callbackDispatchers;
     _inprocServices      = inprocServices;
 }
        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 VisualStudioRemoteHostClientProvider(
     HostWorkspaceServices services,
     IAsyncServiceProvider vsServiceProvider,
     AsynchronousOperationListenerProvider listenerProvider,
     RemoteServiceCallbackDispatcherRegistry callbackDispatchers)
 {
     _services            = services;
     _vsServiceProvider   = vsServiceProvider;
     _listenerProvider    = listenerProvider;
     _callbackDispatchers = callbackDispatchers;
     _lazyClient          = new AsyncLazy <RemoteHostClient?>(CreateHostClientAsync, cacheResult: true);
 }
 public Factory(
     SVsServiceProvider vsServiceProvider,
     AsynchronousOperationListenerProvider listenerProvider,
     IGlobalOptionService globalOptions,
     IThreadingContext threadingContext,
     [ImportMany] IEnumerable <Lazy <IRemoteServiceCallbackDispatcher, RemoteServiceCallbackDispatcherRegistry.ExportMetadata> > callbackDispatchers)
 {
     _vsServiceProvider   = (IAsyncServiceProvider)vsServiceProvider;
     _globalOptions       = globalOptions;
     _listenerProvider    = listenerProvider;
     _threadingContext    = threadingContext;
     _callbackDispatchers = new RemoteServiceCallbackDispatcherRegistry(callbackDispatchers);
 }
Example #7
0
        private InProcRemoteHostClient(
            HostWorkspaceServices services,
            InProcRemoteServices inprocServices,
            RemoteServiceCallbackDispatcherRegistry callbackDispatchers,
            Stream stream)
        {
            _workspaceServices   = services;
            _callbackDispatchers = callbackDispatchers;
            _logger = new TraceSource("Default");

            _inprocServices = inprocServices;

            _endPoint = new RemoteEndPoint(stream, _logger, incomingCallTarget: this);
            _endPoint.Disconnected += OnDisconnected;
            _endPoint.StartListening();
        }
        private VisualStudioRemoteHostClientProvider(
            HostWorkspaceServices services,
            IAsyncServiceProvider vsServiceProvider,
            IThreadingContext threadingContext,
            AsynchronousOperationListenerProvider listenerProvider,
            RemoteServiceCallbackDispatcherRegistry callbackDispatchers)
        {
            _services            = services;
            _vsServiceProvider   = vsServiceProvider;
            _listenerProvider    = listenerProvider;
            _callbackDispatchers = callbackDispatchers;

            // using VS AsyncLazy here since Roslyn's is not compatible with JTF.
            // Our ServiceBroker services may be invoked by other VS components under JTF.
            _lazyClient = new VSThreading.AsyncLazy <RemoteHostClient?>(CreateHostClientAsync, threadingContext.JoinableTaskFactory);
        }
        public InProcRemoteHostClientProvider(HostWorkspaceServices services, RemoteServiceCallbackDispatcherRegistry callbackDispatchers)
        {
            _services = services;

            var testSerializerServiceFactory = ((IMefHostExportProvider)services.HostServices).GetExportedValue <TestSerializerService.Factory>();

            _lazyManager = new Lazy <WorkspaceManager>(
                () => new WorkspaceManager(
                    RemoteAssetStorage ?? new SolutionAssetCache(),
                    testSerializerServiceFactory.SharedTestGeneratorReferences,
                    AdditionalRemoteParts));
            _lazyClient = new Lazy <RemoteHostClient>(
                () => InProcRemoteHostClient.Create(
                    _services,
                    callbackDispatchers,
                    TraceListener,
                    new RemoteHostTestData(_lazyManager.Value, isInProc: true)));
        }
Example #10
0
        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);
        }