public RemoteUpdateEngine( Workspace workspace, KeepAliveSession session) { _workspace = workspace; _session = session; }
public RemoteUpdateEngine( Workspace workspace, KeepAliveSession session, ISymbolSearchLogService logService, ISymbolSearchProgressService progressService) { _workspace = workspace; _session = session; _logService = logService; _progressService = progressService; }
private async Task <KeepAliveSession> TryGetKeepAliveSessionAsync(RemoteHostClient client, CancellationToken cancellationToken) { using (await _gate.DisposableWaitAsync(cancellationToken).ConfigureAwait(false)) { if (_sessionDoNotAccessDirectly == null) { _sessionDoNotAccessDirectly = await client.TryCreateCodeAnalysisKeepAliveSessionAsync(cancellationToken).ConfigureAwait(false); } return(_sessionDoNotAccessDirectly); } }
private async Task <KeepAliveSession> TryGetKeepAliveSessionAsync(RemoteHostClient client, CancellationToken cancellation) { using (await _gate.DisposableWaitAsync(cancellation).ConfigureAwait(false)) { if (_sessionDoNotAccessDirectly == null) { // we give cancellation none here since the cancellation will cause KeepAlive session to be shutdown // when raised _sessionDoNotAccessDirectly = await client.TryCreateCodeAnalysisKeepAliveSessionAsync(CancellationToken.None).ConfigureAwait(false); } return(_sessionDoNotAccessDirectly); } }
public async Task TestCancellationOnSessionWithSolution() { var code = @"class Test { void Method() { } }"; using (var workspace = CreateWorkspace(LanguageNames.CSharp, code)) { var solution = workspace.CurrentSolution; var solutionChecksum = await solution.State.GetChecksumAsync(CancellationToken.None); var service = solution.Workspace.Services.GetService <IRemotableDataService>(); var source = new CancellationTokenSource(); using var session = new KeepAliveSession(new InvokeThrowsCancellationConnection(source), service); var exception = await Assert.ThrowsAnyAsync <OperationCanceledException>(() => SessionWithSolution.CreateAsync(session, solution, source.Token)); Assert.Equal(exception.CancellationToken, source.Token); // make sure things that should have been cleaned up are cleaned up Assert.Null(await((RemotableDataServiceFactory.Service)service).TestOnly_GetRemotableDataAsync(solutionChecksum, CancellationToken.None).ConfigureAwait(false)); } }
internal UnitTestingKeepAliveSessionWrapper(KeepAliveSession underlyingObject) => UnderlyingObject = underlyingObject ?? throw new ArgumentNullException(nameof(underlyingObject));
public WorkspaceHost(VisualStudioWorkspaceImpl workspace, KeepAliveSession session) { _workspace = workspace; _currentSolutionId = workspace.CurrentSolution.Id; _session = session; }