Arbel.Roslyn.ConfigureAwaitChecker.ConfigureAwaitVisualBasicCodeFix.ComputeFixesAsync C# (CSharp) Méthode

ComputeFixesAsync() public méthode

public ComputeFixesAsync ( Microsoft.CodeAnalysis.CodeFixes.CodeFixContext context ) : Task
context Microsoft.CodeAnalysis.CodeFixes.CodeFixContext
Résultat Task
        public override async Task ComputeFixesAsync(CodeFixContext context)
        {
            var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
            var diagnostic = context.Diagnostics.First();
            var diagnosticSpan = diagnostic.Location.SourceSpan;

            var declaration = root.FindToken(diagnosticSpan.Start).Parent
                .FirstAncestorOrSelf<AwaitExpressionSyntax>();

            context.RegisterFix(
                CodeAction.Create("Add ConfigureAwait(false)", cancellationToken =>
                    AddConfigureAwait(context.Document, declaration, false, cancellationToken)),
                diagnostic);
            context.RegisterFix(
                CodeAction.Create("Add ConfigureAwait(true)", cancellationToken =>
                    AddConfigureAwait(context.Document, declaration, true, cancellationToken)),
                diagnostic);
        }