556 references to Document
GenerateDocumentationAndConfigFiles (1)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
66return cancellationToken => FixAllAsync(context.Document, diagnostics, cancellationToken);
ILLink.CodeFixProvider (3)
BaseAttributeCodeFixProvider.cs (1)
35var document = context.Document;
DynamicallyAccessedMembersCodeFixProvider.cs (1)
95var document = context.Document;
RequiresUnsafeCodeFixProvider.cs (1)
34var document = context.Document;
Microsoft.Analyzers.Extra (4)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (2)
58var (invocationExpression, details) = await CheckIfCanFixAsync(context.Document, context.Span, context.CancellationToken).ConfigureAwait(false); 64createChangedSolution: cancellationToken => ApplyFixAsync(context.Document, invocationExpression, details, cancellationToken),
MakeExeTypesInternalFixer.cs (2)
28var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 32var action = CodeAction.Create(Resources.MakeTypeInternal, c => MakeInternalAsync(context.Document, node, context.CancellationToken), nameof(MakeExeTypesInternalFixer));
Microsoft.AspNetCore.App.CodeFixes (28)
Authorization\AddAuthorizationBuilderFixer.cs (3)
29var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 35var semanticModel = await context.Document.GetSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 48cancellationToken => ReplaceWithAddAuthorizationBuilder(diagnostic, root, context.Document, invocation),
Dependencies\AddPackageFixer.cs (3)
31var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 37var semanticModel = await context.Document.GetSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 90context.Document,
DetectMismatchedParameterOptionalityFixer.cs (1)
29cancellationToken => FixMismatchedParameterOptionalityAsync(diagnostic, context.Document, cancellationToken),
Http\HeaderDictionaryAddFixer.cs (4)
30var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 36var semanticModel = await context.Document.GetSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 51cancellationToken => ReplaceWithAppend(diagnostic, wellKnownTypes, root, context.Document, invocation), 61cancellationToken => ReplaceWithIndexer(diagnostic, root, context.Document, assignment),
Http\HeaderDictionaryIndexerFixer.cs (1)
33cancellationToken => FixHeaderDictionaryIndexer(diagnostic, context.Document, resolvedPropertyName!, cancellationToken),
Kestrel\ListenOnIPv6AnyFixer.cs (7)
33var editor = await DocumentEditor.CreateAsync(context.Document, cancellationToken).ConfigureAwait(false); 34var root = await context.Document.GetSyntaxRootAsync(cancellationToken); 37return context.Document; 43return context.Document; 49return context.Document; 53return context.Document; 60return context.Document;
PublicPartialProgramClassFixer.cs (4)
31var editor = await DocumentEditor.CreateAsync(context.Document, cancellationToken).ConfigureAwait(false); 32var root = await context.Document.GetSyntaxRootAsync(cancellationToken); 35return context.Document; 42return context.Document;
RouteParameterUnusedParameterFixer.cs (3)
31var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 37var semanticModel = await context.Document.GetSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 51cancellationToken => AddRouteParameterAsync(diagnostic, root, routeUsageCache, context.Document, cancellationToken),
WebApplicationBuilderFixer.cs (2)
31var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 70cancellationToken => FixWebApplicationBuilderAsync(diagnostic, root, context.Document, invocation),
Microsoft.AspNetCore.Components.Analyzers (5)
ComponentParametersShouldBePublicCodeFixProvider.cs (2)
33var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 45createChangedDocument: c => GetTransformedDocumentAsync(context.Document, root, declaration),
JSInvokableCodeFixProvider.cs (1)
39createChangedDocument: ct => GetTransformedDocumentAsync(diagnostic, context.Document, ct),
StateHasChangedCodeFixProvider.cs (2)
31var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 55createChangedDocument: cancellationToken => RemoveStateHasChangedCallAsync(context.Document, root, invocation, cancellationToken),
Microsoft.AspNetCore.Components.SdkAnalyzers (2)
ComponentParametersShouldBePublicCodeFixProvider.cs (2)
33var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 45createChangedDocument: c => GetTransformedDocumentAsync(context.Document, root, declaration),
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
AddResponseTypeAttributeCodeFixProvider.cs (1)
25var codeFix = new AddResponseTypeAttributeCodeFixAction(context.Document, diagnostic);
ApiActionsDoNotRequireExplicitModelValidationCodeFixProvider.cs (1)
33context.RegisterCodeFix(new MyCodeAction(context.Document, context.Span), diagnostic);
Microsoft.CodeAnalysis.Analyzers (20)
FixAnalyzers\FixerWithFixAllAnalyzer.Fixer.cs (3)
38var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 45var generator = SyntaxGenerator.GetGenerator(context.Document); 54context.RegisterCodeFix(CodeAction.Create(title, c => AddMethodAsync(context.Document, classDecl, c), equivalenceKey: title), context.Diagnostics);
MetaAnalyzers\Fixers\AnalyzerReleaseTrackingFix.cs (4)
60cancellationToken => AddEntryToUnshippedFileAsync(context.Document.Project, entryToAdd, cancellationToken), 71cancellationToken => AddEntryToUnshippedFileAsync(context.Document.Project, entryToAdd, cancellationToken), 78cancellationToken => UpdateEntryInUnshippedFileAsync(context.Document.Project, ruleId, entryToUpdate, cancellationToken), 87cancellationToken => AddAnalyzerReleaseTrackingFilesAsync(context.Document.Project),
MetaAnalyzers\Fixers\ApplyDiagnosticAnalyzerAttributeFix.cs (3)
22var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 29var generator = SyntaxGenerator.GetGenerator(context.Document); 57c => GetFixAsync(context.Document, root, classDecl, generator, languages),
MetaAnalyzers\Fixers\CompareSymbolsCorrectlyFix.cs (2)
46cancellationToken => ConvertToEqualsAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken), 54cancellationToken => CallOverloadWithEqualityComparerAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken),
MetaAnalyzers\Fixers\ConfigureGeneratedCodeAnalysisFix.cs (1)
35cancellationToken => ConfigureGeneratedCodeAnalysisAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken),
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.cs (4)
41var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 48var additionalDocuments = context.Document.Project.AdditionalDocuments.ToImmutableArray(); 49var semanticModel = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 71ct => ApplyFixAsync(context.Document, root, fixInfo.Value, ct),
MetaAnalyzers\Fixers\EnableConcurrentExecutionFix.cs (1)
34cancellationToken => EnableConcurrentExecutionAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken),
MetaAnalyzers\Fixers\PreferIsKindFix.cs (1)
29cancellationToken => ConvertKindToIsKindAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
66return cancellationToken => FixAllAsync(context.Document, diagnostics, cancellationToken);
Microsoft.CodeAnalysis.CodeStyle.Fixes (49)
src\roslyn\src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
34var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (1)
67var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\AddObsoleteAttribute\AbstractAddObsoleteAttributeCodeFixProvider.cs (1)
35var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (2)
67var document = context.Document; 244var codeFixData = PrepareCreationOfCodeActions(context.Document, arguments, methodsAndArgumentsToAdd);
src\roslyn\src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (1)
32var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (2)
72var document = context.Document; 268var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (2)
23var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 30node, context.Document, context.Diagnostics[0], context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (2)
31var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 43cancellationToken => AddParamTagAsync(context.Document, parentMethod, docCommentNode, cancellationToken),
src\roslyn\src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (2)
35var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 42cancellationToken => RemoveDuplicateParamTagAsync(context.Document, paramNode, cancellationToken),
src\roslyn\src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (1)
37cancellationToken => GetTransformedDocumentAsync(context.Document, cancellationToken),
src\roslyn\src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (4)
70var root = await context.Document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); 71var text = await context.Document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); 80var formattingOptions = await context.Document.GetSyntaxFormattingOptionsAsync(cancellationToken).ConfigureAwait(false); 83return context.Document.WithSyntaxRoot(formattedRoot);
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
23var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (3)
32if (context.Document.Project.IsSubmission) 38var document = context.Document; 45var codeActions = await GetCodeActionsAsync(context.Document, name, context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementAbstractClass\AbstractImplementAbstractClassCodeFixProvider.cs (1)
26var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (1)
20var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (2)
21var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 28var codeAction = await GetCodeFixAsync(root, node, context.Document, diagnostic, context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (1)
44var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
41cancellationToken => FixNodeAsync(context.Document, node, cancellationToken),
src\roslyn\src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (2)
27var service = context.Document.Project.Solution.Services.GetRequiredService<ISupportedChangesService>(); 33cancellationToken => FixAllInDocumentAsync(context.Document, context.Diagnostics,
src\roslyn\src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
54var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\NewLines\ConsecutiveStatementPlacement\ConsecutiveStatementPlacementCodeFixProvider.cs (1)
31var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (1)
31var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\OrderModifiers\AbstractOrderModifiersCodeFixProvider.cs (1)
34var syntaxTree = await context.Document.GetRequiredSyntaxTreeAsync(context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (1)
59var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
29var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsCodeFixProvider.cs (1)
36cancellationToken => RemoveUnnecessaryImportsAsync(context.Document, cancellationToken),
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs (1)
28var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs (2)
32var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 33var syntaxFacts = context.Document.GetRequiredLanguageService<ISyntaxFactsService>();
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (3)
154if (IsForEachIterationVariableDiagnostic(diagnostic, context.Document, context.CancellationToken)) 163var syntaxFacts = context.Document.GetRequiredLanguageService<ISyntaxFactsService>(); 164var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\Core\CodeFixes\UnsealClass\AbstractUnsealClassCodeFixProvider.cs (1)
31var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\UpdateLegacySuppressions\UpdateLegacySuppressionsCodeFixProvider.cs (1)
29var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (1)
42var project = context.Document.Project;
src\roslyn\src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
85var solution = context.Document.Project.Solution;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
66return cancellationToken => FixAllAsync(context.Document, diagnostics, cancellationToken);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (40)
src\cef93d2425d77fca\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (2)
35var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 44c => GetChangedDocumentAsync(context.Document, conditionalExpression.SpanStart, c),
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (2)
38var document = context.Document; 42var semanticModel = await context.Document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
31var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\CSharpConvertToRecordCodeFixProvider.cs (1)
31var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
39var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
38var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (2)
34if (context.Document.Project.IsSubmission) 39var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (2)
45var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 53cancellationToken => GetChangedDocumentAsync(context.Document, originalNode, cancellationToken),
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (1)
36context.Document,
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
33var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeRefStruct\MakeRefStructCodeFixProvider.cs (1)
37var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (1)
35var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
59var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
32var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
32var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (1)
33var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (1)
32var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
35var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
49context.Document, model: null, node, cancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (1)
35var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (2)
35var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 49cancellationToken => FixAsync(context.Document, argumentSyntax, cancellationToken),
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (3)
33var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 44var generator = context.Document.GetRequiredLanguageService<SyntaxGenerator>(); 51ct => FixAsync(context.Document, generator, memberDeclarationSyntax, ct),
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnneccessaryUnsafeModifier\CSharpRemoveUnnecessaryUnsafeModifierCodeFixProvider.cs (1)
34cancellationToken => FixAllAsync(context.Document, context.Diagnostics, cancellationToken),
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryNullableWarningSuppressionsCodeFixProvider.cs (1)
35cancellationToken => FixSingleDocumentAsync(context.Document, context.Diagnostics, cancellationToken),
src\roslyn\src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (4)
40var syntaxRoot = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 47var semanticModel = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 50context.Document, semanticModel, defaultLiteral, context.CancellationToken); 57c => ReplaceAsync(context.Document, context.Span, newExpression, c),
src\roslyn\src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
34async _ => AllowUnsafeOnProject(context.Document.Project)), context.Diagnostics);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
102var semanticModel = await context.Document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitTypeForConst\UseExplicitTypeForConstCodeFixProvider.cs (1)
36var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
59var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (1)
43var document = context.Document;
Microsoft.CodeAnalysis.CSharp.Features (44)
ConvertProgram\ConvertToProgramMainCodeFixProvider.cs (1)
34var document = context.Document;
ConvertProgram\ConvertToTopLevelStatementsCodeFixProvider.cs (1)
33var document = context.Document;
Copilot\CSharpCopilotCodeFixProvider.cs (1)
54var document = context.Document;
Copilot\CSharpImplementNotImplementedExceptionFixProvider.cs (1)
42var document = context.Document;
src\cef93d2425d77fca\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (2)
35var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 44c => GetChangedDocumentAsync(context.Document, conditionalExpression.SpanStart, c),
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (2)
38var document = context.Document; 42var semanticModel = await context.Document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
31var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\CSharpConvertToRecordCodeFixProvider.cs (1)
31var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
39var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
38var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (2)
34if (context.Document.Project.IsSubmission) 39var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (2)
45var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 53cancellationToken => GetChangedDocumentAsync(context.Document, originalNode, cancellationToken),
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (1)
36context.Document,
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (1)
33var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeRefStruct\MakeRefStructCodeFixProvider.cs (1)
37var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (1)
35var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
59var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
32var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
32var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (1)
33var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (1)
32var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (1)
35var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
49context.Document, model: null, node, cancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (1)
35var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (2)
35var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 49cancellationToken => FixAsync(context.Document, argumentSyntax, cancellationToken),
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (3)
33var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 44var generator = context.Document.GetRequiredLanguageService<SyntaxGenerator>(); 51ct => FixAsync(context.Document, generator, memberDeclarationSyntax, ct),
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnneccessaryUnsafeModifier\CSharpRemoveUnnecessaryUnsafeModifierCodeFixProvider.cs (1)
34cancellationToken => FixAllAsync(context.Document, context.Diagnostics, cancellationToken),
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryNullableWarningSuppressionsCodeFixProvider.cs (1)
35cancellationToken => FixSingleDocumentAsync(context.Document, context.Diagnostics, cancellationToken),
src\roslyn\src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (4)
40var syntaxRoot = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 47var semanticModel = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 50context.Document, semanticModel, defaultLiteral, context.CancellationToken); 57c => ReplaceAsync(context.Document, context.Span, newExpression, c),
src\roslyn\src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
34async _ => AllowUnsafeOnProject(context.Document.Project)), context.Diagnostics);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
102var semanticModel = await context.Document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitTypeForConst\UseExplicitTypeForConstCodeFixProvider.cs (1)
36var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
59var document = context.Document;
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (1)
43var document = context.Document;
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (16)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\CSharpStaticHolderTypes.Fixer.cs (1)
32Document document = context.Document;
Microsoft.CodeQuality.Analyzers\QualityGuidelines\CSharpAvoidDuplicateElementInitializationFixer.cs (2)
38var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 48_ => Task.FromResult(RemoveElementInitializer(elementInitializer, objectInitializer, root, context.Document)),
Microsoft.CodeQuality.Analyzers\QualityGuidelines\CSharpDoNotInitializeUnnecessarily.Fixer.cs (1)
27Document doc = context.Document;
Microsoft.NetCore.Analyzers\InteropServices\CSharpDisableRuntimeMarshalling.Fixer.cs (3)
32if (context.Document.Project.CompilationOptions is CSharpCompilationOptions { AllowUnsafe: false }) 38SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 49async ct => await UseDisabledMarshallingEquivalentAsync(enclosingNode, context.Document, context.CancellationToken).ConfigureAwait(false),
Microsoft.NetCore.Analyzers\Performance\CSharpCollapseMultiplePathOperations.Fixer.cs (1)
27var document = context.Document;
Microsoft.NetCore.Analyzers\Performance\CSharpPreferDictionaryTryMethodsOverContainsKeyGuardFixer.cs (1)
35Document document = context.Document;
Microsoft.NetCore.Analyzers\Runtime\CSharpAvoidRedundantRegexIsMatchBeforeMatch.Fixer.cs (1)
53Document doc = context.Document;
Microsoft.NetCore.Analyzers\Runtime\CSharpPreferDictionaryContainsMethods.Fixer.cs (1)
23Document doc = context.Document;
Microsoft.NetCore.Analyzers\Usage\CSharpDoNotCompareSpanToNull.Fixer.cs (2)
22var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 31_ => Task.FromResult(context.Document.WithSyntaxRoot(root.ReplaceNode(binaryExpression, MakeIsEmptyCheck(binaryExpression)))),
Microsoft.NetCore.Analyzers\Usage\CSharpMissingShebangInFileBasedProgram.Fixer.cs (3)
20var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 30var options = await context.Document.GetOptionsAsync(ct).ConfigureAwait(false); 37return context.Document.WithSyntaxRoot(newRoot);
Microsoft.CodeAnalysis.Features (60)
AddImport\AbstractAddImportCodeFixProvider.cs (1)
52var document = context.Document;
AddMissingReference\AbstractAddMissingReferenceCodeFixProvider.cs (2)
50context.Document.Project, identity, context.CancellationToken).ConfigureAwait(false); 60var compilation = await context.Document.Project.GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
AddPackage\AbstractAddPackageCodeFixProvider.cs (1)
32var document = context.Document;
CodeFixes\Suppression\WrapperCodeFixProvider.cs (2)
29var suppressionFixes = await SuppressionFixProvider.GetFixesAsync(context.Document, context.Span, documentDiagnostics, context.CancellationToken).ConfigureAwait(false); 36var suppressionFixes = await SuppressionFixProvider.GetFixesAsync(context.Document.Project, projectDiagnostics, context.CancellationToken).ConfigureAwait(false);
FullyQualify\AbstractFullyQualifyCodeFixProvider.cs (1)
25var document = context.Document;
RemoveUnusedVariable\AbstractRemoveUnusedVariableCodeFixProvider.cs (1)
43var document = context.Document;
SimplifyTypeNames\AbstractSimplifyTypeNamesCodeFixProvider.cs (1)
72var document = context.Document;
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (3)
39var document = context.Document; 110var document = context.Document; 149var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (1)
34var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (1)
67var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\AddObsoleteAttribute\AbstractAddObsoleteAttributeCodeFixProvider.cs (1)
35var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (2)
67var document = context.Document; 244var codeFixData = PrepareCreationOfCodeActions(context.Document, arguments, methodsAndArgumentsToAdd);
src\roslyn\src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (1)
32var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (2)
72var document = context.Document; 268var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (2)
23var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 30node, context.Document, context.Diagnostics[0], context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (2)
31var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 43cancellationToken => AddParamTagAsync(context.Document, parentMethod, docCommentNode, cancellationToken),
src\roslyn\src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (2)
35var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 42cancellationToken => RemoveDuplicateParamTagAsync(context.Document, paramNode, cancellationToken),
src\roslyn\src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (1)
37cancellationToken => GetTransformedDocumentAsync(context.Document, cancellationToken),
src\roslyn\src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (4)
70var root = await context.Document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); 71var text = await context.Document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); 80var formattingOptions = await context.Document.GetSyntaxFormattingOptionsAsync(cancellationToken).ConfigureAwait(false); 83return context.Document.WithSyntaxRoot(formattedRoot);
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
23var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (3)
32if (context.Document.Project.IsSubmission) 38var document = context.Document; 45var codeActions = await GetCodeActionsAsync(context.Document, name, context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementAbstractClass\AbstractImplementAbstractClassCodeFixProvider.cs (1)
26var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (1)
20var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (2)
21var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 28var codeAction = await GetCodeFixAsync(root, node, context.Document, diagnostic, context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (1)
44var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
41cancellationToken => FixNodeAsync(context.Document, node, cancellationToken),
src\roslyn\src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (2)
27var service = context.Document.Project.Solution.Services.GetRequiredService<ISupportedChangesService>(); 33cancellationToken => FixAllInDocumentAsync(context.Document, context.Diagnostics,
src\roslyn\src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
54var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\NewLines\ConsecutiveStatementPlacement\ConsecutiveStatementPlacementCodeFixProvider.cs (1)
31var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (1)
31var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\OrderModifiers\AbstractOrderModifiersCodeFixProvider.cs (1)
34var syntaxTree = await context.Document.GetRequiredSyntaxTreeAsync(context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (1)
59var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (1)
29var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsCodeFixProvider.cs (1)
36cancellationToken => RemoveUnnecessaryImportsAsync(context.Document, cancellationToken),
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs (1)
28var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs (2)
32var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 33var syntaxFacts = context.Document.GetRequiredLanguageService<ISyntaxFactsService>();
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (3)
154if (IsForEachIterationVariableDiagnostic(diagnostic, context.Document, context.CancellationToken)) 163var syntaxFacts = context.Document.GetRequiredLanguageService<ISyntaxFactsService>(); 164var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\Core\CodeFixes\UnsealClass\AbstractUnsealClassCodeFixProvider.cs (1)
31var document = context.Document;
src\roslyn\src\Analyzers\Core\CodeFixes\UpdateLegacySuppressions\UpdateLegacySuppressionsCodeFixProvider.cs (1)
29var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
src\roslyn\src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (1)
42var project = context.Document.Project;
src\roslyn\src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
85var solution = context.Document.Project.Solution;
Microsoft.CodeAnalysis.NetAnalyzers (218)
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\AbstractTypesShouldNotHaveConstructors.Fixer.cs (2)
29SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 34async ct => await ChangeAccessibilityCodeFixAsync(context.Document, root, node, ct).ConfigureAwait(false),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DefineAccessorsForAttributeArguments.Fixer.cs (5)
25SyntaxGenerator generator = SyntaxGenerator.GetGenerator(context.Document); 26SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 42async ct => await AddAccessorAsync(context.Document, parameter, ct).ConfigureAwait(false), 55async ct => await MakePublicAsync(context.Document, node, property, ct).ConfigureAwait(false), 65async ct => await RemoveSetterAsync(context.Document, node, ct).ConfigureAwait(false),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\DoNotDirectlyAwaitATask.Fixer.cs (3)
30SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 38async ct => await GetFixAsync(context.Document, expression, argument: false, cancellationToken: ct).ConfigureAwait(false), 45async ct => await GetFixAsync(context.Document, expression, argument: true, cancellationToken: ct).ConfigureAwait(false),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EnumsShouldHaveZeroValue.Fixer.cs (5)
27SemanticModel model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 37SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 55async ct => await GetUpdatedDocumentForRuleNameRenameAsync(context.Document, (IFieldSymbol)declaredSymbol, context.CancellationToken).ConfigureAwait(false), 62async ct => await ApplyRuleNameMultipleZeroAsync(context.Document, (INamedTypeSymbol)declaredSymbol, context.CancellationToken).ConfigureAwait(false), 70async ct => await ApplyRuleNameNoZeroValueAsync(context.Document, (INamedTypeSymbol)declaredSymbol, context.CancellationToken).ConfigureAwait(false),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EnumStorageShouldBeInt32.Fixer.cs (2)
35var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 41c => ChangeEnumTypeToInt32Async(context.Document, diagnostic, root, c),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EnumWithFlagsAttribute.Fixer.cs (2)
30SemanticModel model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 44async ct => await AddOrRemoveFlagsAttributeAsync(context.Document, context.Span, diagnostic.Id, flagsAttributeType, ct).ConfigureAwait(false),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EquatableAnalyzer.Fixer.cs (5)
36SyntaxGenerator generator = SyntaxGenerator.GetGenerator(context.Document); 37SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 47await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 65await ImplementEquatableInStructAsync(context.Document, declaration, type, model.Compilation, 76await OverrideObjectEqualsAsync(context.Document, declaration, type, equatableType,
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\ExceptionsShouldBePublic.Fixer.cs (2)
32SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 41c => MakePublicAsync(context.Document, node, context.CancellationToken),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\IdentifiersShouldNotContainUnderscores.Fixer.cs (4)
34var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 35var model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 63ct => Renamer.RenameSymbolAsync(context.Document.Project.Solution, symbol, newName, context.Document.Project.Solution.Options, ct),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\ImplementStandardExceptionConstructors.Fixer.cs (2)
49SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 52context.RegisterCodeFix(CodeAction.Create(title, c => AddConstructorsAsync(context.Document, context.Diagnostics, root, c), equivalenceKey: title), context.Diagnostics.First());
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\InterfaceMethodsShouldBeCallableByChildTypes.Fixer.cs (6)
35SemanticModel semanticModel = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 36SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 48SyntaxGenerator generator = SyntaxGenerator.GetGenerator(context.Document); 79async ct => await MakeProtectedAsync(context.Document, symbolToChange, checkSetter, ct).ConfigureAwait(false), 92async ct => await ChangeToPublicInterfaceImplementationAsync(context.Document, symbolToChange, ct).ConfigureAwait(false), 99async ct => await MakeContainingTypeSealedAsync(context.Document, methodSymbol, ct).ConfigureAwait(false),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\MarkAttributesWithAttributeUsage.Fixer.cs (3)
28var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 35var semanticModel = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 51async ct => await AddAttributeUsageAttributeAsync(context.Document, nodeToFix, attributeUsageAttributeType, attributeTargetsType, attributeTargetValue, ct).ConfigureAwait(false),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OperatorOverloadsHaveNamedAlternates.Fixer.cs (9)
34var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 47var semanticModel = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 48var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 49var generator = SyntaxGenerator.GetGenerator(context.Document); 84return context.Document; 112return context.Document.WithSyntaxRoot(root.ReplaceNode(typeDeclaration, newTypeDeclaration)); 116SymbolEditor symbolEditor = SymbolEditor.Create(context.Document); 121return context.Document.WithSyntaxRoot(newRoot); 123return context.Document;
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OperatorsShouldHaveSymmetricalOverloads.Fixer.cs (1)
50var document = context.Document;
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OverloadOperatorEqualsOnOverridingValueTypeEquals.Fixer.cs (4)
27SyntaxGenerator generator = SyntaxGenerator.GetGenerator(context.Document); 28SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 37SemanticModel model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 46async ct => await ImplementOperatorEqualsAsync(context.Document, declaration, typeSymbol, ct).ConfigureAwait(false),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OverrideEqualsAndOperatorEqualsOnValueTypes.Fixer.cs (4)
32SyntaxGenerator generator = SyntaxGenerator.GetGenerator(context.Document); 33SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 42SemanticModel model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 53async ct => await ImplementMissingMembersAsync(declaration, typeSymbol, context.Document, context.CancellationToken).ConfigureAwait(false),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OverrideEqualsOnOverloadingOperatorEquals.Fixer.cs (4)
27SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 30typeDeclaration = SyntaxGenerator.GetGenerator(context.Document).GetDeclaration(typeDeclaration); 36SemanticModel model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 50cancellationToken => OverrideObjectEqualsAsync(context.Document, typeDeclaration, typeSymbol, cancellationToken),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OverrideGetHashCodeOnOverridingEquals.Fixer.cs (3)
27SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 30typeDeclaration = SyntaxGenerator.GetGenerator(context.Document).GetDeclaration(typeDeclaration); 42cancellationToken => OverrideObjectGetHashCodeAsync(context.Document, typeDeclaration, cancellationToken),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\OverrideMethodsOnComparableTypes.Fixer.cs (4)
24SyntaxGenerator generator = SyntaxGenerator.GetGenerator(context.Document); 25SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 34SemanticModel model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 45async ct => await ImplementComparableAsync(context.Document, declaration, typeSymbol, ct).ConfigureAwait(false),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\ParameterNamesShouldMatchBaseDeclaration.Fixer.cs (3)
35SyntaxNode syntaxRoot = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 36SemanticModel semanticModel = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 52cancellationToken => GetUpdatedDocumentForParameterRenameAsync(context.Document, declaredSymbol, newName, cancellationToken),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\TypesThatOwnDisposableFieldsShouldBeDisposable.Fixer.cs (3)
28SyntaxGenerator generator = SyntaxGenerator.GetGenerator(context.Document); 29SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 41async ct => await ImplementIDisposableAsync(context.Document, declaration, ct).ConfigureAwait(false),
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\UriParametersShouldNotBeStrings.Fixer.cs (2)
37var document = context.Document; 73context.RegisterCodeFix(CodeAction.Create(title, c => AddMethodAsync(context.Document, context.Span, methodNode, targetNode, uriType, c), equivalenceKey: title), context.Diagnostics);
Microsoft.CodeQuality.Analyzers\Maintainability\AvoidLengthCalculationWhenSlicingToEnd.Fixer.cs (3)
33var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 41var semanticModel = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 54context.Document,
Microsoft.CodeQuality.Analyzers\Maintainability\AvoidUnusedPrivateFields.Fixer.cs (2)
32SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 44async ct => await RemoveFieldAsync(context.Document, node, ct).ConfigureAwait(false),
Microsoft.CodeQuality.Analyzers\Maintainability\MakeTypesInternal.Fixer.cs (2)
17var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 27return Task.FromResult(context.Document.WithSyntaxRoot(newRoot));
Microsoft.CodeQuality.Analyzers\Maintainability\UseNameofInPlaceOfString.Fixer.cs (2)
32var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 46c => ReplaceWithNameOfAsync(context.Document, nodeToReplace, stringText, c),
Microsoft.CodeQuality.Analyzers\QualityGuidelines\MarkMembersAsStatic.Fixer.cs (2)
44var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 54ct => MakeStaticAsync(context.Document, root, node, ct),
Microsoft.CodeQuality.Analyzers\QualityGuidelines\RemoveEmptyFinalizers.Fixer.cs (2)
26SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 36async ct => await RemoveFinalizerAsync(context.Document, node, ct).ConfigureAwait(false),
Microsoft.CodeQuality.Analyzers\QualityGuidelines\RethrowToPreserveStackDetails.Fixer.cs (2)
32var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 44createChangedDocument: c => MakeThrowAsync(context.Document, nodeToReplace, c),
Microsoft.CodeQuality.Analyzers\QualityGuidelines\SealMethodsThatSatisfyPrivateInterfaces.Fixer.cs (3)
32var model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 33var gen = SyntaxGenerator.GetGenerator(context.Document); 43var solution = context.Document.Project.Solution;
Microsoft.CodeQuality.Analyzers\QualityGuidelines\UseLiteralsWhereAppropriate.Fixer.cs (3)
31SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 34declaration = SyntaxGenerator.GetGenerator(context.Document).GetDeclaration(declaration, DeclarationKind.Field); 45cancellationToken => ToConstantDeclarationAsync(context.Document, fieldFeclaration, cancellationToken),
Microsoft.NetCore.Analyzers\ImmutableCollections\DoNotCallToImmutableCollectionOnAnImmutableCollectionValue.Fixer.cs (1)
39var document = context.Document;
Microsoft.NetCore.Analyzers\InteropServices\DynamicInterfaceCastableImplementation.Fixer.cs (4)
30SyntaxGenerator generator = SyntaxGenerator.GetGenerator(context.Document); 31SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 47async ct => await ImplementInterfacesOnDynamicCastableImplementationAsync(root, declaration, context.Document, generator, ct).ConfigureAwait(false), 57async ct => await MakeMemberDeclaredOnImplementationTypeStaticAsync(declaration, context.Document, ct).ConfigureAwait(false),
Microsoft.NetCore.Analyzers\InteropServices\ProvidePublicParameterlessSafeHandleConstructor.Fixer.cs (3)
29SyntaxGenerator generator = SyntaxGenerator.GetGenerator(context.Document); 30SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 44async ct => await MakeParameterlessConstructorPublicAsync(declaration, context.Document, context.CancellationToken).ConfigureAwait(false),
Microsoft.NetCore.Analyzers\InteropServices\SpecifyMarshalingForPInvokeStringArguments.Fixer.cs (4)
27SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 34SemanticModel model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 49async ct => await FixAttributeArgumentsAsync(context.Document, node, charSetType, dllImportType, marshalAsType, unmanagedType, ct).ConfigureAwait(false), 56async ct => await FixDeclareStatementAsync(context.Document, node, ct).ConfigureAwait(false),
Microsoft.NetCore.Analyzers\Performance\DoNotGuardCall.Fixer.cs (2)
30var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 55ct => Task.FromResult(ReplaceConditionWithChild(context.Document, root, conditionalSyntax, childStatementSyntax)),
Microsoft.NetCore.Analyzers\Performance\DoNotUseCountWhenAnyCanBeUsed.Fixer.cs (2)
57var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 69new DoNotUseCountWhenAnyCanBeUsedCodeAction(isAsync, context.Document, node, expression, arguments, shouldNegateKey),
Microsoft.NetCore.Analyzers\Performance\PreferConvertToHexStringOverBitConverter.Fixer.cs (4)
51var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 52var semanticModel = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 87var editor = await DocumentEditor.CreateAsync(context.Document, cancellationToken).ConfigureAwait(false); 123return context.Document.WithSyntaxRoot(editor.GetChangedRoot());
Microsoft.NetCore.Analyzers\Performance\PreferHashDataOverComputeHash.Fixer.cs (3)
28var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 41var codeActionChain = new HashDataCodeAction(context.Document, hashInstanceTarget, Helper, root); 48var codeAction = new HashDataCodeAction(context.Document, hashInstanceTarget, Helper, root);
Microsoft.NetCore.Analyzers\Performance\PreferIsEmptyOverCount.Fixer.cs (2)
25SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 49DocumentEditor editor = await DocumentEditor.CreateAsync(context.Document, cancellationToken).ConfigureAwait(false);
Microsoft.NetCore.Analyzers\Performance\PreferLengthCountIsEmptyOverAny.Fixer.cs (2)
20var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 37var codeAction = CodeAction.Create(codeFixTitle, _ => Task.FromResult(context.Document.WithSyntaxRoot(newRoot)), codeFixTitle);
Microsoft.NetCore.Analyzers\Performance\PreferReadOnlySpanOverSpan.Fixer.cs (3)
29var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 31var semanticModel = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 41createChangedDocument: c => ChangeParameterTypeAsync(context.Document, node, c),
Microsoft.NetCore.Analyzers\Performance\RecommendCaseInsensitiveStringComparison.Fixer.cs (1)
42Document doc = context.Document;
Microsoft.NetCore.Analyzers\Performance\UseAsSpanInsteadOfRangeIndexer.Fixer.cs (2)
38var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 61context.Document,
Microsoft.NetCore.Analyzers\Performance\UsePropertyInsteadOfCountMethodWhenAvailable.Fixer.cs (2)
51var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 60new UsePropertyInsteadOfCountMethodWhenAvailableCodeAction(context.Document, node, expressionNode, nameNode, propertyName),
Microsoft.NetCore.Analyzers\Performance\UseSearchValues.Fixer.cs (2)
36var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 51cancellationToken => ConvertToSearchValuesAsync(context.Document, node, cancellationToken),
Microsoft.NetCore.Analyzers\Performance\UseSpanClearInsteadOfFIll.Fixer.cs (2)
29var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 44DocumentEditor editor = await DocumentEditor.CreateAsync(context.Document, cancellationToken).ConfigureAwait(false);
Microsoft.NetCore.Analyzers\Performance\UseStartsWithInsteadOfIndexOfComparisonWithZero.Fixer.cs (1)
24var document = context.Document;
Microsoft.NetCore.Analyzers\Performance\UseStringContainsCharOverloadWithSingleCharacters.Fixer.cs (3)
22var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 29context.RegisterCodeFix(new ReplaceStringLiteralWithCharLiteralCodeAction(context.Document, violatingNode, sourceCharLiteral, argumentName), context.Diagnostics); 33context.RegisterCodeFix(new ReplaceStringLiteralWithCharLiteralCodeAction(context.Document, violatingNode, sourceCharLiteral), context.Diagnostics);
Microsoft.NetCore.Analyzers\Performance\UseStringMethodCharOverloadWithSingleCharacters.Fixer.cs (3)
23var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 26var model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 29context.RegisterCodeFix(CreateCodeAction(context.Document, argumentListNode, c), context.Diagnostics);
Microsoft.NetCore.Analyzers\Runtime\AvoidConstArrays.Fixer.cs (1)
38Document document = context.Document;
Microsoft.NetCore.Analyzers\Runtime\AvoidUnreliableStreamRead.Fixer.cs (3)
42var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 50var semanticModel = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 78ct => ReplaceWithReadExactlyCall(context.Document, ct),
Microsoft.NetCore.Analyzers\Runtime\AvoidUnsealedAttributes.Fixer.cs (2)
25DocumentEditor editor = await DocumentEditor.CreateAsync(context.Document, context.CancellationToken).ConfigureAwait(false); 26SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
Microsoft.NetCore.Analyzers\Runtime\AvoidZeroLengthArrayAllocations.Fixer.cs (2)
31SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 42async ct => await ConvertToArrayEmptyAsync(context.Document, nodeToFix, ct).ConfigureAwait(false),
Microsoft.NetCore.Analyzers\Runtime\DoNotUseEnumerableMethodsOnIndexableCollectionsInsteadUseTheCollectionDirectly.Fixer.cs (3)
47var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 54var semanticModel = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 79ct => UseCollectionDirectlyAsync(context.Document, root, invocationNode, collectionSyntax, method),
Microsoft.NetCore.Analyzers\Runtime\ForwardCancellationTokenToInvocations.Fixer.cs (1)
54Document doc = context.Document;
Microsoft.NetCore.Analyzers\Runtime\InstantiateArgumentExceptionsCorrectly.Fixer.cs (4)
35SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 46SemanticModel model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 58createChangedDocument: c => AddNullMessageToArgumentListAsync(context.Document, creation, c), 66createChangedDocument: c => SwapArgumentsOrderAsync(context.Document, creation, paramPosition, creation.Arguments.Length, c),
Microsoft.NetCore.Analyzers\Runtime\MarkAllNonSerializableFields.Fixer.cs (4)
28SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 38async ct => await AddNonSerializedAttributeAsync(context.Document, fieldNode, ct).ConfigureAwait(false), 43SemanticModel model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 49async ct => await AddSerializableAttributeToTypeAsync(context.Document, type, ct).ConfigureAwait(false),
Microsoft.NetCore.Analyzers\Runtime\MarkISerializableTypesWithSerializable.Fixer.cs (3)
27SyntaxGenerator generator = SyntaxGenerator.GetGenerator(context.Document); 28SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 38async ct => await AddSerializableAttributeAsync(context.Document, node, ct).ConfigureAwait(false),
Microsoft.NetCore.Analyzers\Runtime\PreferAsSpanOverSubstring.Fixer.cs (1)
33var document = context.Document;
Microsoft.NetCore.Analyzers\Runtime\PreferConstCharOverConstUnitString.Fixer.cs (1)
28Document doc = context.Document;
Microsoft.NetCore.Analyzers\Runtime\PreferJsonElementParse.Fixer.cs (1)
31Document doc = context.Document;
Microsoft.NetCore.Analyzers\Runtime\PreferStreamAsyncMemoryOverloads.Fixer.cs (1)
60Document doc = context.Document;
Microsoft.NetCore.Analyzers\Runtime\PreferStringContainsOverIndexOf.Fixer.cs (1)
27Document doc = context.Document;
Microsoft.NetCore.Analyzers\Runtime\PreferTypedStringBuilderAppendOverloads.Fixer.cs (1)
28Document doc = context.Document;
Microsoft.NetCore.Analyzers\Runtime\SealInternalTypes.Fixer.cs (1)
32var solutionEditor = new SolutionEditor(context.Document.Project.Solution);
Microsoft.NetCore.Analyzers\Runtime\SpecifyCultureForToLowerAndToUpper.Fixer.cs (4)
22var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 27var generator = SyntaxGenerator.GetGenerator(context.Document); 31async ct => await SpecifyCurrentCultureAsync(context.Document, generator, root, node, ct).ConfigureAwait(false), 37async ct => await UseInvariantVersionAsync(context.Document, generator, root, node).ConfigureAwait(false),
Microsoft.NetCore.Analyzers\Runtime\TestForEmptyStringsUsingStringLength.Fixer.cs (4)
31SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 41SemanticModel model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 109DocumentEditor editor = await DocumentEditor.CreateAsync(context.Document, context.CancellationToken).ConfigureAwait(false); 125DocumentEditor editor = await DocumentEditor.CreateAsync(context.Document, context.CancellationToken).ConfigureAwait(false);
Microsoft.NetCore.Analyzers\Runtime\TestForNaNCorrectly.Fixer.cs (3)
31SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 41SemanticModel model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 88DocumentEditor editor = await DocumentEditor.CreateAsync(context.Document, context.CancellationToken).ConfigureAwait(false);
Microsoft.NetCore.Analyzers\Runtime\UseCancellationTokenThrowIfCancellationRequested.Fixer.cs (4)
33SemanticModel model = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 36SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 60var editor = await DocumentEditor.CreateAsync(context.Document, token).ConfigureAwait(false); 87var editor = await DocumentEditor.CreateAsync(context.Document, token).ConfigureAwait(false);
Microsoft.NetCore.Analyzers\Runtime\UseEnvironmentMembersFixer.cs (1)
30Document doc = context.Document;
Microsoft.NetCore.Analyzers\Runtime\UseExceptionThrowHelpersFixer.cs (1)
31Document doc = context.Document;
Microsoft.NetCore.Analyzers\Runtime\UseOrdinalStringComparison.Fixer.cs (4)
22SyntaxGenerator syntaxGenerator = SyntaxGenerator.GetGenerator(context.Document); 23SyntaxNode root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 33async ct => await FixArgumentAsync(context.Document, syntaxGenerator, root, node).ConfigureAwait(false), 42async ct => await FixIdentifierNameAsync(context.Document, syntaxGenerator, root, node, context.CancellationToken).ConfigureAwait(false),
Microsoft.NetCore.Analyzers\Runtime\UseRegexMembersFixer.cs (1)
35Document doc = context.Document;
Microsoft.NetCore.Analyzers\Runtime\UseSpanBasedStringConcat.Fixer.cs (1)
38var document = context.Document;
Microsoft.NetCore.Analyzers\Runtime\UseStringEqualsOverStringCompare.Fixer.cs (1)
30var document = context.Document;
Microsoft.NetCore.Analyzers\Tasks\DoNotCreateTaskCompletionSourceWithWrongArguments.Fixer.cs (1)
29Document doc = context.Document;
Microsoft.NetCore.Analyzers\Tasks\DoNotUseWhenAllOrWaitAllWithSingleArgumentFixer.cs (4)
26var root = await context.Document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); 33var semanticModel = await context.Document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); 45var editor = await DocumentEditor.CreateAsync(context.Document, ct).ConfigureAwait(false); 65var editor = await DocumentEditor.CreateAsync(context.Document, ct).ConfigureAwait(false);
Microsoft.NetCore.Analyzers\Usage\DoNotPassNonNullableValueToArgumentNullExceptionThrowIfNull.Fixer.cs (6)
25var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 40return Task.FromResult(context.Document); 43return Task.FromResult(context.Document.WithSyntaxRoot(newRoot)); 53var newRoot = await GetNewRootForNullableStructAsync(context.Document, invocation, ct).ConfigureAwait(false); 56return context.Document; 59return context.Document.WithSyntaxRoot(newRoot);
Microsoft.NetCore.Analyzers\Usage\PreferGenericOverloads.Fixer.cs (3)
30var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 38var semanticModel = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 48ct => ReplaceWithGenericCallAsync(context.Document, invocation, ct),
Microsoft.NetCore.Analyzers\Usage\UseVolatileReadWrite.Fixer.cs (4)
28var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 30var semanticModel = await context.Document.GetRequiredSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 67var editor = await DocumentEditor.CreateAsync(context.Document, cancellationToken).ConfigureAwait(false); 90return context.Document.WithSyntaxRoot(editor.GetChangedRoot());
OrderedCodeFixProvider.cs (1)
24Document document = context.Document;
Microsoft.CodeAnalysis.VisualBasic.Features (16)
CodeFixes\CorrectNextControlVariable\CorrectNextControlVariableCodeFixProvider.vb (2)
37Dim root = Await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(False) 66context.RegisterCodeFix(New CorrectNextControlVariableCodeAction(context.Document, nodeToReplace, newNode), context.Diagnostics)
CodeFixes\GenerateEndConstruct\GenerateEndConstructCodeFixProvider.vb (4)
65Dim root = Await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(False) 87Function(c) GeneratePropertyEndConstructAsync(context.Document, DirectCast(endStatement.Parent, PropertyBlockSyntax), c), 98Function(c) GeneratePropertyEndConstructAsync(context.Document, DirectCast(endStatement.Parent.Parent, PropertyBlockSyntax), c), 109Function(c) GenerateEndConstructAsync(context.Document, endStatement, c),
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (4)
45Dim root = Await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(False) 56result = Await GenerateEventFromImplementsAsync(context.Document, qualifiedName, context.CancellationToken).ConfigureAwait(False) 61result = Await GenerateEventFromHandlesAsync(context.Document, handlesClauseItem, context.CancellationToken).ConfigureAwait(False) 66result = Await GenerateEventFromAddRemoveHandlerAsync(context.Document, handlerStatement, context.CancellationToken).ConfigureAwait(False)
CodeFixes\IncorrectExitContinue\IncorrectExitContinueCodeFixProvider.vb (1)
59Dim document = context.Document
CodeFixes\IncorrectFunctionReturnType\IncorrectFunctionReturnTypeCodeFixProvider.vb (1)
42Dim document = context.Document
CodeFixes\MoveToTopOfFile\MoveToTopOfFileCodeFixProvider.vb (1)
45Dim document = context.Document
CodeFixes\OverloadBase\OverloadBaseCodeFixProvider.vb (3)
35Dim root = Await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(False) 47context.RegisterCodeFix(New AddKeywordAction(context.Document, token.Parent, VBFeaturesResources.Add_Overloads, SyntaxKind.OverloadsKeyword), context.Diagnostics) 49context.RegisterCodeFix(New AddKeywordAction(context.Document, token.Parent, VBFeaturesResources.Add_Shadows, SyntaxKind.ShadowsKeyword), context.Diagnostics)
Microsoft.CodeAnalysis.VisualBasic.NetAnalyzers (4)
Microsoft.NetCore.Analyzers\Performance\BasicPreferDictionaryTryMethodsOverContainsKeyGuardFixer.vb (1)
24Dim document = context.Document
Microsoft.NetCore.Analyzers\Runtime\BasicPreferDictionaryContainsMethods.Fixer.vb (1)
17Dim doc = context.Document
Microsoft.NetCore.Analyzers\Usage\BasicDoNotCompareSpanToNull.Fixer.vb (2)
19Dim root = Await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(False) 39Function(ct) Task.FromResult(context.Document.WithSyntaxRoot(root.ReplaceNode(binaryExpression, memberAccess))),
Microsoft.CodeAnalysis.Workspaces (3)
CodeFixes\CodeFixContext.cs (2)
45/// This property should be used instead of <see cref="Document"/> property by 52/// Text span within the <see cref="Document"/> or <see cref="TextDocument"/> to fix.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
66return cancellationToken => FixAllAsync(context.Document, diagnostics, cancellationToken);
Microsoft.Interop.ComInterfaceGenerator (2)
Analyzers\AddMarshalAsToElementFixer.cs (1)
25Document doc = context.Document;
src\runtime\src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
119Document doc = context.Document;
Microsoft.Interop.LibraryImportGenerator (3)
Analyzers\AddDisableRuntimeMarshallingAttributeFixer.cs (1)
39ct => AddDisableRuntimeMarshallingAttributeApplicationToProject(context.Document.Project, ct),
Analyzers\CustomMarshallerAttributeFixer.cs (1)
111Document doc = context.Document;
src\runtime\src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
119Document doc = context.Document;
Microsoft.ML.InternalCodeAnalyzer (11)
ContractsCheckNameofFixProvider.cs (7)
39var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 65c => StringReplaceAsync(context.Document, nameArgValue, nameArg, c), Id), diagnostic); 102c => ExpressionReplaceAsync(context.Document, bestSymbol, nameArg, c), Id), diagnostic); 121c => StringReplaceAsync(context.Document, nameArgValue, nameArg, c), Id), diagnostic); 133var semanticModel = await context.Document.GetSemanticModelAsync(context.CancellationToken); 149c => StringReplaceAsync(context.Document, argName + "." + s.Name, nameArg, c), Id), diagnostic); 159c => StringReplaceAsync(context.Document, argName + "." + s.Name, nameArg, c), Id), diagnostic);
NameFixProvider.cs (4)
59var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken); 64string docName = context.Document.Name; 66&& context.Document.Name.StartsWith(originalName, StringComparison.OrdinalIgnoreCase)) 99c => RenameAsync(context.Document, token.Parent, originalName, renamer, c), diagnostic.Id), diagnostic);
Roslyn.Diagnostics.Analyzers (11)
ExportedPartsShouldHaveImportingConstructorCodeFixProvider.cs (3)
50createChangedDocument = cancellationToken => AddExplicitImportingConstructorAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken); 55createChangedDocument = cancellationToken => MakeConstructorPublicAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken); 60createChangedDocument = cancellationToken => AddImportingConstructorAttributeAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken);
ImportingConstructorShouldBeObsoleteCodeFixProvider.cs (5)
47createChangedDocument = cancellationToken => AddObsoleteAttributeAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken); 52createChangedDocument = cancellationToken => AddDescriptionAndErrorAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken); 57createChangedDocument = cancellationToken => UpdateDescriptionAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken); 62createChangedDocument = cancellationToken => AddErrorAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken); 67createChangedDocument = cancellationToken => SetErrorToTrueAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken);
PartsExportedWithMEFv2MustBeMarkedAsShared.Fixer.cs (1)
32var document = context.Document;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (1)
66return cancellationToken => FixAllAsync(context.Document, diagnostics, cancellationToken);
TestExportsShouldNotBeDiscoverableCodeFixProvider.cs (1)
42cancellationToken => AddPartNotDiscoverableAttributeAsync(context.Document, diagnostic.Location.SourceSpan, cancellationToken),
Roslyn.Diagnostics.CSharp.Analyzers (6)
CSharpAvoidOptSuffixForNullableEnableCodeCodeFixProvider.cs (3)
37var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); 44var semanticModel = await context.Document.GetSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); 59cancellationToken => RemoveOptSuffixOnVariableAsync(context.Document, variableSymbol, newName, cancellationToken),
CSharpDoNotUseDebugAssertForInterpolatedStringsFixer.cs (2)
31var compilation = await context.Document.Project.GetCompilationAsync(context.CancellationToken).ConfigureAwait(false); 50ct => ReplaceWithDebugAssertAsync(context.Document, diagnostic.Location, roslynDebugSymbol, ct),
PreferNullLiteralCodeFixProvider.cs (1)
40cancellationToken => ReplaceWithNullLiteralAsync(context.Document, diagnostic.Location, cancellationToken),
System.Text.RegularExpressions.Generator (4)
UpgradeToGeneratedRegexCodeFixer.cs (4)
47if (await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false) is not SyntaxNode root || 67cancellationToken => ConvertFieldToGeneratedRegexProperty(context.Document, root, nodeToFix, fieldDeclaration, cancellationToken), 77cancellationToken => ConvertPropertyToGeneratedRegexProperty(context.Document, root, nodeToFix, propertyDeclaration, cancellationToken), 87cancellationToken => CreateGeneratedRegexProperty(context.Document, root, nodeToFix, cancellationToken),
System.Windows.Forms.Analyzers.CodeFixes.CSharp (2)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (2)
34.Document 52createChangedDocument: c => AddDesignerSerializationAttribute(context.Document, propertyDeclaration, c),
System.Windows.Forms.Analyzers.CodeFixes.VisualBasic (2)
AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.vb (2)
40Document. 59document:=context.Document,