public override async Task RegisterCodeFixesAsync(CodeFixContext context)
        {
            SyntaxNode root = await context.GetSyntaxRootAsync().ConfigureAwait(false);

            if (!TryFindFirstAncestorOrSelf(root, context.Span, out SyntaxNode node, predicate: f => f.IsKind(SyntaxKind.ThrowStatement, SyntaxKind.ThrowExpression)))
            {
                return;
            }

            foreach (Diagnostic diagnostic in context.Diagnostics)
            {
                switch (diagnostic.Id)
                {
                case DiagnosticIdentifiers.AddExceptionToDocumentationComment:
                {
                    switch (node.Kind())
                    {
                    case SyntaxKind.ThrowStatement:
                    {
                        CodeAction codeAction = CodeAction.Create(
                            "Add exception to documentation comment",
                            ct => AddExceptionElementToDocumentationCommentRefactoring.RefactorAsync(context.Document, (ThrowStatementSyntax)node, ct),
                            GetEquivalenceKey(diagnostic));

                        context.RegisterCodeFix(codeAction, diagnostic);
                        break;
                    }

                    case SyntaxKind.ThrowExpression:
                    {
                        CodeAction codeAction = CodeAction.Create(
                            "Add exception to documentation comment",
                            ct => AddExceptionElementToDocumentationCommentRefactoring.RefactorAsync(context.Document, (ThrowExpressionSyntax)node, ct),
                            GetEquivalenceKey(diagnostic));

                        context.RegisterCodeFix(codeAction, diagnostic);
                        break;
                    }
                    }

                    break;
                }
                }
            }
        }
        public static async Task ComputeRefactoringAsync(RefactoringContext context, ThrowStatementSyntax throwStatement)
        {
            if (context.IsRefactoringEnabled(RefactoringDescriptors.AddExceptionElementToDocumentationComment) &&
                context.Span.IsContainedInSpanOrBetweenSpans(throwStatement))
            {
                SemanticModel semanticModel = await context.GetSemanticModelAsync().ConfigureAwait(false);

                AddExceptionToDocumentationCommentAnalysisResult analysis = AddExceptionToDocumentationCommentAnalysis.Analyze(
                    throwStatement,
                    semanticModel.GetTypeByMetadataName("System.Exception"),
                    semanticModel,
                    context.CancellationToken);

                if (analysis.Success)
                {
                    context.RegisterRefactoring(
                        "Add 'exception' element to documentation comment",
                        ct => AddExceptionElementToDocumentationCommentRefactoring.RefactorAsync(context.Document, analysis, ct),
                        RefactoringDescriptors.AddExceptionElementToDocumentationComment);
                }
            }
        }