public static async Task <RemoteHostClient> CreateAsync( HostWorkspaceServices services, RemoteProcessConfiguration configuration, AsynchronousOperationListenerProvider listenerProvider, IServiceBroker serviceBroker, RemoteServiceCallbackDispatcherRegistry callbackDispatchers, CancellationToken cancellationToken) { using (Logger.LogBlock(FunctionId.ServiceHubRemoteHostClient_CreateAsync, KeyValueLogMessage.NoProperty, cancellationToken)) { #pragma warning disable ISB001 // Dispose of proxies #pragma warning disable VSTHRD012 // Provide JoinableTaskFactory where allowed var serviceBrokerClient = new ServiceBrokerClient(serviceBroker); #pragma warning restore var hubClient = new HubClient("ManagedLanguage.IDE.RemoteHostClient"); var client = new ServiceHubRemoteHostClient(services, configuration, serviceBrokerClient, hubClient, callbackDispatchers); var syntaxTreeConfigurationService = services.GetService <ISyntaxTreeConfigurationService>(); if (syntaxTreeConfigurationService != null) { await client.TryInvokeAsync <IRemoteProcessTelemetryService>( (service, cancellationToken) => service.SetSyntaxTreeConfigurationOptionsAsync(syntaxTreeConfigurationService.DisableRecoverableTrees, syntaxTreeConfigurationService.DisableProjectCacheService, syntaxTreeConfigurationService.EnableOpeningSourceGeneratedFilesInWorkspace, cancellationToken), cancellationToken).ConfigureAwait(false); } await client.TryInvokeAsync <IRemoteAsynchronousOperationListenerService>( (service, cancellationToken) => service.EnableAsync(AsynchronousOperationListenerProvider.IsEnabled, listenerProvider.DiagnosticTokensEnabled, cancellationToken), cancellationToken).ConfigureAwait(false); client.Started(); return(client); } }
private ServiceHubRemoteHostClient( HostWorkspaceServices services, RemoteProcessConfiguration configuration, ServiceBrokerClient serviceBrokerClient, HubClient hubClient, IRemoteServiceCallbackDispatcherProvider callbackDispatcherProvider) { // use the hub client logger for unexpected exceptions from devenv as well, so we have complete information in the log: services.GetService <IWorkspaceTelemetryService>()?.RegisterUnexpectedExceptionLogger(hubClient.Logger); _services = services; _serviceBrokerClient = serviceBrokerClient; _hubClient = hubClient; _callbackDispatcherProvider = callbackDispatcherProvider; _assetStorage = services.GetRequiredService <ISolutionAssetStorageProvider>().AssetStorage; _errorReportingService = services.GetService <IErrorReportingService>(); _shutdownCancellationService = services.GetService <IRemoteHostClientShutdownCancellationService>(); Configuration = configuration; }