public static async Task <ISymbolSearchUpdateEngine> CreateEngineAsync(
            Workspace workspace, ISymbolSearchLogService logService, CancellationToken cancellationToken)
        {
            var outOfProcessAllowed = workspace.Options.GetOption(SymbolSearchOptions.OutOfProcessAllowed);

            if (outOfProcessAllowed)
            {
                var client = await workspace.GetRemoteHostClientAsync(cancellationToken).ConfigureAwait(false);

                if (client != null)
                {
                    var emptySolution = workspace.CreateSolution(workspace.CurrentSolution.Id);

                    // We create a single session and use it for the entire lifetime of this process.
                    // That single session will be used to do all communication with the remote process.
                    // This is because each session will cause a new instance of the RemoteSymbolSearchUpdateEngine
                    // to be created on the remote side.  We only want one instance of that type.  The
                    // alternative is to make that type static variable on the remote side.  But that's
                    // much less clean and would make some of the state management much more complex.
                    var session = await client.CreateServiceSessionAsync(
                        WellKnownServiceHubServices.RemoteSymbolSearchUpdateEngine,
                        emptySolution, logService, cancellationToken).ConfigureAwait(false);

                    return(new RemoteUpdateEngine(session));
                }
            }

            // Couldn't go out of proc.  Just do everything inside the current process.
            return(new SymbolSearchUpdateEngine(logService));
        }
        public static async Task<ISymbolSearchUpdateEngine> CreateEngineAsync(
            Workspace workspace, ISymbolSearchLogService logService, CancellationToken cancellationToken)
        {
            var outOfProcessAllowed = workspace.Options.GetOption(SymbolSearchOptions.OutOfProcessAllowed);
            if (outOfProcessAllowed)
            {
                var client = await workspace.GetRemoteHostClientAsync(cancellationToken).ConfigureAwait(false);
                if (client != null)
                {
                    var emptySolution = workspace.CreateSolution(workspace.CurrentSolution.Id);

                    // We create a single session and use it for the entire lifetime of this process.
                    // That single session will be used to do all communication with the remote process.
                    // This is because each session will cause a new instance of the RemoteSymbolSearchUpdateEngine
                    // to be created on the remote side.  We only want one instance of that type.  The
                    // alternative is to make that type static variable on the remote side.  But that's
                    // much less clean and would make some of the state management much more complex.
                    var session = await client.CreateServiceSessionAsync(
                        WellKnownServiceHubServices.RemoteSymbolSearchUpdateEngine,
                        emptySolution, logService, cancellationToken).ConfigureAwait(false);

                    return new RemoteUpdateEngine(session);
                }
            }

            // Couldn't go out of proc.  Just do everything inside the current process.
            return new SymbolSearchUpdateEngine(logService);
        }
예제 #3
0
 public static ISymbolSearchUpdateEngine CreateEngineInProcess(
     ISymbolSearchLogService logService,
     ISymbolSearchProgressService progressService)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? new SymbolSearchUpdateEngine(logService, progressService)
         : (ISymbolSearchUpdateEngine) new NoOpUpdateEngine());
 }
            public Updater(SymbolSearchUpdateEngine service, ISymbolSearchLogService logService, string source, string localSettingsDirectory)
            {
                _service    = service;
                _source     = source;
                _logService = logService;

                _cacheDirectoryInfo = new DirectoryInfo(Path.Combine(
                                                            localSettingsDirectory, "PackageCache", string.Format(Invariant($"Format{AddReferenceDatabaseTextFileFormatVersion}"))));
            }
예제 #5
0
            public async ValueTask UpdateContinuouslyAsync(string sourceName, string localSettingsDirectory, ISymbolSearchLogService logService, CancellationToken cancellationToken)
            {
                // logService parameter is ignored since it's already set on the connection as a callback
                _ = logService;

                _ = await _connection.TryInvokeAsync(
                    (service, callbackId, cancellationToken) => service.UpdateContinuouslyAsync(callbackId, sourceName, localSettingsDirectory, cancellationToken),
                    cancellationToken).ConfigureAwait(false);
            }
예제 #6
0
 /// <summary>
 /// Don't call directly. Use <see cref="SymbolSearchUpdateEngineFactory"/> instead.
 /// </summary>
 public SymbolSearchUpdateEngine(ISymbolSearchLogService logService)
     : this(logService,
            new RemoteControlService(),
            new DelayService(),
            new IOService(),
            new PatchService(),
            new DatabaseFactoryService(),
            // Report all exceptions we encounter, but don't crash on them.
            FatalError.ReportWithoutCrash)
 {
 }
 public RemoteUpdateEngine(
     Workspace workspace,
     KeepAliveSession session,
     ISymbolSearchLogService logService,
     ISymbolSearchProgressService progressService)
 {
     _workspace       = workspace;
     _session         = session;
     _logService      = logService;
     _progressService = progressService;
 }
예제 #8
0
            public RemoteUpdateEngine(
                Workspace workspace, RemoteHostClient client,
                ISymbolSearchLogService logService, CancellationToken cancellationToken)
            {
                _workspace         = workspace;
                _logService        = logService;
                _cancellationToken = cancellationToken;

                // this engine is stateful service which maintaining a connection to remote host. so
                // this feature is required to handle remote host recycle situation.
                _client = client;
                _client.ConnectionChanged += OnConnectionChanged;
            }
예제 #9
0
        public static async Task <ISymbolSearchUpdateEngine> CreateEngineAsync(
            Workspace workspace, ISymbolSearchLogService logService, CancellationToken cancellationToken)
        {
            var client = await workspace.TryGetRemoteHostClientAsync(
                RemoteFeatureOptions.SymbolSearchEnabled, cancellationToken).ConfigureAwait(false);

            if (client != null)
            {
                return(new RemoteUpdateEngine(workspace, client, logService, cancellationToken));
            }

            // Couldn't go out of proc.  Just do everything inside the current process.
            return(new SymbolSearchUpdateEngine(logService));
        }
예제 #10
0
 public SymbolSearchUpdateEngine(
     ISymbolSearchLogService logService, 
     CancellationToken updateCancellationToken)
     : this(logService,
            new RemoteControlService(),
            new DelayService(),
            new IOService(),
            new PatchService(),
            new DatabaseFactoryService(),
            // Report all exceptions we encounter, but don't crash on them.
            FatalError.ReportWithoutCrash,
            updateCancellationToken)
 {
 }
        public static async ValueTask <ISymbolSearchUpdateEngine> CreateEngineAsync(
            Workspace workspace,
            ISymbolSearchLogService logService,
            CancellationToken cancellationToken)
        {
            var client = await RemoteHostClient.TryGetClientAsync(workspace, cancellationToken).ConfigureAwait(false);

            if (client != null)
            {
                return(new SymbolSearchUpdateEngineProxy(client, logService));
            }

            // Couldn't go out of proc.  Just do everything inside the current process.
            return(CreateEngineInProcess());
        }
        public static async Task <ISymbolSearchUpdateEngine> CreateEngineAsync(
            Workspace workspace,
            ISymbolSearchLogService logService,
            CancellationToken cancellationToken)
        {
            var client = await RemoteHostClient.TryGetClientAsync(workspace, cancellationToken).ConfigureAwait(false);

            if (client != null)
            {
                var connection = await client.CreateConnectionAsync <IRemoteSymbolSearchUpdateService>(logService, cancellationToken).ConfigureAwait(false);

                return(new RemoteUpdateEngine(connection));
            }

            // Couldn't go out of proc.  Just do everything inside the current process.
            return(CreateEngineInProcess(logService));
        }
예제 #13
0
 /// <summary>
 /// For testing purposes only.
 /// </summary>
 internal SymbolSearchUpdateEngine(
     ISymbolSearchLogService logService,
     IRemoteControlService remoteControlService,
     IDelayService delayService,
     IIOService ioService,
     IPatchService patchService,
     IDatabaseFactoryService databaseFactoryService,
     Func <Exception, bool> reportAndSwallowException)
 {
     _delayService              = delayService;
     _ioService                 = ioService;
     _logService                = logService;
     _remoteControlService      = remoteControlService;
     _patchService              = patchService;
     _databaseFactoryService    = databaseFactoryService;
     _reportAndSwallowException = reportAndSwallowException;
 }
예제 #14
0
        public static async Task <ISymbolSearchUpdateEngine> CreateEngineAsync(
            Workspace workspace,
            ISymbolSearchLogService logService,
            ISymbolSearchProgressService progressService,
            CancellationToken cancellationToken)
        {
            var client = await RemoteHostClient.TryGetClientAsync(workspace, cancellationToken).ConfigureAwait(false);

            if (client != null)
            {
                var callbackObject = new CallbackObject(logService, progressService);
                var session        = await client.CreateConnectionAsync(WellKnownServiceHubService.RemoteSymbolSearchUpdateEngine, callbackObject, cancellationToken).ConfigureAwait(false);

                return(new RemoteUpdateEngine(workspace, session));
            }

            // Couldn't go out of proc.  Just do everything inside the current process.
            return(CreateEngineInProcess(logService, progressService));
        }
예제 #15
0
        /// <summary>
        /// For testing purposes only.
        /// </summary>
        internal SymbolSearchUpdateEngine(
            ISymbolSearchLogService logService,
            IRemoteControlService remoteControlService,
            IDelayService delayService,
            IIOService ioService,
            IPatchService patchService,
            IDatabaseFactoryService databaseFactoryService,
            Func<Exception, bool> reportAndSwallowException,
            CancellationToken updateCancellationToken)
        {
            _delayService = delayService;
            _ioService = ioService;
            _logService = logService;
            _remoteControlService = remoteControlService;
            _patchService = patchService;
            _databaseFactoryService = databaseFactoryService;
            _reportAndSwallowException = reportAndSwallowException;

            _updateCancellationToken = updateCancellationToken;
        }
        public static async Task <ISymbolSearchUpdateEngine> CreateEngineAsync(
            Workspace workspace,
            ISymbolSearchLogService logService,
            ISymbolSearchProgressService progressService,
            CancellationToken cancellationToken)
        {
            var client = await workspace.TryGetRemoteHostClientAsync(
                RemoteFeatureOptions.SymbolSearchEnabled, cancellationToken).ConfigureAwait(false);

            if (client != null)
            {
                var session = await client.TryCreateKeepAliveSessionAsync(WellKnownServiceHubServices.RemoteSymbolSearchUpdateEngine, logService, cancellationToken).ConfigureAwait(false);

                if (session != null)
                {
                    return(new RemoteUpdateEngine(workspace, session, logService, progressService));
                }
            }

            // Couldn't go out of proc.  Just do everything inside the current process.
            return(new SymbolSearchUpdateEngine(logService, progressService));
        }
 public CallbackObject(ISymbolSearchLogService logService, ISymbolSearchProgressService progressService)
 {
     _logService      = logService;
     _progressService = progressService;
 }
예제 #18
0
 public static ValueTask <ISymbolSearchUpdateEngine> CreateEngineAsync(
     Workspace workspace,
     ISymbolSearchLogService logService,
     CancellationToken cancellationToken)
 => ValueTaskFactory.FromResult <ISymbolSearchUpdateEngine>(SymbolSearchUpdateNoOpEngine.Instance);
예제 #19
0
 public SymbolSearchUpdateEngine(ISymbolSearchLogService logService)
     : this(logService, CancellationToken.None)
 {
 }
예제 #20
0
 public RemoteUpdateEngine(
     RemoteHostClient client,
     ISymbolSearchLogService logService
     ) =>
예제 #21
0
 public SymbolSearchUpdateEngine(ISymbolSearchLogService logService)
     : this(logService, CancellationToken.None)
 {
 }
예제 #22
0
 public ValueTask UpdateContinuouslyAsync(string sourceName, string localSettingsDirectory, ISymbolSearchLogService logService, CancellationToken cancellationToken)
 => default;
예제 #23
0
 public RemoteUpdateEngine(RemoteHostClient client, ISymbolSearchLogService logService)
 => _connection = client.CreateConnection <IRemoteSymbolSearchUpdateService>(logService);
 public CallbackObject(ISymbolSearchLogService logService)
 {
     _logService = logService;
 }