164 types derived from CodeFixProvider
ILLink.CodeFixProvider (2)
Microsoft.Analyzers.Extra (2)
Microsoft.AspNetCore.App.CodeFixes (9)
Microsoft.AspNetCore.Components.Analyzers (1)
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
Microsoft.CodeAnalysis.Analyzers (9)
Microsoft.CodeAnalysis.CodeStyle.Fixes (22)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (20)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.Features (21)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (10)
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (3)
Microsoft.CodeAnalysis.Features (27)
Microsoft.CodeAnalysis.PublicApiAnalyzers.CodeFixes (3)
Microsoft.CodeAnalysis.VisualBasic.Features (7)
Microsoft.CodeAnalysis.Workspaces (1)
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
Microsoft.Interop.ComInterfaceGenerator (2)
Microsoft.Interop.LibraryImportGenerator (3)
Microsoft.ML.InternalCodeAnalyzer (2)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
Microsoft.VisualStudio.LanguageServices.Xaml (1)
Roslyn.Diagnostics.Analyzers (5)
Roslyn.Diagnostics.CSharp.Analyzers (3)
System.Text.RegularExpressions.Generator (1)
System.Windows.Forms.Analyzers.CodeFixes.CSharp (1)
System.Windows.Forms.Analyzers.CodeFixes.VisualBasic (1)
Text.Analyzers (1)
437 references to CodeFixProvider
BuildActionTelemetryTable (1)
GenerateDocumentationAndConfigFiles (11)
Microsoft.Analyzers.Extra.Tests (4)
Microsoft.Analyzers.Local.Tests (4)
Microsoft.AspNetCore.Analyzer.Testing (1)
Microsoft.AspNetCore.App.Analyzers.Test (1)
Microsoft.AspNetCore.Components.Analyzers.Tests (4)
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (4)
Microsoft.CodeAnalysis.Analyzers (2)
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities (4)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests (67)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (10)
Microsoft.CodeAnalysis.CSharp.Features (1)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (82)
Microsoft.CodeAnalysis.EditorFeatures (3)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (26)
CodeFixes\CodeFixServiceTests.cs (18)
201var codeFixes = ImmutableArray.Create<CodeFixProvider>(codeFix);
278private static Task<ImmutableArray<CodeFixCollection>> GetAddedFixesWithExceptionValidationAsync(CodeFixProvider codefix)
281private static async Task<ImmutableArray<CodeFixCollection>> GetAddedFixesAsync(CodeFixProvider codefix, DiagnosticAnalyzer diagnosticAnalyzer, bool exception = false, bool throwExceptionInFixerCreation = false)
309private static async Task GetFirstDiagnosticWithFixWithExceptionValidationAsync(CodeFixProvider codefix)
328CodeFixProvider codefix,
336ImmutableArray<CodeFixProvider> codefixers,
343new Lazy<CodeFixProvider, CodeChangeProviderMetadata>(
392private static IEnumerable<Lazy<CodeFixProvider, CodeChangeProviderMetadata>> CreateFixers()
393=> [new Lazy<CodeFixProvider, CodeChangeProviderMetadata>(() => new MockFixer(), new CodeChangeProviderMetadata("Test", languages: LanguageNames.CSharp))];
432public readonly ImmutableArray<CodeFixProvider> Fixers;
436private static readonly ImmutableArray<CodeFixProvider> s_defaultFixers = [new MockFixer()];
439public MockAnalyzerReference(ImmutableArray<CodeFixProvider> fixers, ImmutableArray<DiagnosticAnalyzer> analyzers, ImmutableArray<ISourceGenerator> generators)
446public MockAnalyzerReference(ImmutableArray<CodeFixProvider> fixers, ImmutableArray<DiagnosticAnalyzer> analyzers)
451public MockAnalyzerReference(CodeFixProvider? fixer, ImmutableArray<DiagnosticAnalyzer> analyzers)
462public MockAnalyzerReference(CodeFixProvider? fixer)
502public ImmutableArray<CodeFixProvider> GetFixers()
751? SpecializedCollections.SingletonEnumerable(new Lazy<CodeFixProvider, CodeChangeProviderMetadata>(() => vsixFixer, new CodeChangeProviderMetadata(name: nameof(VsixCodeFixProvider), languages: LanguageNames.CSharp)))
862var fixers = ImmutableArray.Create<CodeFixProvider>(fixer1, fixer2, fixer3, fixer4);
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (17)
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (1)
Microsoft.CodeAnalysis.Features (69)
CodeFixes\Service\CodeFixService.cs (57)
42private readonly ImmutableArray<Lazy<CodeFixProvider, CodeChangeProviderMetadata>> _fixers;
43private readonly Lazy<ImmutableDictionary<string, ImmutableArray<Lazy<CodeFixProvider, CodeChangeProviderMetadata>>>> _fixersPerLanguageMap;
45private readonly ConditionalWeakTable<IReadOnlyList<AnalyzerReference>, ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>> _projectFixersMap = new();
51private ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>>>? _lazyWorkspaceFixersMap;
52private ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<CodeFixProvider, int>>>? _lazyFixerPriorityMap;
54private ImmutableDictionary<CodeFixProvider, ImmutableArray<DiagnosticId>> _fixerToFixableIdsMap = ImmutableDictionary<CodeFixProvider, ImmutableArray<DiagnosticId>>.Empty;
56private ImmutableDictionary<CodeFixProvider, CodeChangeProviderMetadata?> _fixerToMetadataMap = ImmutableDictionary<CodeFixProvider, CodeChangeProviderMetadata?>.Empty;
62[ImportMany] IEnumerable<Lazy<CodeFixProvider, CodeChangeProviderMetadata>> fixers,
367private bool TryGetWorkspaceFixersMap(TextDocument document, [NotNullWhen(true)] out ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>? fixerMap)
377fixerMap = ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>.Empty;
381using var _ = PooledDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>.GetInstance(out var builder);
393private bool TryGetWorkspaceFixersPriorityMap(TextDocument document, [NotNullWhen(true)] out Lazy<ImmutableDictionary<CodeFixProvider, int>>? fixersPriorityMap)
405Lazy<CodeFixProvider, CodeChangeProviderMetadata> lazyFixer,
408[NotNullWhen(returnValue: true)] out CodeFixProvider? fixer)
467using var _1 = PooledDictionary<CodeFixProvider, List<(TextSpan range, List<DiagnosticData> diagnostics)>>.GetInstance(out var fixerToRangesAndDiagnostics);
468using var _2 = PooledHashSet<CodeFixProvider>.GetInstance(out var currentFixers);
518var diagnosticAndEquivalenceKeyToFixersMap = new Dictionary<(Diagnostic diagnostic, string? equivalenceKey), CodeFixProvider>();
594ImmutableArray<CodeFixProvider> fixers,
597PooledHashSet<CodeFixProvider> currentFixers,
598PooledDictionary<CodeFixProvider, List<(TextSpan range, List<DiagnosticData> diagnostics)>> fixerToRangesAndDiagnostics)
600foreach (var fixer in fixers)
608private CodeChangeProviderMetadata? TryGetMetadata(CodeFixProvider fixer)
630TextDocument document, TextSpan span, CodeFixProvider fixer, CodeChangeProviderMetadata? fixerMetadata,
633Dictionary<(Diagnostic diagnostic, string? equivalenceKey), CodeFixProvider> diagnosticAndEquivalenceKeyToFixersMap,
670CodeFixProvider fixer,
672Dictionary<(Diagnostic diagnostic, string? equivalenceKey), CodeFixProvider> diagnosticAndEquivalenceKeyToFixersMap)
791var codeFixProvider = (fixer as CodeFixProvider) ?? new WrapperCodeFixProvider((IConfigurationFixProvider)fixer, diagnostics.Select(d => d.Id));
813public CodeFixProvider? GetSuppressionFixer(string language, IEnumerable<string> diagnosticIds)
831private bool IsInteractiveCodeFixProvider(CodeFixProvider provider)
838private ImmutableArray<DiagnosticId> GetFixableDiagnosticIds(CodeFixProvider fixer, IExtensionManager? extensionManager)
865private static ImmutableArray<string> GetAndTestFixableDiagnosticIds(CodeFixProvider codeFixProvider)
873codeFixProvider.GetType().Name + "." + nameof(CodeFixProvider.FixableDiagnosticIds)));
879private ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>>> GetFixerPerLanguageMap(
882var fixerMap = ImmutableDictionary.Create<LanguageKind, Lazy<ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>>>();
886var lazyMap = new Lazy<ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>>(() =>
888using var _ = PooledDictionary<DiagnosticId, ArrayBuilder<CodeFixProvider>>.GetInstance(out var mutableMap);
892if (!TryGetWorkspaceFixer(lazyFixer, services, logExceptionWithInfoBar: true, out var fixer))
942private ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<CodeFixProvider, int>>> GetFixerPriorityPerLanguageMap(SolutionServices services)
944var languageMap = ImmutableDictionary.CreateBuilder<LanguageKind, Lazy<ImmutableDictionary<CodeFixProvider, int>>>();
947var lazyMap = new Lazy<ImmutableDictionary<CodeFixProvider, int>>(() =>
949var priorityMap = ImmutableDictionary.CreateBuilder<CodeFixProvider, int>();
954if (!TryGetWorkspaceFixer(fixers[i], services, logExceptionWithInfoBar: false, out var fixer))
969private ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>> GetProjectFixers(TextDocument document)
973? ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>>.Empty
977private ImmutableDictionary<DiagnosticId, ImmutableArray<CodeFixProvider>> ComputeProjectFixers(TextDocument document)
981using var _ = PooledDictionary<DiagnosticId, ArrayBuilder<CodeFixProvider>>.GetInstance(out var builder);
983foreach (var fixer in codeFixProviders)
1005private sealed class FixerComparer : IComparer<CodeFixProvider>
1007private readonly Dictionary<CodeFixProvider, int> _fixerToIndex;
1008private readonly ImmutableDictionary<CodeFixProvider, int> _priorityMap;
1011ImmutableArray<CodeFixProvider> allFixers,
1012ImmutableDictionary<CodeFixProvider, int> priorityMap)
1018public int Compare([AllowNull] CodeFixProvider x, [AllowNull] CodeFixProvider y)
1049public ImmutableDictionary<LanguageKind, Lazy<ImmutableDictionary<CodeFixProvider, int>>> GetFixerPriorityPerLanguageMap(SolutionServices services)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests (40)
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (19)
Microsoft.CodeAnalysis.Workspaces (40)
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
Microsoft.Gen.ComplianceReports.Unit.Tests (1)
Microsoft.Gen.ContextualOptions.Unit.Tests (1)
Microsoft.Gen.Logging.Unit.Tests (1)
Microsoft.Gen.MetadataExtractor.Unit.Tests (1)
Microsoft.Gen.Metrics.Unit.Tests (1)
Microsoft.Gen.MetricsReports.Unit.Tests (1)
Microsoft.ML.CodeAnalyzer.Tests (1)
Microsoft.VisualStudio.LanguageServices (3)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (5)
Test.Utilities (8)