protected override async Task <TRoot> RecoverAsync(CancellationToken cancellationToken)
 {
     using (var stream = await _storage.ReadStreamAsync(cancellationToken).ConfigureAwait(false))
     {
         return(RecoverRoot(stream, cancellationToken));
     }
 }
Esempio n. 2
0
            protected override async Task <TRoot> RecoverAsync(CancellationToken cancellationToken)
            {
                Contract.ThrowIfNull(_storage);

                var tickCount = Environment.TickCount;

                try
                {
                    if (RoslynEventSource.Instance.IsEnabled(EventLevel.Informational, EventKeywords.None))
                    {
                        RoslynEventSource.Instance.BlockStart(_containingTree.FilePath, FunctionId.Workspace_Recoverable_RecoverRootAsync, blockId: 0);
                    }

                    using var stream = await _storage.ReadStreamAsync(cancellationToken).ConfigureAwait(false);

                    return(RecoverRoot(stream, cancellationToken));
                }
                finally
                {
                    if (RoslynEventSource.Instance.IsEnabled(EventLevel.Informational, EventKeywords.None))
                    {
                        var tick = Environment.TickCount - tickCount;
                        if (cancellationToken.IsCancellationRequested)
                        {
                            RoslynEventSource.Instance.BlockCanceled(FunctionId.Workspace_Recoverable_RecoverRootAsync, tick, blockId: 0);
                        }
                        else
                        {
                            RoslynEventSource.Instance.BlockStop(FunctionId.Workspace_Recoverable_RecoverRootAsync, tick, blockId: 0);
                        }
                    }
                }
            }
            protected override async Task <TRoot> RecoverAsync(CancellationToken cancellationToken)
            {
                Contract.ThrowIfNull(_storage);

                using var stream = await _storage.ReadStreamAsync(cancellationToken).ConfigureAwait(false);

                return(RecoverRoot(stream, cancellationToken));
            }
            protected override async Task <TRoot> RecoverAsync(CancellationToken cancellationToken)
            {
                Contract.ThrowIfNull(_storage);

                using (RoslynEventSource.LogInformationalBlock(FunctionId.Workspace_Recoverable_RecoverRootAsync, _containingTree.FilePath, cancellationToken))
                {
                    using var stream = await _storage.ReadStreamAsync(cancellationToken).ConfigureAwait(false);

                    return(RecoverRoot(stream, cancellationToken));
                }
            }