1 write to Diagnostics
Microsoft.CodeAnalysis.Workspaces (1)
CodeFixes\CodeFixContext.cs (1)
127Diagnostics = diagnostics;
320 references to Diagnostics
ILLink.CodeFixProvider (2)
BaseAttributeCodeFixProvider.cs (1)
36 var diagnostic = context.Diagnostics.First ();
DynamicallyAccessedMembersCodeFixProvider.cs (1)
96 var diagnostic = context.Diagnostics[0];
Microsoft.Analyzers.Extra (2)
CallAnalysis\Fixers\LegacyLoggingFixer.cs (1)
66context.Diagnostics);
MakeExeTypesInternalFixer.cs (1)
33context.RegisterCodeFix(action, context.Diagnostics);
Microsoft.AspNetCore.App.CodeFixes (9)
Authorization\AddAuthorizationBuilderFixer.cs (1)
41foreach (var diagnostic in context.Diagnostics)
Dependencies\AddPackageFixer.cs (1)
47foreach (var diagnostic in context.Diagnostics)
DetectMismatchedParameterOptionalityFixer.cs (1)
25foreach (var diagnostic in context.Diagnostics)
Http\HeaderDictionaryAddFixer.cs (1)
44foreach (var diagnostic in context.Diagnostics)
Http\HeaderDictionaryIndexerFixer.cs (1)
25foreach (var diagnostic in context.Diagnostics)
Kestrel\ListenOnIPv6AnyFixer.cs (1)
26foreach (var diagnostic in context.Diagnostics)
PublicPartialProgramClassFixer.cs (1)
25foreach (var diagnostic in context.Diagnostics)
RouteParameterUnusedParameterFixer.cs (1)
45foreach (var diagnostic in context.Diagnostics)
WebApplicationBuilderFixer.cs (1)
37foreach (var diagnostic in context.Diagnostics)
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
34var diagnostic = context.Diagnostics.First();
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
34var diagnostic = context.Diagnostics.First();
Microsoft.AspNetCore.Mvc.Api.Analyzers (3)
AddResponseTypeAttributeCodeFixProvider.cs (1)
24var diagnostic = context.Diagnostics[0];
ApiActionsDoNotRequireExplicitModelValidationCodeFixProvider.cs (2)
27if (context.Diagnostics.Length != 1) 32var diagnostic = context.Diagnostics[0];
Microsoft.CodeAnalysis.CodeStyle.Fixes (66)
src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AbstractAddAccessibilityModifiersCodeFixProvider.cs (1)
28var diagnostic = context.Diagnostics.First();
src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (2)
38var diagnostic = context.Diagnostics[0]; 50context.Diagnostics);
src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (2)
70var diagnostic = context.Diagnostics.First(); 112context.Diagnostics);
src\Analyzers\Core\CodeFixes\AddObsoleteAttribute\AbstractAddObsoleteAttributeCodeFixProvider.cs (1)
46var node = context.Diagnostics[0].Location.FindNode(cancellationToken);
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (2)
64var diagnostic = context.Diagnostics.First(); 252context.RegisterFixes(fixes, context.Diagnostics);
src\Analyzers\Core\CodeFixes\AddRequiredParentheses\AddRequiredParenthesesCodeFixProvider.cs (2)
32var firstDiagnostic = context.Diagnostics[0]; 38context.Diagnostics);
src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (1)
75context.Diagnostics.First());
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (3)
288context.Diagnostics); 293context.Diagnostics); 298context.Diagnostics);
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (2)
38var diagnostic = context.Diagnostics.FirstOrDefault(); 44context.RegisterCodeFix(codeAction, context.Diagnostics);
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (1)
46context.Diagnostics);
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
45context.Diagnostics);
src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (1)
33foreach (var diagnostic in context.Diagnostics)
src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (1)
32if (context.Diagnostics.First().Properties.ContainsKey(ForEachCastHelpers.IsFixable))
src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (1)
43foreach (var diagnostic in context.Diagnostics)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
24var diagnostic = context.Diagnostics.FirstOrDefault();
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (2)
39var diagnostic = context.Diagnostics.First(); 53context.RegisterFixes(codeActions, context.Diagnostics);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\AbstractImplementAbstractClassCodeFixProvider.cs (2)
51context.Diagnostics); 65context.Diagnostics);
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (1)
66context.RegisterFixes(codeActions, context.Diagnostics);
src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (1)
34var diagnostic = context.Diagnostics.FirstOrDefault();
src\Analyzers\Core\CodeFixes\MakeMemberStatic\AbstractMakeMemberStaticCodeFixProvider.cs (2)
23if (context.Diagnostics.Length == 1 && 24TryGetMemberDeclaration(context.Diagnostics[0].Location.FindNode(context.CancellationToken), out _))
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (3)
36var diagnostic = context.Diagnostics.First(); 72context.Diagnostics); 83context.Diagnostics);
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (2)
32var diagnostic = context.Diagnostics.First(); 43context.Diagnostics);
src\Analyzers\Core\CodeFixes\MakeTypeAbstract\AbstractMakeTypeAbstractCodeFixProvider.cs (1)
24if (IsValidRefactoringContext(context.Diagnostics[0].Location?.FindNode(context.CancellationToken), out _))
src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (2)
33cancellationToken => FixAllInDocumentAsync(context.Document, context.Diagnostics, 36context.Diagnostics);
src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
48var diagnostic = context.Diagnostics.First();
src\Analyzers\Core\CodeFixes\NewLines\ConsecutiveStatementPlacement\ConsecutiveStatementPlacementCodeFixProvider.cs (2)
32var diagnostic = context.Diagnostics.First(); 37context.Diagnostics);
src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (2)
32var diagnostic = context.Diagnostics.First(); 37context.Diagnostics);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (4)
57var diagnostic = context.Diagnostics.First(); 74context.Diagnostics); 86context.Diagnostics); 98context.Diagnostics);
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (2)
36var diagnostic = context.Diagnostics.First(); 59context.Diagnostics);
src\Analyzers\Core\CodeFixes\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsCodeFixProvider.cs (1)
33context.Diagnostics);
src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs (1)
30foreach (var diagnostic in context.Diagnostics)
src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs (1)
36foreach (var diagnostic in context.Diagnostics)
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (1)
134var diagnostic = context.Diagnostics[0];
src\Analyzers\Core\CodeFixes\UnsealClass\AbstractUnsealClassCodeFixProvider.cs (1)
52context.Diagnostics);
src\Analyzers\Core\CodeFixes\UpdateLegacySuppressions\UpdateLegacySuppressionsCodeFixProvider.cs (1)
31foreach (var diagnostic in context.Diagnostics)
src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (2)
35var diagnostics = context.Diagnostics; 45var newVersion = SuggestedVersion(context.Diagnostics);
src\Analyzers\Core\CodeFixes\UseCollectionExpression\AbstractUseCollectionExpressionCodeFixProvider.cs (1)
23var changesSemantics = UseCollectionInitializerHelpers.ChangesSemantics(context.Diagnostics[0]);
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForAssignment\AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
46var (title, key) = context.Diagnostics.First().Properties.ContainsKey(UseConditionalExpressionHelpers.CanSimplifyName)
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForReturn\AbstractUseConditionalExpressionForReturnCodeFixProvider.cs (1)
39var (title, key) = context.Diagnostics.First().Properties.ContainsKey(UseConditionalExpressionHelpers.CanSimplifyName)
src\Analyzers\Core\CodeFixes\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (2)
37var diagnostic = context.Diagnostics.First(); 44context.Diagnostics);
src\Analyzers\Core\CodeFixes\UseNullPropagation\AbstractUseNullPropagationCodeFixProvider.cs (1)
64var firstDiagnostic = context.Diagnostics.First();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (3)
49=> context.RegisterCodeFix(CodeAction.Create(title, GetDocumentUpdater(context, diagnostic), equivalenceKey), context.Diagnostics); 52=> context.RegisterCodeFix(CodeAction.Create(title, GetDocumentUpdater(context, diagnostic), equivalenceKey, priority), context.Diagnostics); 56var diagnostics = ImmutableArray.Create(diagnostic ?? context.Diagnostics[0]);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (52)
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (1)
43foreach (var diagnostic in context.Diagnostics)
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AssignOutParametersAtStartCodeFixProvider.cs (1)
52context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
38var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceCodeFixProvider.cs (2)
34var diagnostic = context.Diagnostics.First(); 46context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
39var switchLocation = context.Diagnostics.First().AdditionalLocations[0];
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\CSharpConvertToRecordCodeFixProvider.cs (1)
47context.RegisterCodeFix(action, context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
40var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
67var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
39var diagnostics = context.Diagnostics;
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
112context.RegisterFixes(codeActions, context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (2)
32var diagnostic = context.Diagnostics.First(); 44context.RegisterCodeFix(new AddNewKeywordAction(context.Document, originalNode), context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\MakeAnonymousFunctionStatic\CSharpMakeAnonymousFunctionStaticCodeFixProvider.cs (1)
33context.Diagnostics[0].Severity > DiagnosticSeverity.Hidden ? CodeActionPriority.Default : CodeActionPriority.Low);
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (1)
33var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\MakeRefStruct\MakeRefStructCodeFixProvider.cs (1)
59context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (1)
34var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
72foreach (var diagnostic in context.Diagnostics)
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (2)
34var diagnostic = context.Diagnostics.First(); 40context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (2)
34var diagnostic = context.Diagnostics.First(); 40context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (2)
34var diagnostic = context.Diagnostics.First(); 40context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (2)
33var diagnostic = context.Diagnostics.First(); 39context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (2)
36var diagnostic = context.Diagnostics.First(); 42context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
47var node = context.Diagnostics.First().Location.FindNode(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (3)
37var diagnostics = context.Diagnostics; 45context.Diagnostics); 52context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (2)
37var diagnostic = context.Diagnostics.First(); 51context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (2)
35var diagnostic = context.Diagnostics.First(); 53context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveCodeFixProvider.cs (1)
38foreach (var diagnostic in context.Diagnostics)
src\Analyzers\CSharp\CodeFixes\RemoveUnreachableCode\CSharpRemoveUnreachableCodeCodeFixProvider.cs (1)
29var diagnostic = context.Diagnostics[0];
src\Analyzers\CSharp\CodeFixes\RemoveUnusedLocalFunction\CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs (1)
38context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
59context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (1)
85var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
35_ => Task.FromResult(AllowUnsafeOnProject(context.Document.Project))), context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
97var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\UseExplicitTypeForConst\UseExplicitTypeForConstCodeFixProvider.cs (1)
57context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\UseExpressionBody\UseExpressionBodyCodeFixProvider.cs (1)
41var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeFixProvider.cs (2)
30var diagnostic = context.Diagnostics[0]; 38context.RegisterCodeFix(codeAction, context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (2)
39var diagnostic = context.Diagnostics.First(); 47context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
60var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
61foreach (var diagnostic in context.Diagnostics)
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (1)
45foreach (var diagnostic in context.Diagnostics)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
Diagnostics\FixAllProvider\BatchFixerTests.cs (1)
91context.RegisterCodeFix(fix, context.Diagnostics);
Formatting\CodeCleanupTests.TestFixers.cs (1)
25foreach (var diagnostic in context.Diagnostics)
Microsoft.CodeAnalysis.CSharp.Features (54)
Copilot\CSharpCopilotCodeFixProvider.cs (1)
79foreach (var diagnostic in context.Diagnostics)
src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (1)
43foreach (var diagnostic in context.Diagnostics)
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AssignOutParametersAtStartCodeFixProvider.cs (1)
52context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
38var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceCodeFixProvider.cs (2)
34var diagnostic = context.Diagnostics.First(); 46context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
39var switchLocation = context.Diagnostics.First().AdditionalLocations[0];
src\Analyzers\CSharp\CodeFixes\ConvertToRecord\CSharpConvertToRecordCodeFixProvider.cs (1)
47context.RegisterCodeFix(action, context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
40var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (1)
67var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
39var diagnostics = context.Diagnostics;
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
112context.RegisterFixes(codeActions, context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (2)
32var diagnostic = context.Diagnostics.First(); 44context.RegisterCodeFix(new AddNewKeywordAction(context.Document, originalNode), context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\MakeAnonymousFunctionStatic\CSharpMakeAnonymousFunctionStaticCodeFixProvider.cs (1)
33context.Diagnostics[0].Severity > DiagnosticSeverity.Hidden ? CodeActionPriority.Default : CodeActionPriority.Low);
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (1)
33var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\MakeRefStruct\MakeRefStructCodeFixProvider.cs (1)
59context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (1)
34var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
72foreach (var diagnostic in context.Diagnostics)
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (2)
34var diagnostic = context.Diagnostics.First(); 40context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (2)
34var diagnostic = context.Diagnostics.First(); 40context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (2)
34var diagnostic = context.Diagnostics.First(); 40context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (2)
33var diagnostic = context.Diagnostics.First(); 39context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (2)
36var diagnostic = context.Diagnostics.First(); 42context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (1)
47var node = context.Diagnostics.First().Location.FindNode(getInnermostNodeForTie: true, cancellationToken);
src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (3)
37var diagnostics = context.Diagnostics; 45context.Diagnostics); 52context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (2)
37var diagnostic = context.Diagnostics.First(); 51context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (2)
35var diagnostic = context.Diagnostics.First(); 53context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveCodeFixProvider.cs (1)
38foreach (var diagnostic in context.Diagnostics)
src\Analyzers\CSharp\CodeFixes\RemoveUnreachableCode\CSharpRemoveUnreachableCodeCodeFixProvider.cs (1)
29var diagnostic = context.Diagnostics[0];
src\Analyzers\CSharp\CodeFixes\RemoveUnusedLocalFunction\CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs (1)
38context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (1)
59context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (1)
85var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
35_ => Task.FromResult(AllowUnsafeOnProject(context.Document.Project))), context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
97var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\UseExplicitTypeForConst\UseExplicitTypeForConstCodeFixProvider.cs (1)
57context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\UseExpressionBody\UseExpressionBodyCodeFixProvider.cs (1)
41var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeFixProvider.cs (2)
30var diagnostic = context.Diagnostics[0]; 38context.RegisterCodeFix(codeAction, context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (2)
39var diagnostic = context.Diagnostics.First(); 47context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (1)
60var diagnostic = context.Diagnostics.First();
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
61foreach (var diagnostic in context.Diagnostics)
src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (1)
45foreach (var diagnostic in context.Diagnostics)
UsePatternMatching\CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs (1)
38context.Diagnostics);
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (7)
CodeFixes\CodeFixServiceTests.cs (6)
432ContextDiagnosticsCount = context.Diagnostics.Length; 439context.Diagnostics); 816var fixableDiagnostics = context.Diagnostics.WhereAsArray(d => FixableDiagnosticIds.Contains(d.Id)); 865context.Diagnostics); 953context.Diagnostics[0]); 1228context.Diagnostics);
CodeFixes\ErrorCases\CodeFixExceptionInGetFixAllProvider.cs (1)
28context.RegisterCodeFix(CodeAction.Create("Do Nothing", token => Task.FromResult(context.Document)), context.Diagnostics[0]);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (3)
CodeFixes\CodeFixServiceTests.vb (2)
230context.RegisterCodeFix(CodeAction.Create("FIX_TEST0000", Function(ct) Task.FromResult(context.Document.WithSyntaxRoot(root))), context.Diagnostics) 255context.RegisterCodeFix(CodeAction.Create("FIX_TEST1111", Function(ct) Task.FromResult(context.Document.WithSyntaxRoot(root))), context.Diagnostics)
Diagnostics\AdditionalFileDiagnosticsTests.vb (1)
123context.RegisterCodeFix(CodeAction.Create("Request serialization permission", Function(ct) Task.FromResult(newSln)), context.Diagnostics)
Microsoft.CodeAnalysis.Features (81)
AddImport\AbstractAddImportCodeFixProvider.cs (1)
56var diagnostics = context.Diagnostics;
AddMissingReference\AbstractAddMissingReferenceCodeFixProvider.cs (3)
41context.RegisterFixes(addPackageCodeActions, context.Diagnostics); 42context.RegisterFixes(addReferenceCodeActions, context.Diagnostics); 64foreach (var diagnostic in context.Diagnostics)
AddPackage\AbstractAddSpecificPackageCodeFixProvider.cs (2)
35var assemblyName = GetAssemblyName(context.Diagnostics[0].Id); 41context.RegisterFixes(addPackageCodeActions, context.Diagnostics);
CodeFixes\Suppression\WrapperCodeFixProvider.cs (1)
23var diagnostics = context.Diagnostics.Where(SuppressionFixProvider.IsFixableDiagnostic);
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDetectionCodeFixProvider.cs (1)
42context.Diagnostics);
FullyQualify\AbstractFullyQualifyCodeFixProvider.cs (2)
52isInlinable: true), context.Diagnostics); 56context.RegisterFixes(codeActions, context.Diagnostics);
PreferFrameworkType\PreferFrameworkTypeCodeFixProvider.cs (2)
32var diagnostic = context.Diagnostics[0]; 40context.Diagnostics);
RemoveUnusedVariable\AbstractRemoveUnusedVariableCodeFixProvider.cs (1)
41var diagnostic = context.Diagnostics.First();
SimplifyThisOrMe\AbstractSimplifyThisOrMeCodeFixProvider.cs (1)
37context.Diagnostics);
SimplifyTypeNames\AbstractSimplifyTypeNamesCodeFixProvider.cs (1)
98context.Diagnostics);
SpellCheck\AbstractSpellCheckCodeFixProvider.cs (2)
190context.Diagnostics); 194context.RegisterFixes(codeActions, context.Diagnostics);
src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AbstractAddAccessibilityModifiersCodeFixProvider.cs (1)
28var diagnostic = context.Diagnostics.First();
src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (2)
38var diagnostic = context.Diagnostics[0]; 50context.Diagnostics);
src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (2)
70var diagnostic = context.Diagnostics.First(); 112context.Diagnostics);
src\Analyzers\Core\CodeFixes\AddObsoleteAttribute\AbstractAddObsoleteAttributeCodeFixProvider.cs (1)
46var node = context.Diagnostics[0].Location.FindNode(cancellationToken);
src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (2)
64var diagnostic = context.Diagnostics.First(); 252context.RegisterFixes(fixes, context.Diagnostics);
src\Analyzers\Core\CodeFixes\AddRequiredParentheses\AddRequiredParenthesesCodeFixProvider.cs (2)
32var firstDiagnostic = context.Diagnostics[0]; 38context.Diagnostics);
src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (1)
75context.Diagnostics.First());
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (3)
288context.Diagnostics); 293context.Diagnostics); 298context.Diagnostics);
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (2)
38var diagnostic = context.Diagnostics.FirstOrDefault(); 44context.RegisterCodeFix(codeAction, context.Diagnostics);
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractAddDocCommentNodesCodeFixProvider.cs (1)
46context.Diagnostics);
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
45context.Diagnostics);
src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (1)
33foreach (var diagnostic in context.Diagnostics)
src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (1)
32if (context.Diagnostics.First().Properties.ContainsKey(ForEachCastHelpers.IsFixable))
src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (1)
43foreach (var diagnostic in context.Diagnostics)
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
24var diagnostic = context.Diagnostics.FirstOrDefault();
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (2)
39var diagnostic = context.Diagnostics.First(); 53context.RegisterFixes(codeActions, context.Diagnostics);
src\Analyzers\Core\CodeFixes\ImplementAbstractClass\AbstractImplementAbstractClassCodeFixProvider.cs (2)
51context.Diagnostics); 65context.Diagnostics);
src\Analyzers\Core\CodeFixes\ImplementInterface\AbstractImplementInterfaceCodeFixProvider.cs (1)
66context.RegisterFixes(codeActions, context.Diagnostics);
src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (1)
34var diagnostic = context.Diagnostics.FirstOrDefault();
src\Analyzers\Core\CodeFixes\MakeMemberStatic\AbstractMakeMemberStaticCodeFixProvider.cs (2)
23if (context.Diagnostics.Length == 1 && 24TryGetMemberDeclaration(context.Diagnostics[0].Location.FindNode(context.CancellationToken), out _))
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (3)
36var diagnostic = context.Diagnostics.First(); 72context.Diagnostics); 83context.Diagnostics);
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (2)
32var diagnostic = context.Diagnostics.First(); 43context.Diagnostics);
src\Analyzers\Core\CodeFixes\MakeTypeAbstract\AbstractMakeTypeAbstractCodeFixProvider.cs (1)
24if (IsValidRefactoringContext(context.Diagnostics[0].Location?.FindNode(context.CancellationToken), out _))
src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (2)
33cancellationToken => FixAllInDocumentAsync(context.Document, context.Diagnostics, 36context.Diagnostics);
src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
48var diagnostic = context.Diagnostics.First();
src\Analyzers\Core\CodeFixes\NewLines\ConsecutiveStatementPlacement\ConsecutiveStatementPlacementCodeFixProvider.cs (2)
32var diagnostic = context.Diagnostics.First(); 37context.Diagnostics);
src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (2)
32var diagnostic = context.Diagnostics.First(); 37context.Diagnostics);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (4)
57var diagnostic = context.Diagnostics.First(); 74context.Diagnostics); 86context.Diagnostics); 98context.Diagnostics);
src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (2)
36var diagnostic = context.Diagnostics.First(); 59context.Diagnostics);
src\Analyzers\Core\CodeFixes\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsCodeFixProvider.cs (1)
33context.Diagnostics);
src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs (1)
30foreach (var diagnostic in context.Diagnostics)
src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs (1)
36foreach (var diagnostic in context.Diagnostics)
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (1)
134var diagnostic = context.Diagnostics[0];
src\Analyzers\Core\CodeFixes\UnsealClass\AbstractUnsealClassCodeFixProvider.cs (1)
52context.Diagnostics);
src\Analyzers\Core\CodeFixes\UpdateLegacySuppressions\UpdateLegacySuppressionsCodeFixProvider.cs (1)
31foreach (var diagnostic in context.Diagnostics)
src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (2)
35var diagnostics = context.Diagnostics; 45var newVersion = SuggestedVersion(context.Diagnostics);
src\Analyzers\Core\CodeFixes\UseCollectionExpression\AbstractUseCollectionExpressionCodeFixProvider.cs (1)
23var changesSemantics = UseCollectionInitializerHelpers.ChangesSemantics(context.Diagnostics[0]);
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForAssignment\AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
46var (title, key) = context.Diagnostics.First().Properties.ContainsKey(UseConditionalExpressionHelpers.CanSimplifyName)
src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForReturn\AbstractUseConditionalExpressionForReturnCodeFixProvider.cs (1)
39var (title, key) = context.Diagnostics.First().Properties.ContainsKey(UseConditionalExpressionHelpers.CanSimplifyName)
src\Analyzers\Core\CodeFixes\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (2)
37var diagnostic = context.Diagnostics.First(); 44context.Diagnostics);
src\Analyzers\Core\CodeFixes\UseNullPropagation\AbstractUseNullPropagationCodeFixProvider.cs (1)
64var firstDiagnostic = context.Diagnostics.First();
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (1)
68foreach (var diagnostic in context.Diagnostics)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (2)
src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryByVal\VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb (1)
30For Each diagnostic In context.Diagnostics
src\Analyzers\VisualBasic\CodeFixes\SimplifyObjectCreation\VisualBasicSimplifyObjectCreationCodeFixProvider.vb (1)
28For Each diagnostic In context.Diagnostics
Microsoft.CodeAnalysis.VisualBasic.Features (16)
CodeFixes\CorrectNextControlVariable\CorrectNextControlVariableCodeFixProvider.vb (1)
66context.RegisterCodeFix(New CorrectNextControlVariableCodeAction(context.Document, nodeToReplace, newNode), context.Diagnostics)
CodeFixes\GenerateEndConstruct\GenerateEndConstructCodeFixProvider.vb (3)
89context.Diagnostics) 100context.Diagnostics) 111context.Diagnostics)
CodeFixes\GenerateEvent\GenerateEventCodeFixProvider.vb (1)
70context.RegisterCodeFix(result, context.Diagnostics)
CodeFixes\IncorrectExitContinue\IncorrectExitContinueCodeFixProvider.vb (2)
81context.RegisterCodeFix(New RemoveStatementCodeAction(document, node, CreateDeleteString(node)), context.Diagnostics) 91context.RegisterFixes(codeActions, context.Diagnostics)
CodeFixes\IncorrectFunctionReturnType\IncorrectFunctionReturnTypeCodeFixProvider.vb (2)
59context.Diagnostics) 68context.Diagnostics)
CodeFixes\MoveToTopOfFile\MoveToTopOfFileCodeFixProvider.vb (1)
89context.RegisterFixes(result, context.Diagnostics)
CodeFixes\OverloadBase\OverloadBaseCodeFixProvider.vb (3)
39Dim diagnostic = context.Diagnostics.First() 49context.RegisterCodeFix(New AddKeywordAction(context.Document, token.Parent, VBFeaturesResources.Add_Overloads, SyntaxKind.OverloadsKeyword), context.Diagnostics) 51context.RegisterCodeFix(New AddKeywordAction(context.Document, token.Parent, VBFeaturesResources.Add_Shadows, SyntaxKind.ShadowsKeyword), context.Diagnostics)
RemoveSharedFromModuleMembers\VisualBasicRemoveSharedFromModuleMembersCodeFixProvider.vb (1)
40For Each diagnostic In context.Diagnostics
src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryByVal\VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb (1)
30For Each diagnostic In context.Diagnostics
src\Analyzers\VisualBasic\CodeFixes\SimplifyObjectCreation\VisualBasicSimplifyObjectCreationCodeFixProvider.vb (1)
28For Each diagnostic In context.Diagnostics
Microsoft.CodeAnalysis.Workspaces (6)
CodeFixes\CodeFixContext.cs (3)
185/// <param name="diagnostic">The subset of <see cref="Diagnostics"/> being addressed / fixed by the <paramref name="action"/>.</param> 205/// <param name="diagnostics">The subset of <see cref="Diagnostics"/> being addressed / fixed by the <paramref name="action"/>.</param> 220/// <param name="diagnostics">The subset of <see cref="Diagnostics"/> being addressed / fixed by the <paramref name="action"/>.</param>
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (3)
49=> context.RegisterCodeFix(CodeAction.Create(title, GetDocumentUpdater(context, diagnostic), equivalenceKey), context.Diagnostics); 52=> context.RegisterCodeFix(CodeAction.Create(title, GetDocumentUpdater(context, diagnostic), equivalenceKey, priority), context.Diagnostics); 56var diagnostics = ImmutableArray.Create(diagnostic ?? context.Diagnostics[0]);
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
BatchFixAllProviderTests.cs (1)
97foreach (var diagnostic in context.Diagnostics)
Microsoft.Interop.ComInterfaceGenerator (2)
Analyzers\AddMarshalAsToElementFixer.cs (1)
32foreach (var diagnostic in context.Diagnostics)
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
128foreach (Diagnostic diagnostic in context.Diagnostics)
Microsoft.Interop.LibraryImportGenerator (3)
Analyzers\AddDisableRuntimeMarshallingAttributeFixer.cs (1)
32List<Diagnostic> fixedDiagnostics = new(context.Diagnostics.Where(IsRequiresDiableRuntimeMarshallingDiagnostic));
Analyzers\CustomMarshallerAttributeFixer.cs (1)
117var (missingMemberNames, missingMembersDiagnostics) = GetRequiredShapeMissingMemberNames(context.Diagnostics);
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
128foreach (Diagnostic diagnostic in context.Diagnostics)
Microsoft.ML.InternalCodeAnalyzer (2)
ContractsCheckNameofFixProvider.cs (1)
36var diagnostic = context.Diagnostics.FirstOrDefault(d => d.Id == Id);
NameFixProvider.cs (1)
51var diagnostic = context.Diagnostics[0];
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
EditorConfigSettings\DataProvider\DataProviderTests.MockAnalyzerReference.cs (1)
66ContextDiagnosticsCount = context.Diagnostics.Length;
Microsoft.VisualStudio.LanguageServices.Xaml (1)
CodeFixes\RemoveUnnecessaryUsings\XamlRemoveUnnecessaryUsingsCodeFixProvider.cs (1)
50context.Diagnostics);
System.Text.RegularExpressions.Generator (1)
UpgradeToGeneratedRegexCodeFixer.cs (1)
62context.Diagnostics);
System.Windows.Forms.Analyzers.CodeFixes.CSharp (1)
System\Windows\Forms\CSharp\CodeFixes\AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.cs (1)
38Diagnostic diagnostic = context.Diagnostics.First();
System.Windows.Forms.Analyzers.CodeFixes.VisualBasic (1)
AddDesignerSerializationVisibility\AddDesignerSerializationVisibilityCodeFixProvider.vb (1)
44Dim diagnostic As Diagnostic = context.Diagnostics.First()