コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
            }
        }