5 types derived from Diagnostic
Microsoft.CodeAnalysis (5)
CommandLine\CommonCompiler.SuppressionDiagnostic.cs (1)
18private sealed class SuppressionDiagnostic : Diagnostic
Diagnostic\Diagnostic.DiagnosticWithProgrammaticSuppression.cs (1)
16private sealed class DiagnosticWithProgrammaticSuppression : Diagnostic
Diagnostic\Diagnostic_SimpleDiagnostic.cs (1)
20internal sealed class SimpleDiagnostic : Diagnostic
Diagnostic\DiagnosticWithInfo.cs (1)
18internal class DiagnosticWithInfo : Diagnostic
DiagnosticAnalyzer\CompilerDiagnosticAnalyzer.CompilationAnalyzer.cs (1)
76private sealed class CompilerDiagnostic : Diagnostic
3533 references to Diagnostic
Aspire.Hosting.Analyzers (1)
AppHostAnalyzer.DetectInvalidModelNames.cs (1)
32context.ReportDiagnostic(Diagnostic.Create(Diagnostics.s_modelNameMustBeValid, token.GetLocation(), validationMessage));
Aspire.Hosting.Integration.Analyzers (11)
AspireExportAnalyzer.cs (11)
165context.ReportDiagnostic(Diagnostic.Create( 175context.ReportDiagnostic(Diagnostic.Create( 184context.ReportDiagnostic(Diagnostic.Create( 196context.ReportDiagnostic(Diagnostic.Create( 256context.ReportDiagnostic(Diagnostic.Create( 322context.ReportDiagnostic(Diagnostic.Create( 357context.ReportDiagnostic(Diagnostic.Create( 719context.ReportDiagnostic(Diagnostic.Create( 737context.ReportDiagnostic(Diagnostic.Create( 750context.ReportDiagnostic(Diagnostic.Create( 772context.ReportDiagnostic(Diagnostic.Create(
ConfigurationSchemaGenerator (2)
RuntimeSource\SourceGenerators\DiagnosticInfo.cs (2)
37public Diagnostic CreateDiagnostic() 38=> Diagnostic.Create(Descriptor, Location, MessageArgs);
dotnet-format (18)
Analyzers\AnalyzerFormatter.cs (2)
174static void LogDiagnosticLocations(Solution solution, IEnumerable<Diagnostic> diagnostics, bool saveFormattedFiles, bool changesAreErrors, ILogger logger, LogLevel logLevel, List<FormattedFile> formattedFiles) 176foreach (var diagnostic in diagnostics)
Analyzers\AnalyzerRunner.cs (3)
58: ImmutableArray<Diagnostic>.Empty; 60ImmutableArray<Diagnostic> diagnostics; 82foreach (var diagnostic in diagnostics)
Analyzers\CodeAnalysisResult.cs (4)
10private readonly Dictionary<Project, List<Diagnostic>> _dictionary = new(); 20internal void AddDiagnostic(Project project, Diagnostic diagnostic) 35_dictionary.Add(project, new List<Diagnostic>() { diagnostic }); 43public IReadOnlyDictionary<Project, List<Diagnostic>> Diagnostics
Analyzers\SolutionCodeFixApplier.cs (8)
31var diagnostic = result.Diagnostics 96private static Task<IEnumerable<Diagnostic>> EmptyDignosticResult => Task.FromResult(Enumerable.Empty<Diagnostic>()); 97private readonly IReadOnlyDictionary<Project, List<Diagnostic>> _diagnosticsByProject; 104public override Task<IEnumerable<Diagnostic>> GetAllDiagnosticsAsync(Project project, CancellationToken cancellationToken) 109public override async Task<IEnumerable<Diagnostic>> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken) 115public override Task<IEnumerable<Diagnostic>> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken) 118? Task.FromResult<IEnumerable<Diagnostic>>(_diagnosticsByProject[project])
Logging\ILoggerExtensions.cs (1)
19public static string LogDiagnosticIssue(this ILogger logger, Document document, LinePosition diagnosticPosition, Diagnostic diagnostic, bool changesAreErrors)
EventSourceGenerator (5)
EventSourceGenerator.cs (1)
50Diagnostic Diagnostic,
EventSourceGenerator.Parser.cs (4)
57var diagnostic = Diagnostic.Create( 86var diagnostic = Diagnostic.Create(
GenerateDocumentationAndConfigFiles (54)
src\roslyn\src\Compilers\Core\Portable\Diagnostic\DiagnosticArrayExtensions.cs (1)
11internal static bool HasAnyErrors<T>(this ImmutableArray<T> diagnostics) where T : Diagnostic
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
34protected abstract Diagnostic CreateDiagnostic(IMethodSymbol containingMethod, SyntaxToken catchKeyword);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (20)
18public static Diagnostic CreateDiagnostic( 24public static Diagnostic CreateDiagnostic( 31public static Diagnostic CreateDiagnostic( 45public static Diagnostic CreateDiagnostic( 51public static Diagnostic CreateDiagnostic( 60public static Diagnostic CreateDiagnostic( 70public static Diagnostic CreateDiagnostic( 78public static Diagnostic CreateDiagnostic( 86public static Diagnostic CreateDiagnostic( 95public static Diagnostic CreateDiagnostic( 105public static Diagnostic CreateDiagnostic( 112public static Diagnostic CreateDiagnostic( 124return Diagnostic.Create( 132public static Diagnostic CreateDiagnostic( 140public static Diagnostic CreateDiagnostic( 149return Diagnostic.Create(rule, null, args); 152return Diagnostic.Create(rule, 168Action<Diagnostic> addDiagnostic, 187var diagnostic = Diagnostic.Create(rule, Location.None, properties, args);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
27Action<Diagnostic> reportDiagnostic,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\CodeFixContextExtensions.cs (2)
16internal static void RegisterFixes(this CodeFixContext context, IEnumerable<CodeAction> actions, Diagnostic diagnostic) 27internal static void RegisterFixes(this CodeFixContext context, IEnumerable<CodeAction> actions, ImmutableArray<Diagnostic> diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (9)
22public static async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync( 27var allDiagnostics = ImmutableArray<Diagnostic>.Empty; 41return ImmutableDictionary<Document, ImmutableArray<Diagnostic>>.Empty.SetItem(document, documentDiagnostics); 80allDiagnostics = await ProducerConsumer<ImmutableArray<Diagnostic>>.RunParallelAsync( 90using var _2 = ArrayBuilder<Diagnostic>.GetInstance(out var builder); 106return ImmutableDictionary<Document, ImmutableArray<Diagnostic>>.Empty; 132private static async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync( 134ImmutableArray<Diagnostic> diagnostics, 137var builder = ImmutableDictionary.CreateBuilder<Document, ImmutableArray<Diagnostic>>();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (7)
33/// cref="Diagnostic.Properties"/> for that diagnostic. The diagnostic itself is not passed along as it was 34/// computed with respect to the original user document, and as such its <see cref="Diagnostic.Location"/> and <see 35/// cref="Diagnostic.AdditionalLocations"/> will not be correct. 44protected sealed override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 56ImmutableArray<Diagnostic> diagnostics, 62using var _ = ArrayBuilder<(TDiagnosticNode diagnosticNode, Diagnostic diagnostic)>.GetInstance(out var originalNodes); 63foreach (var diagnostic in diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\MultiProjectSafeFixAllProvider.cs (1)
110static IEnumerable<TextSpan> GetDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (9)
57protected void RegisterCodeFix(CodeFixContext context, string title, string equivalenceKey, Diagnostic? diagnostic = null) 60protected void RegisterCodeFix(CodeFixContext context, string title, string equivalenceKey, CodeActionPriority priority, Diagnostic? diagnostic = null) 63protected Func<CancellationToken, Task<Document>> GetDocumentUpdater(CodeFixContext context, Diagnostic? diagnostic = null) 70Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 98Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken); 105/// <para/> This overload differs from <see cref="IncludeDiagnosticDuringFixAll(Diagnostic)"/> in that it also 111protected virtual bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 122/// cref="IncludeDiagnosticDuringFixAll(Diagnostic, Document, string, CancellationToken)"/> should be overridden 127protected virtual bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
184public static async Task<ImmutableArray<Diagnostic>> GetErrorsAsync(this Document document, CancellationToken cancellationToken, IList<string>? ignoreErrorCode = null)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
32public static string? TryGetAnalyzerConfigPathForDiagnosticConfiguration(this Project project, Diagnostic diagnostic) 38private static string? TryGetAnalyzerConfigPathForProjectOrDiagnosticConfiguration(Project project, Diagnostic? diagnostic)
ILLink.CodeFixProvider (11)
BaseAttributeCodeFixProvider.cs (3)
36var diagnostic = context.Diagnostics.First(); 55Diagnostic diagnostic, 134Diagnostic diagnostic);
DynamicallyAccessedMembersCodeFixProvider.cs (1)
96var diagnostic = context.Diagnostics[0];
RequiresAssemblyFilesCodeFixProvider.cs (1)
35protected override SyntaxNode[] GetAttributeArguments(ISymbol? attributableSymbol, ISymbol targetSymbol, SyntaxGenerator syntaxGenerator, Diagnostic diagnostic) =>
RequiresDynamicCodeCodeFixProvider.cs (1)
32protected override SyntaxNode[] GetAttributeArguments(ISymbol? attributableSymbol, ISymbol targetSymbol, SyntaxGenerator syntaxGenerator, Diagnostic diagnostic) =>
RequiresUnreferencedCodeCodeFixProvider.cs (1)
32protected override SyntaxNode[] GetAttributeArguments(ISymbol? attributableSymbol, ISymbol targetSymbol, SyntaxGenerator syntaxGenerator, Diagnostic diagnostic) =>
RequiresUnsafeCodeFixProvider.cs (2)
45var diagnostic = context.Diagnostics.First(); 483protected override SyntaxNode[] GetAttributeArguments(ISymbol? attributableSymbol, ISymbol targetSymbol, SyntaxGenerator syntaxGenerator, Diagnostic diagnostic) =>
UnconditionalSuppressMessageCodeFixProvider.cs (1)
40protected override SyntaxNode[] GetAttributeArguments(ISymbol? attributableSymbol, ISymbol targetSymbol, SyntaxGenerator syntaxGenerator, Diagnostic diagnostic)
UnsafeMethodMissingRequiresUnsafeCodeFixProvider.cs (1)
35var diagnostic = context.Diagnostics.First();
ILLink.RoslynAnalyzer (46)
COMAnalyzer.cs (1)
58operationContext.ReportDiagnostic(Diagnostic.Create(s_correctnessOfCOMCannotBeGuaranteed,
DynamicallyAccessedMembersAnalyzer.cs (12)
127Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor( 185context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(DiagnosticId.DynamicallyAccessedMembersOnFieldCanOnlyApplyToTypesOrStrings), location, member.GetDisplayName())); 189context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(DiagnosticId.DynamicallyAccessedMembersOnMethodReturnValueCanOnlyApplyToTypesOrStrings), location, member.GetDisplayName())); 191context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(DiagnosticId.DynamicallyAccessedMembersIsNotAllowedOnMethods), location)); 195context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(DiagnosticId.DynamicallyAccessedMembersOnMethodParameterCanOnlyApplyToTypesOrStrings), location, parameter.GetDisplayName(), member.GetDisplayName())); 201context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(DiagnosticId.DynamicallyAccessedMembersOnPropertyCanOnlyApplyToTypesOrStrings), location, member.GetDisplayName())); 203context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(DiagnosticId.DynamicallyAccessedMembersIsNotAllowedOnExtensionProperties), location, member.GetDisplayName())); 235context.ReportDiagnostic(Diagnostic.Create( 259context.ReportDiagnostic(Diagnostic.Create( 285context.ReportDiagnostic(Diagnostic.Create( 300context.ReportDiagnostic(Diagnostic.Create( 347context.ReportDiagnostic(Diagnostic.Create(
DynamicallyAccessedMembersTypeHierarchy.cs (1)
19Action<Diagnostic> reportDiagnostic)
IGenericInstantiationAnalysis.cs.cs (1)
18Action<Diagnostic>? reportDiagnostic);
RequiresAnalyzerBase.cs (6)
45Action<Diagnostic>? reportDiagnostic) 280symbolAnalysisContext.ReportDiagnostic(Diagnostic.Create( 288symbolAnalysisContext.ReportDiagnostic(Diagnostic.Create( 298symbolAnalysisContext.ReportDiagnostic(Diagnostic.Create( 440var diag = Diagnostic.Create(diagnosticDescriptor, Location.None, refAssembly.Name);
RequiresUnreferencedCodeAnalyzer.cs (1)
110Action<Diagnostic>? reportDiagnostic)
TrimAnalysis\DiagnosticContext.cs (6)
17private readonly Action<Diagnostic>? _reportDiagnostic; 19public DiagnosticContext(Location location, Action<Diagnostic>? reportDiagnostic) 25private Diagnostic CreateDiagnostic(DiagnosticId id, params string[] args) 27return Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(id), Location, args); 46private Diagnostic CreateDiagnostic(DiagnosticId id, ValueWithDynamicallyAccessedMembers actualValue, ValueWithDynamicallyAccessedMembers expectedAnnotationsValue, params string[] args) 89return Diagnostic.Create(DiagnosticDescriptors.GetDiagnosticDescriptor(id), Location, sourceLocation, DAMArgument?.ToImmutableDictionary(), args);
TrimAnalysis\FeatureCheckReturnValuePattern.cs (1)
33public void ReportDiagnostics(DataFlowAnalyzerContext context, Action<Diagnostic> reportDiagnostic)
TrimAnalysis\GenericArgumentDataFlow.cs (2)
23private readonly Action<Diagnostic>? _reportDiagnostic; 31Action<Diagnostic>? reportDiagnostic)
TrimAnalysis\HandleCallAction.cs (1)
39Action<Diagnostic>? reportDiagnostic)
TrimAnalysis\ReflectionAccessAnalyzer.cs (2)
17readonly Action<Diagnostic>? _reportDiagnostic; 24Action<Diagnostic>? reportDiagnostic,
TrimAnalysis\RequireDynamicallyAccessedMembersAction.cs (2)
21readonly Action<Diagnostic>? _reportDiagnostic; 34Action<Diagnostic>? reportDiagnostic,
TrimAnalysis\TrimAnalysisAssignmentPattern.cs (1)
55public void ReportDiagnostics(DataFlowAnalyzerContext context, Action<Diagnostic> reportDiagnostic)
TrimAnalysis\TrimAnalysisBackingFieldAccessPattern.cs (1)
48public void ReportDiagnostics(DataFlowAnalyzerContext context, Action<Diagnostic> reportDiagnostic)
TrimAnalysis\TrimAnalysisFieldAccessPattern.cs (1)
47public void ReportDiagnostics(DataFlowAnalyzerContext context, Action<Diagnostic> reportDiagnostic)
TrimAnalysis\TrimAnalysisGenericInstantiationPattern.cs (1)
48public void ReportDiagnostics(DataFlowAnalyzerContext context, Action<Diagnostic> reportDiagnostic)
TrimAnalysis\TrimAnalysisMethodCallPattern.cs (1)
78public void ReportDiagnostics(DataFlowAnalyzerContext context, Action<Diagnostic> reportDiagnostic)
TrimAnalysis\TrimAnalysisPatternStore.cs (1)
125public void ReportDiagnostics(DataFlowAnalyzerContext context, Action<Diagnostic> reportDiagnostic)
TrimAnalysis\TrimAnalysisReflectionAccessPattern.cs (1)
46public void ReportDiagnostics(DataFlowAnalyzerContext context, Action<Diagnostic> reportDiagnostic)
TrimAnalysis\TrimAnalysisVisitor.cs (1)
394Action<Diagnostic>? reportDiagnostic,
TrimAnalysis\TrimDataFlowAnalysis.cs (1)
55public void ReportDiagnostics(Action<Diagnostic> reportDiagnostic)
UnsafeMethodMissingRequiresUnsafeAnalyzer.cs (1)
55context.ReportDiagnostic(Diagnostic.Create(s_rule, location, method.GetDisplayName()));
Microsoft.Analyzers.Extra (33)
AsyncCallInsideUsingBlockAnalyzer.cs (2)
122var diagnostic = 123Diagnostic.Create(DiagDescriptors.AsyncCallInsideUsingBlock, invocation.Syntax.GetLocation());
AsyncMethodWithoutCancellation.cs (2)
109var diagnostic = 110Diagnostic.Create(DiagDescriptors.AsyncMethodWithoutCancellation, analysisContext.Node.GetLocation());
CallAnalysis\Arrays.cs (2)
128var diagnostic = Diagnostic.Create(DiagDescriptors.Arrays, loc, valueType.ToDisplayString(), type.ToDisplayString());
CallAnalysis\LegacyCollection.cs (2)
33var diagnostic = Diagnostic.Create(DiagDescriptors.LegacyCollection, op.Syntax.GetLocation());
CallAnalysis\LegacyLogging.cs (2)
38var diagnostic = Diagnostic.Create(DiagDescriptors.LegacyLogging, op.Syntax.GetLocation());
CallAnalysis\Split.cs (2)
28var diagnostic = Diagnostic.Create(DiagDescriptors.Split, op.Syntax.GetLocation());
CallAnalysis\StartsEndsWith.cs (2)
59var diagnostic = Diagnostic.Create(DiagDescriptors.StartsEndsWith, op.Syntax.GetLocation(), op.TargetMethod.Name);
CallAnalysis\StaticTime.cs (4)
52var diagnostic = Diagnostic.Create(DiagDescriptors.StaticTime, op.Syntax.GetLocation()); 58var diagnostic = Diagnostic.Create(DiagDescriptors.StaticTime, op.Syntax.GetLocation());
CallAnalysis\ValueTuple.cs (4)
42var diagnostic = Diagnostic.Create(DiagDescriptors.ValueTuple, op.Syntax.GetLocation()); 48var diagnostic = Diagnostic.Create(DiagDescriptors.ValueTuple, op.Syntax.GetLocation());
CoalesceAnalyzer.cs (4)
52var diagnostic = Diagnostic.Create(DiagDescriptors.CoalesceAssignment, op.Syntax.GetLocation()); 79var diagnostic = Diagnostic.Create(DiagDescriptors.Coalesce, op.Syntax.GetLocation());
ConditionalAccessAnalyzer.cs (2)
111var diagnostic = Diagnostic.Create(DiagDescriptors.ConditionalAccess, op.Syntax.GetLocation());
MakeExeTypesInternalAnalyzer.cs (2)
134var diagnostic = Diagnostic.Create(DiagDescriptors.MakeExeTypesInternal, type.Locations[0], type.Name);
UsingToStringInLoggersAnalyzer.cs (3)
43foreach (var diagnostic in AnalyzeLogger(invocation)) 62private static IEnumerable<Diagnostic> AnalyzeLogger(IInvocationOperation invocation) 69yield return Diagnostic.Create(DiagDescriptors.UsingToStringInLoggers, arg.Syntax.GetLocation());
Microsoft.Analyzers.Extra.Tests (14)
Resources\RoslynTestUtils.cs (14)
137public static void AssertDiagnostic(this string text, int spanNum, DiagnosticDescriptor expected, Diagnostic actual) 153public static IList<Diagnostic> FilterDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 155var filtered = new List<Diagnostic>(); 156foreach (Diagnostic diagnostic in diagnostics) 174public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 203public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 234public static async Task<IReadOnlyList<Diagnostic>> RunAnalyzer( 265private static IReadOnlyList<Diagnostic> Sort(ImmutableArray<Diagnostic> diags) 343foreach (var d in diags) 522public override async Task<IEnumerable<Diagnostic>> GetAllDiagnosticsAsync(Project project, CancellationToken cancellationToken) 527public override async Task<IEnumerable<Diagnostic>> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken) 533public override async Task<IEnumerable<Diagnostic>> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken)
Microsoft.Analyzers.Local (19)
ApiLifecycle\ApiLifecycleAnalyzer.cs (11)
74context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.NewSymbolsMustBeMarkedExperimental, symbol.Locations.FirstOrDefault(), symbol)); 82context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantBeDeleted, null, type.ModifiersAndName)); 87context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantBeDeleted, null, method.Member)); 92context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantBeDeleted, null, prop.Member)); 97context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantBeDeleted, null, field.Member)); 111context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.ExperimentalSymbolsCantBeMarkedObsolete, symbol.Locations.FirstOrDefault(), symbol)); 118context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantBeMarkedExperimental, symbol.Locations.FirstOrDefault(), symbol)); 125context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantChange, symbol.Locations.FirstOrDefault(), symbol)); 133context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.PublishedSymbolsCantChange, symbol.Locations.FirstOrDefault(), symbol)); 154context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.NewSymbolsMustBeMarkedExperimental, type.Locations.FirstOrDefault(), type)); 158context.ReportDiagnostic(Diagnostic.Create(DiagDescriptors.ExperimentalSymbolsCantBeMarkedObsolete, type.Locations.FirstOrDefault(), type));
CallAnalysis\Throws.cs (4)
37var diagnostic = Diagnostic.Create( 51var diagnostic = Diagnostic.Create(
CallAnalysis\ToInvariantString.cs (2)
51var diagnostic = Diagnostic.Create(DiagDescriptors.ToInvariantString, op.Syntax.GetLocation());
InternalReferencedInPublicDocAnalyzer.cs (2)
154var diagnostic = Diagnostic.Create(DiagDescriptors.InternalReferencedInPublicDoc, crefNode.Cref.GetLocation(), referencedName);
Microsoft.Analyzers.Local.Tests (20)
ApiLifecycle\ApiLifecycleAnalyzerTest.cs (1)
74var actual = diagnostics[i];
InternalReferencedInPublicDocAnalyzerTests.cs (5)
454private static void AssertDetected(IReadOnlyList<Diagnostic> result, string source, int lineNumber, string detectedText) => 457private static void AssertDetected(IReadOnlyList<Diagnostic> result, string source, int[] lineNumbers, string[] detectedTexts) 476private static bool IsInternalReferencedInPublicDocDiagnostic(Diagnostic d) => ReferenceEquals(d.Descriptor, DiagDescriptors.InternalReferencedInPublicDoc); 478private static void AssertNotDetected(IReadOnlyList<Diagnostic> result) 484private static async Task<IReadOnlyList<Diagnostic>> Analyze(string source)
Resources\RoslynTestUtils.cs (14)
137public static void AssertDiagnostic(this string text, int spanNum, DiagnosticDescriptor expected, Diagnostic actual) 153public static IList<Diagnostic> FilterDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 155var filtered = new List<Diagnostic>(); 156foreach (Diagnostic diagnostic in diagnostics) 174public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 203public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 234public static async Task<IReadOnlyList<Diagnostic>> RunAnalyzer( 266private static IReadOnlyList<Diagnostic> Sort(ImmutableArray<Diagnostic> diags) 344foreach (var d in diags) 523public override async Task<IEnumerable<Diagnostic>> GetAllDiagnosticsAsync(Project project, CancellationToken cancellationToken) 528public override async Task<IEnumerable<Diagnostic>> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken) 534public override async Task<IEnumerable<Diagnostic>> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken)
Microsoft.AspNetCore.Analyzers (4)
BuildServiceProviderAnalyzer.cs (1)
31context.ReportDiagnostic(Diagnostic.Create(
UseAuthorizationAnalyzer.cs (2)
49context.ReportDiagnostic(Diagnostic.Create( 69context.ReportDiagnostic(Diagnostic.Create(
UseMvcAnalyzer.cs (1)
43context.ReportDiagnostic(Diagnostic.Create(
Microsoft.AspNetCore.App.Analyzers (23)
Authorization\AddAuthorizationBuilderAnalyzer.cs (1)
230context.ReportDiagnostic(Diagnostic.Create(
Http\HeaderDictionaryAddAnalyzer.cs (1)
74context.ReportDiagnostic(Diagnostic.Create(
Http\HeaderDictionaryIndexerAnalyzer.cs (1)
175context.ReportDiagnostic(Diagnostic.Create(
Http\RequestDelegateReturnTypeAnalyzer.cs (1)
78context.ReportDiagnostic(Diagnostic.Create(
Kestrel\ListenOnIPv6AnyAnalyzer.cs (2)
69context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.KestrelShouldListenOnIPv6AnyInsteadOfIpAny, ipAddressArgumentSyntax.GetLocation())); 94context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.KestrelShouldListenOnIPv6AnyInsteadOfIpAny, ipAddressArgumentSyntax.GetLocation()));
Mvc\DetectAmbiguousActionRoutes.cs (1)
42context.ReportDiagnostic(Diagnostic.Create(
Mvc\DetectOverriddenAuthorizeAttribute.cs (1)
216context.ReportDiagnostic(Diagnostic.Create(
RenderTreeBuilder\RenderTreeBuilderAnalyzer.cs (1)
45context.ReportDiagnostic(Diagnostic.Create(
RouteEmbeddedLanguage\RoutePatternAnalyzer.cs (2)
60context.ReportDiagnostic(Diagnostic.Create( 103context.ReportDiagnostic(Diagnostic.Create(
RouteHandlers\AtMostOneFromBodyAttribute.cs (1)
54context.ReportDiagnostic(Diagnostic.Create(
RouteHandlers\DetectAmbiguousRoutes.cs (1)
40context.ReportDiagnostic(Diagnostic.Create(
RouteHandlers\DetectMismatchedParameterOptionality.cs (1)
36context.ReportDiagnostic(Diagnostic.Create(
RouteHandlers\DetectMisplacedLambdaAttribute.cs (1)
47context.ReportDiagnostic(Diagnostic.Create(
RouteHandlers\DisallowMvcBindArgumentsOnParameters.cs (1)
38context.ReportDiagnostic(Diagnostic.Create(
RouteHandlers\DisallowNonParsableComplexTypesOnParameters.cs (2)
74context.ReportDiagnostic(Diagnostic.Create( 103context.ReportDiagnostic(Diagnostic.Create(
RouteHandlers\DisallowReturningActionResultFromMapMethods.cs (2)
47context.ReportDiagnostic(Diagnostic.Create( 81context.ReportDiagnostic(Diagnostic.Create(
WebApplicationBuilder\PublicPartialProgramClassAnalyzer.cs (1)
27context.ReportDiagnostic(Diagnostic.Create(
WebApplicationBuilder\WebApplicationBuilderAnalyzer.cs (2)
255static Diagnostic CreateDiagnostic(DiagnosticDescriptor descriptor, IInvocationOperation operation) 304return Diagnostic.Create(descriptor, location, methodName);
Microsoft.AspNetCore.App.CodeFixes (21)
Authorization\AddAuthorizationBuilderFixer.cs (3)
41foreach (var diagnostic in context.Diagnostics) 55private static bool CanReplaceWithAddAuthorizationBuilder(Diagnostic diagnostic, SyntaxNode root, [NotNullWhen(true)] out InvocationExpressionSyntax? invocation) 134private static Task<Document> ReplaceWithAddAuthorizationBuilder(Diagnostic diagnostic, SyntaxNode root, Document document, InvocationExpressionSyntax invocation)
Dependencies\AddPackageFixer.cs (1)
47foreach (var diagnostic in context.Diagnostics)
DetectMismatchedParameterOptionalityFixer.cs (2)
25foreach (var diagnostic in context.Diagnostics) 37private static async Task<Document> FixMismatchedParameterOptionalityAsync(Diagnostic diagnostic, Document document, CancellationToken cancellationToken)
Http\HeaderDictionaryAddFixer.cs (5)
44foreach (var diagnostic in context.Diagnostics) 68private static Task<Document> ReplaceWithAppend(Diagnostic diagnostic, WellKnownTypes wellKnownTypes, SyntaxNode root, Document document, InvocationExpressionSyntax invocation) 78private static bool CanReplaceWithAppend(Diagnostic diagnostic, SyntaxNode root, [NotNullWhen(true)] out InvocationExpressionSyntax? invocation) 99private static Task<Document> ReplaceWithIndexer(Diagnostic diagnostic, SyntaxNode root, Document document, AssignmentExpressionSyntax assignment) 106private static bool CanReplaceWithIndexer(Diagnostic diagnostic, SyntaxNode root, [NotNullWhen(true)] out AssignmentExpressionSyntax? assignment)
Http\HeaderDictionaryIndexerFixer.cs (2)
25foreach (var diagnostic in context.Diagnostics) 42private static async Task<Document> FixHeaderDictionaryIndexer(Diagnostic diagnostic, Document document, string resolvedPropertyName, CancellationToken cancellationToken)
Kestrel\ListenOnIPv6AnyFixer.cs (1)
26foreach (var diagnostic in context.Diagnostics)
PublicPartialProgramClassFixer.cs (1)
25foreach (var diagnostic in context.Diagnostics)
RouteParameterUnusedParameterFixer.cs (3)
45foreach (var diagnostic in context.Diagnostics) 58private static Task<Document> AddRouteParameterAsync(Diagnostic diagnostic, SyntaxNode root, RouteUsageCache routeUsageCache, Document document, CancellationToken cancellationToken) 74private static Document UpdateDocument(Diagnostic diagnostic, SyntaxNode root, Document document, SyntaxNode methodSyntax)
WebApplicationBuilderFixer.cs (3)
37foreach (var diagnostic in context.Diagnostics) 77private static Task<Document> FixWebApplicationBuilderAsync(Diagnostic diagnostic, SyntaxNode root, Document document, InvocationExpressionSyntax invocation) 84private static bool CanFixWebApplicationBuilder(Diagnostic diagnostic, IdentifierNameSyntax identifierMethod, SyntaxNode root, [NotNullWhen(true)] out InvocationExpressionSyntax? invocationName)
Microsoft.AspNetCore.Components.Analyzers (15)
ComponentParameterAnalyzer.cs (5)
84context.ReportDiagnostic(Diagnostic.Create( 91context.ReportDiagnostic(Diagnostic.Create( 105context.ReportDiagnostic(Diagnostic.Create( 115context.ReportDiagnostic(Diagnostic.Create( 126context.ReportDiagnostic(Diagnostic.Create(
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
34var diagnostic = context.Diagnostics.First();
ComponentParameterUsageAnalyzer.cs (1)
105context.ReportDiagnostic(Diagnostic.Create(
InternalUsageAnalyzer.cs (4)
137context.ReportDiagnostic(Diagnostic.Create( 147context.ReportDiagnostic(Diagnostic.Create( 166context.ReportDiagnostic(Diagnostic.Create( 176context.ReportDiagnostic(Diagnostic.Create(
InvokeAsyncOfObjectAnalyzer.cs (1)
80operationContext.ReportDiagnostic(Diagnostic.Create(
PersistentStateAnalyzer.cs (1)
76context.ReportDiagnostic(Diagnostic.Create(
SupplyParameterFromFormAnalyzer.cs (1)
76context.ReportDiagnostic(Diagnostic.Create(
VirtualizeItemComparerAnalyzer.cs (1)
124endContext.ReportDiagnostic(Diagnostic.Create(
Microsoft.AspNetCore.Components.SdkAnalyzers (10)
ComponentParameterAnalyzer.cs (4)
78context.ReportDiagnostic(Diagnostic.Create( 85context.ReportDiagnostic(Diagnostic.Create( 99context.ReportDiagnostic(Diagnostic.Create( 113context.ReportDiagnostic(Diagnostic.Create(
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
34var diagnostic = context.Diagnostics.First();
ComponentParameterUsageAnalyzer.cs (1)
105context.ReportDiagnostic(Diagnostic.Create(
InternalUsageAnalyzer.cs (4)
137context.ReportDiagnostic(Diagnostic.Create( 147context.ReportDiagnostic(Diagnostic.Create( 166context.ReportDiagnostic(Diagnostic.Create( 176context.ReportDiagnostic(Diagnostic.Create(
Microsoft.AspNetCore.Mvc.Analyzers (7)
AttributesShouldNotBeAppliedToPageModelAnalyzer.cs (3)
89context.ReportDiagnostic(Diagnostic.Create( 103context.ReportDiagnostic(Diagnostic.Create( 117context.ReportDiagnostic(Diagnostic.Create(
AvoidHtmlPartialAnalyzer.cs (2)
31context.ReportDiagnostic(Diagnostic.Create( 38context.ReportDiagnostic(Diagnostic.Create(
TagHelpersInCodeBlocksAnalyzer.cs (1)
97Diagnostic.Create(DiagnosticDescriptors.MVC1006_FunctionsContainingTagHelpersMustBeAsyncAndReturnTask, location));
TopLevelParameterNameAnalyzer.cs (1)
74Diagnostic.Create(
Microsoft.AspNetCore.Mvc.Api.Analyzers (8)
AddResponseTypeAttributeCodeFixAction.cs (2)
33private readonly Diagnostic _diagnostic; 35public AddResponseTypeAttributeCodeFixAction(Document document, Diagnostic diagnostic)
AddResponseTypeAttributeCodeFixProvider.cs (1)
24var diagnostic = context.Diagnostics[0];
ApiActionsDoNotRequireExplicitModelValidationCheckAnalyzer.cs (1)
122Diagnostic.Create(
ApiActionsDoNotRequireExplicitModelValidationCodeFixProvider.cs (1)
32var diagnostic = context.Diagnostics[0];
ApiConventionAnalyzer.cs (3)
60context.ReportDiagnostic(Diagnostic.Create( 66context.ReportDiagnostic(Diagnostic.Create( 86context.ReportDiagnostic(Diagnostic.Create(
Microsoft.CodeAnalysis (703)
Binding\BindingDiagnosticBag.cs (7)
31internal void AddRange<T>(ImmutableArray<T> diagnostics) where T : Diagnostic 36internal void AddRange(IEnumerable<Diagnostic> diagnostics) 53internal void Add(Diagnostic diag) 314private readonly ImmutableArray<Diagnostic> _diagnostics; 317public ImmutableArray<Diagnostic> Diagnostics => _diagnostics.NullToEmpty(); 322public ReadOnlyBindingDiagnostic(ImmutableArray<Diagnostic> diagnostics, ImmutableArray<TAssemblySymbol> dependencies) 359foreach (var diagnostic in Diagnostics)
CommandLine\AnalyzerConfigOptionsResult.cs (2)
30public ImmutableArray<Diagnostic> Diagnostics { get; } 35ImmutableArray<Diagnostic> diagnostics)
CommandLine\AnalyzerConfigSet.cs (8)
126public static AnalyzerConfigSet Create<TList>(TList analyzerConfigs, out ImmutableArray<Diagnostic> diagnostics) where TList : IReadOnlyCollection<AnalyzerConfig> 245var diagnosticBuilder = ArrayBuilder<Diagnostic>.GetInstance(); 373var diagnosticBuilder = ArrayBuilder<Diagnostic>.GetInstance(); 395private static void ParseSectionOptions(Section section, TreeOptions.Builder treeBuilder, AnalyzerOptions.Builder analyzerBuilder, ArrayBuilder<Diagnostic> diagnosticBuilder, string analyzerConfigPath, ConcurrentDictionary<ReadOnlyMemory<char>, string> diagIdCache) 432diagnosticBuilder.Add(Diagnostic.Create( 453internal static GlobalAnalyzerConfig MergeGlobalConfigs(ArrayBuilder<AnalyzerConfig> analyzerConfigs, out ImmutableArray<Diagnostic> diagnostics) 503diagnostics.Add(Diagnostic.Create( 528diagnostics.Add(Diagnostic.Create(
CommandLine\CommandLineArguments.cs (2)
151public ImmutableArray<Diagnostic> Errors { get; internal set; } 448var diagnostic = PortableExecutableReference.ExceptionToDiagnostic(e, messageProviderOpt!, Location.None, cmdReference.Reference, cmdReference.Properties.Kind);
CommandLine\CommandLineParser.cs (27)
217IList<Diagnostic> diagnostics, 349protected ImmutableArray<KeyValuePair<string, string>> ParsePathMap(string pathMap, IList<Diagnostic> errors) 368errors.Add(Diagnostic.Create(_messageProvider, _messageProvider.ERR_InvalidPathMap)); 377errors.Add(Diagnostic.Create(_messageProvider, _messageProvider.ERR_InvalidPathMap)); 435IList<Diagnostic> errors, 445errors.Add(Diagnostic.Create(_messageProvider, _messageProvider.FTL_InvalidInputFileName, invalidPath)); 453IList<Diagnostic> errors, 463errors.Add(Diagnostic.Create(_messageProvider, _messageProvider.FTL_InvalidInputFileName, invalidPath)); 477IList<Diagnostic> errors, 488errors.Add(Diagnostic.Create(_messageProvider, _messageProvider.FTL_InvalidInputFileName, invalidPath)); 502IList<Diagnostic> diagnostics, 570diagnostics.Add(Diagnostic.Create(_messageProvider, _messageProvider.FTL_InvalidInputFileName, path)); 580diagnostics.Add(Diagnostic.Create(_messageProvider, _messageProvider.FTL_InvalidInputFileName, path)); 651diagnostics.Add(Diagnostic.Create(_messageProvider, _messageProvider.ERR_OpenResponseFile, fullPath)); 665diagnostics.Add(Diagnostic.Create(_messageProvider, _messageProvider.WRN_NoConfigNotOnCommandLine)); 1117internal IEnumerable<string> ResolveRelativePaths(IEnumerable<string> paths, string baseDirectory, IList<Diagnostic> errors) 1124errors.Add(Diagnostic.Create(_messageProvider, _messageProvider.FTL_InvalidInputFileName, path)); 1151internal void ParseFileArgument(ReadOnlyMemory<char> arg, string? baseDirectory, ArrayBuilder<string> filePathBuilder, IList<Diagnostic> errors) 1174errors.Add(Diagnostic.Create(MessageProvider, (int)MessageProvider.FTL_InvalidInputFileName, path)); 1183private protected void ParseSeparatedFileArgument(ReadOnlyMemory<char> value, string? baseDirectory, ArrayBuilder<string> filePathBuilder, IList<Diagnostic> errors) 1199private protected IEnumerable<string> ParseSeparatedFileArgument(string value, string? baseDirectory, IList<Diagnostic> errors) 1210internal IEnumerable<CommandLineSourceFile> ParseRecurseArgument(string arg, string? baseDirectory, IList<Diagnostic> errors) 1227IList<Diagnostic> errors) 1279errors.Add(Diagnostic.Create(MessageProvider, (int)MessageProvider.FTL_InvalidInputFileName, path)); 1299errors.Add(Diagnostic.Create(MessageProvider, (int)MessageProvider.ERR_FileNotFound, path)); 1312internal abstract void GenerateErrorForNoFilesFoundInRecurse(string path, IList<Diagnostic> errors); 1314internal ReportDiagnostic GetDiagnosticOptionsFromRulesetFile(string? fullPath, out Dictionary<string, ReportDiagnostic> diagnosticOptions, IList<Diagnostic> diagnostics)
CommandLine\CommonCompiler.cs (14)
93private readonly HashSet<Diagnostic> _reportedDiagnostics = new HashSet<Diagnostic>(); 313diagnostics.Add(Diagnostic.Create( 368diagnostics.Add(Diagnostic.Create(ToFileReadDiagnostics(MessageProvider, e, filePath))); 515internal bool ReportDiagnostics(IEnumerable<Diagnostic> diagnostics, TextWriter consoleOutput, ErrorLogger? errorLoggerOpt, Compilation? compilation) 518foreach (var diag in diagnostics) 526void reportDiagnostic(Diagnostic diag, SuppressionInfo? suppressionInfo) 591=> ReportDiagnostics(diagnostics.Select(info => Diagnostic.Create(info)), consoleOutput, errorLoggerOpt, compilation); 596private void ReportIVTInfos(TextWriter consoleOutput, ErrorLogger? errorLogger, Compilation compilation, ImmutableArray<Diagnostic> diagnostics) 653private protected abstract void DiagnoseBadAccesses(TextWriter consoleOutput, ErrorLogger? errorLogger, Compilation compilation, ImmutableArray<Diagnostic> diagnostics); 663foreach (var diag in diagnostics.AsEnumerable()) 675foreach (var diag in diagnostics.AsEnumerable()) 691foreach (Diagnostic diagnostic in diagnostics.AsEnumerable()) 702protected virtual void PrintError(Diagnostic diagnostic, TextWriter consoleOutput)
CommandLine\CommonCompiler.SuppressionDiagnostic.cs (6)
28private readonly Diagnostic _originalDiagnostic; 33Diagnostic originalDiagnostic, 70public override bool Equals(Diagnostic? obj) 94internal override Diagnostic WithLocation(Location location) 99internal override Diagnostic WithSeverity(DiagnosticSeverity severity) 104internal override Diagnostic WithIsSuppressed(bool isSuppressed)
CommandLine\ErrorLogger.cs (1)
15public abstract void LogDiagnostic(Diagnostic diagnostic, SuppressionInfo? suppressionInfo);
CommandLine\SarifErrorLogger.cs (1)
83protected void WriteResultProperties(Diagnostic diagnostic)
CommandLine\SarifV1ErrorLogger.cs (1)
59public override void LogDiagnostic(Diagnostic diagnostic, SuppressionInfo? suppressionInfo)
CommandLine\SarifV2ErrorLogger.cs (1)
56public override void LogDiagnostic(Diagnostic diagnostic, SuppressionInfo? suppressionInfo)
Compilation\Compilation.cs (11)
1791public abstract ImmutableArray<Diagnostic> GetParseDiagnostics(CancellationToken cancellationToken = default(CancellationToken)); 1796public abstract ImmutableArray<Diagnostic> GetDeclarationDiagnostics(CancellationToken cancellationToken = default(CancellationToken)); 1801public abstract ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(CancellationToken cancellationToken = default(CancellationToken)); 1808public abstract ImmutableArray<Diagnostic> GetDiagnostics(CancellationToken cancellationToken = default(CancellationToken)); 1902internal bool FilterAndAppendDiagnostics(DiagnosticBag accumulator, IEnumerable<Diagnostic> incoming, HashSet<int>? exclude, CancellationToken cancellationToken) 1907foreach (Diagnostic d in incoming) 1914var filtered = Options.FilterDiagnostic(d, cancellationToken); 3899/// Given a <see cref="Diagnostic"/> reporting unreferenced <see cref="AssemblyIdentity"/>s, returns 3902public ImmutableArray<AssemblyIdentity> GetUnreferencedAssemblyIdentities(Diagnostic diagnostic) 3929/// Returns the required language version found in a <see cref="Diagnostic"/>, if any is found. 3932public static string? GetRequiredLanguageVersion(Diagnostic diagnostic)
Compilation\CompilationOptions.cs (9)
190internal abstract Diagnostic? FilterDiagnostic(Diagnostic diagnostic, CancellationToken cancellationToken); 203/// Whether diagnostics suppressed in source, i.e. <see cref="Diagnostic.IsSuppressed"/> is true, should be reported. 262private readonly Lazy<ImmutableArray<Diagnostic>> _lazyErrors; 326_lazyErrors = new Lazy<ImmutableArray<Diagnostic>>(() => 328var builder = ArrayBuilder<Diagnostic>.GetInstance(); 562internal abstract void ValidateOptions(ArrayBuilder<Diagnostic> builder); 564internal void ValidateOptions(ArrayBuilder<Diagnostic> builder, CommonMessageProvider messageProvider) 606public ImmutableArray<Diagnostic> Errors
Compilation\EmitResult.cs (2)
27public ImmutableArray<Diagnostic> Diagnostics { get; } 29internal EmitResult(bool success, ImmutableArray<Diagnostic> diagnostics)
Compilation\LoadDirective.cs (2)
16public readonly ImmutableArray<Diagnostic> Diagnostics; 18public LoadDirective(string? resolvedPath, ImmutableArray<Diagnostic> diagnostics)
Compilation\ParseOptions.cs (6)
21private readonly Lazy<ImmutableArray<Diagnostic>> _lazyErrors; 45_lazyErrors = new Lazy<ImmutableArray<Diagnostic>>(() => 47var builder = ArrayBuilder<Diagnostic>.GetInstance(); 61public ImmutableArray<Diagnostic> Errors 77internal abstract void ValidateOptions(ArrayBuilder<Diagnostic> builder); 79internal void ValidateOptions(ArrayBuilder<Diagnostic> builder, CommonMessageProvider messageProvider)
Compilation\SemanticModel.cs (4)
331public abstract ImmutableArray<Diagnostic> GetSyntaxDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)); 345public abstract ImmutableArray<Diagnostic> GetDeclarationDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)); 359public abstract ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)); 376public abstract ImmutableArray<Diagnostic> GetDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken));
Diagnostic\CommonDiagnosticComparer.cs (4)
10internal sealed class CommonDiagnosticComparer : IEqualityComparer<Diagnostic> 18public bool Equals(Diagnostic? x, Diagnostic? y) 33public int GetHashCode(Diagnostic obj)
Diagnostic\CommonMessageProvider.cs (4)
57/// Default category is <see cref="Diagnostic.CompilerDiagnosticCategory"/>. 80public Diagnostic CreateDiagnostic(int code, Location location) 88public abstract Diagnostic CreateDiagnostic(DiagnosticInfo info); 93public abstract Diagnostic CreateDiagnostic(int code, Location location, params object[] args);
Diagnostic\Diagnostic.cs (33)
21public abstract partial class Diagnostic : IEquatable<Diagnostic?>, IFormattable 41/// Creates a <see cref="Diagnostic"/> instance. 46/// <returns>The <see cref="Diagnostic"/> instance.</returns> 47public static Diagnostic Create( 56/// Creates a <see cref="Diagnostic"/> instance. 66/// <returns>The <see cref="Diagnostic"/> instance.</returns> 67public static Diagnostic Create( 77/// Creates a <see cref="Diagnostic"/> instance. 87/// <returns>The <see cref="Diagnostic"/> instance.</returns> 88public static Diagnostic Create( 98/// Creates a <see cref="Diagnostic"/> instance. 113/// <returns>The <see cref="Diagnostic"/> instance.</returns> 114public static Diagnostic Create( 125/// Creates a <see cref="Diagnostic"/> instance. 141/// <returns>The <see cref="Diagnostic"/> instance.</returns> 142public static Diagnostic Create( 167/// Creates a <see cref="Diagnostic"/> instance which is localizable. 194/// <returns>The <see cref="Diagnostic"/> instance.</returns> 195public static Diagnostic Create( 216/// Creates a <see cref="Diagnostic"/> instance which is localizable. 244/// <returns>The <see cref="Diagnostic"/> instance.</returns> 245public static Diagnostic Create( 281internal static Diagnostic Create(CommonMessageProvider messageProvider, int errorCode) 286internal static Diagnostic Create(CommonMessageProvider messageProvider, int errorCode, params object[] arguments) 291internal static Diagnostic Create(DiagnosticInfo info) 297/// Gets the diagnostic descriptor, which provides a description about a <see cref="Diagnostic"/>. 425=> obj is Diagnostic diagnostic && Equals(diagnostic); 429public abstract bool Equals(Diagnostic? obj); 454internal abstract Diagnostic WithLocation(Location location); 459internal abstract Diagnostic WithSeverity(DiagnosticSeverity severity); 464internal abstract Diagnostic WithIsSuppressed(bool isSuppressed); 469internal Diagnostic WithProgrammaticSuppression(ProgrammaticSuppressionInfo programmaticSuppressionInfo) 528internal Diagnostic? WithReportDiagnostic(ReportDiagnostic reportAction)
Diagnostic\Diagnostic.DiagnosticWithProgrammaticSuppression.cs (6)
18private readonly Diagnostic _originalUnsuppressedDiagnostic; 22Diagnostic originalUnsuppressedDiagnostic, 86public override bool Equals(Diagnostic? obj) 108internal override Diagnostic WithLocation(Location location) 123internal override Diagnostic WithSeverity(DiagnosticSeverity severity) 133internal override Diagnostic WithIsSuppressed(bool isSuppressed)
Diagnostic\Diagnostic_SimpleDiagnostic.cs (4)
146public override bool Equals(Diagnostic? obj) 180internal override Diagnostic WithLocation(Location location) 195internal override Diagnostic WithSeverity(DiagnosticSeverity severity) 206internal override Diagnostic WithIsSuppressed(bool isSuppressed)
Diagnostic\DiagnosticArrayExtensions.cs (1)
11internal static bool HasAnyErrors<T>(this ImmutableArray<T> diagnostics) where T : Diagnostic
Diagnostic\DiagnosticBag.cs (34)
34private ConcurrentQueue<Diagnostic>? _lazyBag; 51ConcurrentQueue<Diagnostic>? bag = _lazyBag; 73foreach (Diagnostic diagnostic in Bag) 101foreach (Diagnostic diagnostic in Bag) 115public void Add(Diagnostic diag) 117ConcurrentQueue<Diagnostic> bag = this.Bag; 124public void AddRange<T>(ImmutableArray<T> diagnostics) where T : Diagnostic 128ConcurrentQueue<Diagnostic> bag = this.Bag; 139public void AddRange(IEnumerable<Diagnostic> diagnostics) 141foreach (Diagnostic diagnostic in diagnostics) 171public ImmutableArray<TDiagnostic> ToReadOnlyAndFree<TDiagnostic>(bool forceResolution = true) where TDiagnostic : Diagnostic 173ConcurrentQueue<Diagnostic>? oldBag = _lazyBag; 179public ImmutableArray<Diagnostic> ToReadOnlyAndFree(bool forceResolution = true) 181return ToReadOnlyAndFree<Diagnostic>(forceResolution); 184public ImmutableArray<TDiagnostic> ToReadOnly<TDiagnostic>(bool forceResolution = true) where TDiagnostic : Diagnostic 186ConcurrentQueue<Diagnostic>? oldBag = _lazyBag; 190public ImmutableArray<Diagnostic> ToReadOnly(bool forceResolution = true) 192return ToReadOnly<Diagnostic>(forceResolution); 195private static ImmutableArray<TDiagnostic> ToReadOnlyCore<TDiagnostic>(ConcurrentQueue<Diagnostic>? oldBag, bool forceResolution) where TDiagnostic : Diagnostic 227public IEnumerable<Diagnostic> AsEnumerable() 229ConcurrentQueue<Diagnostic> bag = this.Bag; 233foreach (Diagnostic diagnostic in bag) 251private IEnumerable<Diagnostic> AsEnumerableFiltered() 253foreach (Diagnostic diagnostic in this.Bag) 263internal IEnumerable<Diagnostic> AsEnumerableWithoutResolution() 266return _lazyBag ?? SpecializedCollections.EmptyEnumerable<Diagnostic>(); 281foreach (Diagnostic diag in Bag) // NOTE: don't force resolution 295private ConcurrentQueue<Diagnostic> Bag 299ConcurrentQueue<Diagnostic>? bag = _lazyBag; 305ConcurrentQueue<Diagnostic> newBag = new ConcurrentQueue<Diagnostic>(); 316ConcurrentQueue<Diagnostic>? bag = _lazyBag; 361ConcurrentQueue<Diagnostic>? lazyBag = _bag._lazyBag;
Diagnostic\DiagnosticDescriptor.cs (5)
16/// Provides a description about a <see cref="Diagnostic"/> 79/// Create a DiagnosticDescriptor, which provides description about a <see cref="Diagnostic"/>. 111/// Create a DiagnosticDescriptor, which provides description about a <see cref="Diagnostic"/>. 244var effectiveDiagnostic = compilationOptions.FilterDiagnostic(Diagnostic.Create(this, Location.None), CancellationToken.None);
Diagnostic\DiagnosticFormatter.cs (6)
13/// Formats <see cref="Diagnostic"/> messages. 18/// Formats the <see cref="Diagnostic"/> message using the optional <see cref="IFormatProvider"/>. 23public virtual string Format(Diagnostic diagnostic, IFormatProvider? formatter = null) 82internal string GetMessagePrefix(Diagnostic diagnostic) 106private string FormatHelpLinkUri(Diagnostic diagnostic) 118internal virtual bool HasDefaultHelpLinkUri(Diagnostic diagnostic) => true;
Diagnostic\DiagnosticInfo.cs (2)
230return Diagnostic.GetDefaultWarningLevel(_effectiveSeverity); 255/// Default category is <see cref="Diagnostic.CompilerDiagnosticCategory"/>.
Diagnostic\DiagnosticWithInfo.cs (4)
155public override bool Equals(Diagnostic? obj) 195internal override Diagnostic WithLocation(Location location) 210internal override Diagnostic WithSeverity(DiagnosticSeverity severity) 220internal override Diagnostic WithIsSuppressed(bool isSuppressed)
Diagnostic\SuppressionDescriptor.cs (6)
12/// Provides a description about a programmatic suppression of a <see cref="Diagnostic"/> by a <see cref="DiagnosticSuppressor"/>. 22/// Identifier of the suppressed diagnostic, i.e. <see cref="Diagnostic.Id"/>. 32/// Create a SuppressionDescriptor, which provides a justification about a programmatic suppression of a <see cref="Diagnostic"/>. 37/// <param name="suppressedDiagnosticId">Identifier of the suppressed diagnostic, i.e. <see cref="Diagnostic.Id"/>. For example, compiler warning Id "CS0649".</param> 48/// Create a SuppressionDescriptor, which provides a localizable justification about a programmatic suppression of a <see cref="Diagnostic"/>. 51/// <param name="suppressedDiagnosticId">Identifier of the suppressed diagnostic, i.e. <see cref="Diagnostic.Id"/>. For example, compiler warning Id "CS0649".</param>
Diagnostic\SuppressionInfo.cs (1)
17/// <see cref="Diagnostic.Id"/> of the suppressed diagnostic.
DiagnosticAnalyzer\AnalysisResult.cs (18)
24ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> localSyntaxDiagnostics, 25ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> localSemanticDiagnostics, 26ImmutableDictionary<AdditionalText, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> localAdditionalFileDiagnostics, 27ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> nonLocalDiagnostics, 46public ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> SyntaxDiagnostics { get; } 51public ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> SemanticDiagnostics { get; } 56public ImmutableDictionary<AdditionalText, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> AdditionalFileDiagnostics { get; } 61public ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> CompilationDiagnostics { get; } 71public ImmutableArray<Diagnostic> GetAllDiagnostics(DiagnosticAnalyzer analyzer) 84public ImmutableArray<Diagnostic> GetAllDiagnostics() 89private ImmutableArray<Diagnostic> GetDiagnostics(IEnumerable<DiagnosticAnalyzer> analyzers) 96private ImmutableArray<Diagnostic> GetDiagnostics(ImmutableHashSet<DiagnosticAnalyzer> excludedAnalyzers) 100var builder = ImmutableArray.CreateBuilder<Diagnostic>(); 109return ImmutableArray<Diagnostic>.Empty; 113ImmutableDictionary<T, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> localDiagnostics, 115ImmutableArray<Diagnostic>.Builder builder) 133ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> nonLocalDiagnostics, 135ImmutableArray<Diagnostic>.Builder builder)
DiagnosticAnalyzer\AnalysisResultBuilder.cs (51)
37private Dictionary<SyntaxTree, Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>>? _localSemanticDiagnosticsOpt = null; 38private Dictionary<SyntaxTree, Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>>? _localSyntaxDiagnosticsOpt = null; 39private Dictionary<AdditionalText, Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>>? _localAdditionalFileDiagnosticsOpt = null; 40private Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>? _nonLocalDiagnosticsOpt = null; 303static SyntaxTree? getSourceTree(Diagnostic diagnostic) 306AdditionalText? getAdditionalTextKey(Diagnostic diagnostic) 329ImmutableArray<Diagnostic> diagnostics, 331Func<Diagnostic, TKey?> getKeyFunc, 332ref Dictionary<TKey, Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>>? lazyLocalDiagnostics) 340lazyLocalDiagnostics = lazyLocalDiagnostics ?? new Dictionary<TKey, Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>>(); 350Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>? allDiagnostics; 353allDiagnostics = new Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>(); 357ImmutableArray<Diagnostic>.Builder? analyzerDiagnostics; 360analyzerDiagnostics = ImmutableArray.CreateBuilder<Diagnostic>(); 368private void UpdateNonLocalDiagnostics_NoLock(DiagnosticAnalyzer analyzer, ImmutableArray<Diagnostic> diagnostics, bool overwrite) 375_nonLocalDiagnosticsOpt = _nonLocalDiagnosticsOpt ?? new Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>(); 377ImmutableArray<Diagnostic>.Builder? currentDiagnostics; 380currentDiagnostics = ImmutableArray.CreateBuilder<Diagnostic>(); 387private static void UpdateDiagnosticsCore_NoLock(ImmutableArray<Diagnostic>.Builder currentDiagnostics, IEnumerable<Diagnostic> diagnostics, bool overwrite) 402internal ImmutableArray<Diagnostic> GetDiagnostics(AnalysisScope analysisScope, bool getLocalDiagnostics, bool getNonLocalDiagnostics) 410private ImmutableArray<Diagnostic> GetDiagnostics_NoLock(AnalysisScope analysisScope, bool getLocalDiagnostics, bool getNonLocalDiagnostics) 414var builder = ImmutableArray.CreateBuilder<Diagnostic>(); 443Dictionary<TKey, Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>>? lazyLocalDiagnostics, 445ImmutableArray<Diagnostic>.Builder builder) 458Dictionary<SyntaxTree, Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>>? localDiagnostics, 460ImmutableArray<Diagnostic>.Builder builder) 464Dictionary<AdditionalText, Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>>? localDiagnostics, 466ImmutableArray<Diagnostic>.Builder builder) 470Dictionary<TKey, Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>>? localDiagnostics, 473ImmutableArray<Diagnostic>.Builder builder) 476Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>? diagnosticsForTree; 484Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder> diagnostics, 486ImmutableArray<Diagnostic>.Builder builder) 492ImmutableArray<Diagnostic>.Builder? diagnosticsByAnalyzer; 504ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> localSyntaxDiagnostics; 505ImmutableDictionary<SyntaxTree, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> localSemanticDiagnostics; 506ImmutableDictionary<AdditionalText, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> localAdditionalFileDiagnostics; 507ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> nonLocalDiagnostics; 512Func<Diagnostic, bool> shouldInclude = analysisScope.ShouldInclude; 533private static ImmutableDictionary<TKey, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>> GetImmutable<TKey>( 535Func<Diagnostic, bool> shouldInclude, 536Dictionary<TKey, Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>>? localDiagnosticsOpt) 541return ImmutableDictionary<TKey, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>>.Empty; 544var builder = ImmutableDictionary.CreateBuilder<TKey, ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>>(); 545var perTreeBuilder = ImmutableDictionary.CreateBuilder<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>(); 575private static ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> GetImmutable( 577Func<Diagnostic, bool> shouldInclude, 578Dictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>.Builder>? nonLocalDiagnosticsOpt) 582return ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>.Empty; 585var builder = ImmutableDictionary.CreateBuilder<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>();
DiagnosticAnalyzer\AnalysisScope.cs (1)
291public bool ShouldInclude(Diagnostic diagnostic)
DiagnosticAnalyzer\AnalyzerDriver.cs (55)
53private readonly ConcurrentSet<Diagnostic>? _diagnosticsProcessedForProgrammaticSuppressions; 385_diagnosticsProcessedForProgrammaticSuppressions = HasDiagnosticSuppressors ? new ConcurrentSet<Diagnostic>(ReferenceEqualityComparer.Instance) : null; 479Action<Diagnostic, AnalyzerOptions, CancellationToken>? addNotCategorizedDiagnostic = null; 480Action<Diagnostic, DiagnosticAnalyzer, AnalyzerOptions, bool, CancellationToken>? addCategorizedLocalDiagnostic = null; 481Action<Diagnostic, DiagnosticAnalyzer, AnalyzerOptions, CancellationToken>? addCategorizedNonLocalDiagnostic = null; 495var newOnAnalyzerException = (Exception ex, DiagnosticAnalyzer analyzer, Diagnostic diagnostic, CancellationToken cancellationToken) => 501var filteredDiagnostic = GetFilteredDiagnostic(diagnostic, compilation, options, _severityFilter, suppressedDiagnosticIds, cancellationToken); 626private bool ShouldSuppressGeneratedCodeDiagnostic(Diagnostic diagnostic, DiagnosticAnalyzer analyzer, Compilation compilation, CancellationToken cancellationToken) 736var diagnostic = AnalyzerExecutor.CreateDriverExceptionDiagnostic(innerException); 827Action<Diagnostic> addExceptionDiagnostic, 834Action<Exception, DiagnosticAnalyzer, Diagnostic> onAnalyzerException = 847Action<Exception, DiagnosticAnalyzer, Diagnostic> onAnalyzerException, 874public async Task<ImmutableArray<Diagnostic>> GetDiagnosticsAsync(Compilation compilation, CancellationToken cancellationToken) 889while (DiagnosticQueue.TryDequeue(out var diagnostic)) 1035public ImmutableArray<Diagnostic> ApplyProgrammaticSuppressions(ImmutableArray<Diagnostic> reportedDiagnostics, Compilation compilation, CancellationToken cancellationToken) 1046private ImmutableArray<Diagnostic> ApplyProgrammaticSuppressionsCore(ImmutableArray<Diagnostic> reportedDiagnostics, Compilation compilation, CancellationToken cancellationToken) 1075var builder = ArrayBuilder<Diagnostic>.GetInstance(reportedDiagnostics.Length); 1076ImmutableDictionary<Diagnostic, ProgrammaticSuppressionInfo> programmaticSuppressionsByDiagnostic = createProgrammaticSuppressionsByDiagnosticMap(_programmaticSuppressions); 1077foreach (var diagnostic in reportedDiagnostics) 1083var suppressedDiagnostic = diagnostic.WithProgrammaticSuppression(programmaticSuppressionInfo); 1101void executeSuppressionActions(IEnumerable<Diagnostic> reportedDiagnostics, bool concurrent) 1141ImmutableArray<Diagnostic> getSuppressableDiagnostics(DiagnosticSuppressor suppressor) 1146return ImmutableArray<Diagnostic>.Empty; 1149using var builder = TemporaryArray<Diagnostic>.Empty; 1150foreach (var diagnostic in reportedDiagnostics) 1162static ImmutableDictionary<Diagnostic, ProgrammaticSuppressionInfo> createProgrammaticSuppressionsByDiagnosticMap(ConcurrentSet<Suppression> programmaticSuppressions) 1164var programmaticSuppressionsBuilder = PooledDictionary<Diagnostic, ArrayBuilder<Suppression>>.GetInstance(); 1178var mapBuilder = ImmutableDictionary.CreateBuilder<Diagnostic, ProgrammaticSuppressionInfo>(); 1189public ImmutableArray<Diagnostic> DequeueLocalDiagnosticsAndApplySuppressions(DiagnosticAnalyzer analyzer, bool syntax, Compilation compilation, CancellationToken cancellationToken) 1195public ImmutableArray<Diagnostic> DequeueNonLocalDiagnosticsAndApplySuppressions(DiagnosticAnalyzer analyzer, Compilation compilation, CancellationToken cancellationToken) 1201private ImmutableArray<Diagnostic> FilterDiagnosticsSuppressedInSourceOrByAnalyzers(ImmutableArray<Diagnostic> diagnostics, Compilation compilation, CancellationToken cancellationToken) 1207private static ImmutableArray<Diagnostic> FilterDiagnosticsSuppressedInSource( 1208ImmutableArray<Diagnostic> diagnostics, 1218var builder = ImmutableArray.CreateBuilder<Diagnostic>(); 1226var diagnostic = suppressMessageState.ApplySourceSuppressions(diagnostics[i]); 1239internal ImmutableArray<Diagnostic> ApplyProgrammaticSuppressionsAndFilterDiagnostics(ImmutableArray<Diagnostic> reportedDiagnostics, Compilation compilation, CancellationToken cancellationToken) 1977internal static Action<Diagnostic, AnalyzerOptions, CancellationToken> GetDiagnosticSink(Action<Diagnostic> addDiagnosticCore, Compilation compilation, SeverityFilter severityFilter, ConcurrentSet<string>? suppressedDiagnosticIds) 1981var filteredDiagnostic = GetFilteredDiagnostic(diagnostic, compilation, analyzerOptions, severityFilter, suppressedDiagnosticIds, cancellationToken); 1989internal static Action<Diagnostic, DiagnosticAnalyzer, AnalyzerOptions, bool, CancellationToken> GetDiagnosticSink(Action<Diagnostic, DiagnosticAnalyzer, bool> addLocalDiagnosticCore, Compilation compilation, SeverityFilter severityFilter, ConcurrentSet<string>? suppressedDiagnosticIds) 1993var filteredDiagnostic = GetFilteredDiagnostic(diagnostic, compilation, analyzerOptions, severityFilter, suppressedDiagnosticIds, cancellationToken); 2001internal static Action<Diagnostic, DiagnosticAnalyzer, AnalyzerOptions?, CancellationToken> GetDiagnosticSink(Action<Diagnostic, DiagnosticAnalyzer> addDiagnosticCore, Compilation compilation, SeverityFilter severityFilter, ConcurrentSet<string>? suppressedDiagnosticIds) 2005var filteredDiagnostic = GetFilteredDiagnostic(diagnostic, compilation, analyzerOptions, severityFilter, suppressedDiagnosticIds, cancellationToken); 2013private static Diagnostic? GetFilteredDiagnostic(Diagnostic diagnostic, Compilation compilation, AnalyzerOptions? analyzerOptions, SeverityFilter severityFilter, ConcurrentSet<string>? suppressedDiagnosticIds, CancellationToken cancellationToken) 2015var filteredDiagnostic = compilation.Options.FilterDiagnostic(diagnostic, cancellationToken); 2024Diagnostic? applyFurtherFiltering(Diagnostic? diagnostic) 2762var diagnostic = AnalyzerExecutor.CreateDriverExceptionDiagnostic(ex);
DiagnosticAnalyzer\AnalyzerExecutor.AnalyzerDiagnosticReporter.cs (11)
22public readonly Action<Diagnostic> AddDiagnosticAction; 34Action<Diagnostic, AnalyzerOptions, CancellationToken>? addNonCategorizedDiagnostic, 35Action<Diagnostic, DiagnosticAnalyzer, AnalyzerOptions, bool, CancellationToken>? addCategorizedLocalDiagnostic, 36Action<Diagnostic, DiagnosticAnalyzer, AnalyzerOptions, CancellationToken>? addCategorizedNonLocalDiagnostic, 37Func<Diagnostic, DiagnosticAnalyzer, Compilation, CancellationToken, bool> shouldSuppressGeneratedCodeDiagnostic, 76private Action<Diagnostic, AnalyzerOptions, CancellationToken>? _addNonCategorizedDiagnostic; 77private Action<Diagnostic, DiagnosticAnalyzer, AnalyzerOptions, bool, CancellationToken>? _addCategorizedLocalDiagnostic; 78private Action<Diagnostic, DiagnosticAnalyzer, AnalyzerOptions, CancellationToken>? _addCategorizedNonLocalDiagnostic; 79private Func<Diagnostic, DiagnosticAnalyzer, Compilation, CancellationToken, bool> _shouldSuppressGeneratedCodeDiagnostic; 99private void AddDiagnostic(Diagnostic diagnostic) 128bool isLocalDiagnostic(Diagnostic diagnostic)
DiagnosticAnalyzer\AnalyzerExecutor.cs (47)
34private readonly Action<Diagnostic, AnalyzerOptions, CancellationToken>? _addNonCategorizedDiagnostic; 35private readonly Action<Diagnostic, DiagnosticAnalyzer, AnalyzerOptions, bool, CancellationToken>? _addCategorizedLocalDiagnostic; 36private readonly Action<Diagnostic, DiagnosticAnalyzer, AnalyzerOptions, CancellationToken>? _addCategorizedNonLocalDiagnostic; 44private readonly Func<Diagnostic, DiagnosticAnalyzer, Compilation, CancellationToken, bool> _shouldSuppressGeneratedCodeDiagnostic; 116Action<Diagnostic, AnalyzerOptions, CancellationToken>? addNonCategorizedDiagnostic, 117Action<Exception, DiagnosticAnalyzer, Diagnostic, CancellationToken> onAnalyzerException, 124Func<Diagnostic, DiagnosticAnalyzer, Compilation, CancellationToken, bool> shouldSuppressGeneratedCodeDiagnostic, 131Action<Diagnostic, DiagnosticAnalyzer, AnalyzerOptions, bool, CancellationToken>? addCategorizedLocalDiagnostic = null, 132Action<Diagnostic, DiagnosticAnalyzer, AnalyzerOptions, CancellationToken>? addCategorizedNonLocalDiagnostic = null, 150Action<Diagnostic, AnalyzerOptions, CancellationToken>? addNonCategorizedDiagnosticOpt, 151Action<Exception, DiagnosticAnalyzer, Diagnostic, CancellationToken> onAnalyzerException, 158Func<Diagnostic, DiagnosticAnalyzer, Compilation, CancellationToken, bool> shouldSuppressGeneratedCodeDiagnostic, 165Action<Diagnostic, DiagnosticAnalyzer, AnalyzerOptions, bool, CancellationToken>? addCategorizedLocalDiagnostic, 166Action<Diagnostic, DiagnosticAnalyzer, AnalyzerOptions, CancellationToken>? addCategorizedNonLocalDiagnostic, 227internal Action<Exception, DiagnosticAnalyzer, Diagnostic, CancellationToken> OnAnalyzerException { get; } 360public void ExecuteSuppressionAction(DiagnosticSuppressor suppressor, ImmutableArray<Diagnostic> reportedDiagnostics, CancellationToken cancellationToken) 411out Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic); 469out Action<Diagnostic> addDiagnostic); 474out Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic); 588out Action<Diagnostic> addDiagnostic); 593out Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic); 644out Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic); 698out Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic); 744out Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic); 770Action<Diagnostic> addDiagnostic, 771Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic, 795Action<Diagnostic> addDiagnostic, 796Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic, 1025Action<AnalyzerDiagnosticReporter, Func<Diagnostic, CancellationToken, bool>, ExecutionData, TArgs, CancellationToken> executeActions, 1026Action<HashSet<TBlockAction>, AnalyzerDiagnosticReporter, Func<Diagnostic, CancellationToken, bool>, ExecutionData, TArgs, CancellationToken> executeBlockActions, 1066out Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic); 1128out Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic); 1144Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic, 1229out Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic); 1244Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic, 1362Action<Exception, DiagnosticAnalyzer, Diagnostic, CancellationToken> onAnalyzerException, 1372var diagnostic = CreateAnalyzerExceptionDiagnostic(analyzer, exception, info); 1400internal static Diagnostic CreateAnalyzerExceptionDiagnostic(DiagnosticAnalyzer analyzer, Exception e, AnalysisContextInfo? info = null) 1408return Diagnostic.Create(descriptor, Location.None, messageArguments); 1449internal static Diagnostic CreateDriverExceptionDiagnostic(Exception e) 1455return Diagnostic.Create(descriptor, Location.None, messageArguments); 1478internal static bool IsAnalyzerExceptionDiagnostic(Diagnostic diagnostic) 1494internal static bool AreEquivalentAnalyzerExceptionDiagnostics(Diagnostic exceptionDiagnostic, Diagnostic other) 1514private bool IsSupportedDiagnostic(DiagnosticAnalyzer analyzer, Diagnostic diagnostic, CancellationToken cancellationToken) 1527Diagnostic diagnostic, 1568private Action<Diagnostic> GetAddCompilationDiagnostic(
DiagnosticAnalyzer\AnalyzerManager.AnalyzerExecutionContext.cs (1)
339var diagnostic = AnalyzerExecutor.CreateAnalyzerExceptionDiagnostic(analyzer, exception);
DiagnosticAnalyzer\AnalyzerManager.cs (1)
274internal bool IsSupportedDiagnostic(DiagnosticAnalyzer analyzer, Diagnostic diagnostic, Func<DiagnosticAnalyzer, bool> isCompilerAnalyzer, AnalyzerExecutor analyzerExecutor, CancellationToken cancellationToken)
DiagnosticAnalyzer\CompilationWithAnalyzers.cs (30)
42private readonly ConcurrentSet<Diagnostic> _exceptionDiagnostics = new ConcurrentSet<Diagnostic>(); 228public Task<ImmutableArray<Diagnostic>> GetAnalyzerDiagnosticsAsync() 237public async Task<ImmutableArray<Diagnostic>> GetAnalyzerDiagnosticsAsync(CancellationToken cancellationToken = default) 248public async Task<ImmutableArray<Diagnostic>> GetAnalyzerDiagnosticsAsync(ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 279public Task<ImmutableArray<Diagnostic>> GetAllDiagnosticsAsync() 287public async Task<ImmutableArray<Diagnostic>> GetAllDiagnosticsAsync(CancellationToken cancellationToken = default) 297async Task<ImmutableArray<Diagnostic>> getAllDiagnosticsWithoutStateTrackingAsync(ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 319public async Task<ImmutableArray<Diagnostic>> GetAnalyzerCompilationDiagnosticsAsync(CancellationToken cancellationToken) 330public async Task<ImmutableArray<Diagnostic>> GetAnalyzerCompilationDiagnosticsAsync(ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 337private async Task<ImmutableArray<Diagnostic>> GetAnalyzerCompilationDiagnosticsCoreAsync(ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 351private async Task<ImmutableArray<Diagnostic>> GetAnalyzerDiagnosticsCoreAsync(ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 390public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSyntaxDiagnosticsAsync(SyntaxTree tree, CancellationToken cancellationToken) 406public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSyntaxDiagnosticsAsync(SyntaxTree tree, TextSpan? filterSpan, CancellationToken cancellationToken) 422public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSyntaxDiagnosticsAsync(SyntaxTree tree, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 440public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSyntaxDiagnosticsAsync(SyntaxTree tree, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 579private async Task<ImmutableArray<Diagnostic>> GetAnalyzerSyntaxDiagnosticsCoreAsync(SyntaxTree tree, ImmutableArray<DiagnosticAnalyzer> analyzers, TextSpan? filterSpan, CancellationToken cancellationToken) 593public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSemanticDiagnosticsAsync(SemanticModel model, TextSpan? filterSpan, CancellationToken cancellationToken) 608public async Task<ImmutableArray<Diagnostic>> GetAnalyzerSemanticDiagnosticsAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 653private async Task<ImmutableArray<Diagnostic>> GetAnalyzerSemanticDiagnosticsCoreAsync(SemanticModel model, TextSpan? filterSpan, ImmutableArray<DiagnosticAnalyzer> analyzers, CancellationToken cancellationToken) 1154public static IEnumerable<Diagnostic> GetEffectiveDiagnostics(IEnumerable<Diagnostic> diagnostics, Compilation compilation) 1164public static IEnumerable<Diagnostic> GetEffectiveDiagnostics(ImmutableArray<Diagnostic> diagnostics, Compilation compilation) 1179private static IEnumerable<Diagnostic> GetEffectiveDiagnosticsImpl(ImmutableArray<Diagnostic> diagnostics, Compilation compilation) 1192foreach (var diagnostic in diagnostics) 1196var effectiveDiagnostic = compilation.Options.FilterDiagnostic(diagnostic, CancellationToken.None); 1218Action<Exception, DiagnosticAnalyzer, Diagnostic>? onAnalyzerException = null) 1229Action<Exception, DiagnosticAnalyzer, Diagnostic, CancellationToken> wrappedOnAnalyzerException =
DiagnosticAnalyzer\CompilationWithAnalyzersOptions.cs (10)
15private readonly Action<Exception, DiagnosticAnalyzer, Diagnostic>? _onAnalyzerException; 29public Action<Exception, DiagnosticAnalyzer, Diagnostic>? OnAnalyzerException => _onAnalyzerException; 47/// Flag indicating whether analyzer diagnostics with <see cref="Diagnostic.IsSuppressed"/> should be reported. 67Action<Exception, DiagnosticAnalyzer, Diagnostic>? onAnalyzerException, 81/// <param name="reportSuppressedDiagnostics">Flag indicating whether analyzer diagnostics with <see cref="Diagnostic.IsSuppressed"/> should be reported.</param> 84Action<Exception, DiagnosticAnalyzer, Diagnostic>? onAnalyzerException, 100/// <param name="reportSuppressedDiagnostics">Flag indicating whether analyzer diagnostics with <see cref="Diagnostic.IsSuppressed"/> should be reported.</param> 103Action<Exception, DiagnosticAnalyzer, Diagnostic>? onAnalyzerException, 112/// <inheritdoc cref="CompilationWithAnalyzersOptions.CompilationWithAnalyzersOptions(AnalyzerOptions?, Action{Exception, DiagnosticAnalyzer, Diagnostic}?, bool, bool, bool, Func{Exception, bool}?)"/> 119Action<Exception, DiagnosticAnalyzer, Diagnostic>? onAnalyzerException,
DiagnosticAnalyzer\CompilerDiagnosticAnalyzer.CompilationAnalyzer.cs (10)
60ImmutableArray<Diagnostic> diagnostics, 61Action<Diagnostic> reportDiagnostic, 65foreach (var diagnostic in diagnostics) 70var current = properties == null ? diagnostic : new CompilerDiagnostic(diagnostic, properties); 78private readonly Diagnostic _original; 81public CompilerDiagnostic(Diagnostic original, ImmutableDictionary<string, string?> properties) 112public override bool Equals(Diagnostic? obj) 122internal override Diagnostic WithLocation(Location location) 127internal override Diagnostic WithSeverity(DiagnosticSeverity severity) 132internal override Diagnostic WithIsSuppressed(bool isSuppressed)
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (137)
50/// but cannot itself report any <see cref="Diagnostic"/>s. 57/// A compilation action reports <see cref="Diagnostic"/>s about the <see cref="Compilation"/>. 65/// reports <see cref="Diagnostic"/>s about the model. 72/// A symbol action reports <see cref="Diagnostic"/>s about <see cref="ISymbol"/>s. 83/// A symbol action reports <see cref="Diagnostic"/>s about <see cref="ISymbol"/>s. 102/// but cannot itself report any <see cref="Diagnostic"/>s. 110/// A code block action reports <see cref="Diagnostic"/>s about code blocks. 117/// A syntax tree action reports <see cref="Diagnostic"/>s about the <see cref="SyntaxTree"/> of a document. 124/// An additional file action reports <see cref="Diagnostic"/>s about the <see cref="AdditionalText"/> of a document. 134/// A syntax node action can report <see cref="Diagnostic"/>s about <see cref="SyntaxNode"/>s, and can also collect 147/// A syntax node action can report <see cref="Diagnostic"/>s about <see cref="SyntaxNode"/>s, and can also collect 158/// but cannot itself report any <see cref="Diagnostic"/>s. 168/// An operation block action reports <see cref="Diagnostic"/>s about operation blocks. 178/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 190/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 352/// A compilation end action reports <see cref="Diagnostic"/>s about the <see cref="CodeAnalysis.Compilation"/>. 360/// reports <see cref="Diagnostic"/>s about the model. 367/// A symbol action reports <see cref="Diagnostic"/>s about <see cref="ISymbol"/>s. 378/// A symbol action reports <see cref="Diagnostic"/>s about <see cref="ISymbol"/>s. 397/// but cannot itself report any <see cref="Diagnostic"/>s. 405/// A code block action reports <see cref="Diagnostic"/>s about code blocks. 413/// but cannot itself report any <see cref="Diagnostic"/>s. 423/// An operation block action reports <see cref="Diagnostic"/>s about operation blocks. 433/// A syntax tree action reports <see cref="Diagnostic"/>s about the <see cref="SyntaxTree"/> of a document. 440/// An additional file action reports <see cref="Diagnostic"/>s about the <see cref="AdditionalText"/> of a document. 450/// A syntax node action can report <see cref="Diagnostic"/>s about <see cref="SyntaxNode"/>s, and can also collect 463/// A syntax node action can report <see cref="Diagnostic"/>s about <see cref="SyntaxNode"/>s, and can also collect 473/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 485/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 556/// A compilation action or compilation end action can use a <see cref="CompilationAnalysisContext"/> to report <see cref="Diagnostic"/>s about a <see cref="CodeAnalysis.Compilation"/>. 562private readonly Action<Diagnostic> _reportDiagnostic; 563private readonly Func<Diagnostic, CancellationToken, bool> _isSupportedDiagnostic; 583public CompilationAnalysisContext(Compilation compilation, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, Func<Diagnostic, bool> isSupportedDiagnostic, CancellationToken cancellationToken) 591Action<Diagnostic> reportDiagnostic, 592Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic, 605/// Report a <see cref="Diagnostic"/> about a <see cref="CodeAnalysis.Compilation"/>. 607/// <param name="diagnostic"><see cref="Diagnostic"/> to be reported.</param> 608public void ReportDiagnostic(Diagnostic diagnostic) 679/// A semantic model action operates on the <see cref="CodeAnalysis.SemanticModel"/> of a code document, and can use a <see cref="SemanticModelAnalysisContext"/> to report <see cref="Diagnostic"/>s about the model. 685private readonly Action<Diagnostic> _reportDiagnostic; 686private readonly Func<Diagnostic, CancellationToken, bool> _isSupportedDiagnostic; 722public SemanticModelAnalysisContext(SemanticModel semanticModel, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, Func<Diagnostic, bool> isSupportedDiagnostic, CancellationToken cancellationToken) 730Action<Diagnostic> reportDiagnostic, 731Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic, 747/// Report a <see cref="Diagnostic"/> about a <see cref="CodeAnalysis.SemanticModel"/>. 749/// <param name="diagnostic"><see cref="Diagnostic"/> to be reported.</param> 750public void ReportDiagnostic(Diagnostic diagnostic) 762/// A symbol action can use a <see cref="SymbolAnalysisContext"/> to report <see cref="Diagnostic"/>s about an <see cref="ISymbol"/>. 769private readonly Action<Diagnostic> _reportDiagnostic; 770private readonly Func<Diagnostic, CancellationToken, bool> _isSupportedDiagnostic; 807internal Func<Diagnostic, CancellationToken, bool> IsSupportedDiagnostic => _isSupportedDiagnostic; 815public SymbolAnalysisContext(ISymbol symbol, Compilation compilation, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, Func<Diagnostic, bool> isSupportedDiagnostic, CancellationToken cancellationToken) 824Action<Diagnostic> reportDiagnostic, 825Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic, 845/// Report a <see cref="Diagnostic"/> about an <see cref="ISymbol"/>. 847/// <param name="diagnostic"><see cref="Diagnostic"/> to be reported.</param> 848public void ReportDiagnostic(Diagnostic diagnostic) 860/// A symbol start/end action can use a <see cref="SymbolStartAnalysisContext"/> to report <see cref="Diagnostic"/>s about code within a <see cref="ISymbol"/> and its members. 924/// A symbol end action reports <see cref="Diagnostic"/>s about the code within a <see cref="Symbol"/> and its members. 932/// but cannot itself report any <see cref="Diagnostic"/>s. 940/// A code block action reports <see cref="Diagnostic"/>s about code blocks. 947/// A syntax node action can report <see cref="Diagnostic"/>s about <see cref="SyntaxNode"/>s, and can also collect 960/// A syntax node action can report <see cref="Diagnostic"/>s about <see cref="SyntaxNode"/>s, and can also collect 971/// but cannot itself report any <see cref="Diagnostic"/>s. 978/// An operation block action reports <see cref="Diagnostic"/>s about operation blocks. 985/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 997/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 1095/// A code block end action reports <see cref="Diagnostic"/>s about code blocks. 1102/// A syntax node action can report <see cref="Diagnostic"/>s about <see cref="SyntaxNode"/>s, and can also collect 1114/// A syntax node action can report <see cref="Diagnostic"/>s about <see cref="SyntaxNode"/>s, and can also collect 1124/// A code block action or code block end action can use a <see cref="CodeBlockAnalysisContext"/> to report <see cref="Diagnostic"/>s about a code block. 1132private readonly Action<Diagnostic> _reportDiagnostic; 1133private readonly Func<Diagnostic, CancellationToken, bool> _isSupportedDiagnostic; 1179public CodeBlockAnalysisContext(SyntaxNode codeBlock, ISymbol owningSymbol, SemanticModel semanticModel, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, Func<Diagnostic, bool> isSupportedDiagnostic, CancellationToken cancellationToken) 1189Action<Diagnostic> reportDiagnostic, 1190Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic, 1208/// Report a <see cref="Diagnostic"/> about a code block. 1210/// <param name="diagnostic"><see cref="Diagnostic"/> to be reported.</param> 1211public void ReportDiagnostic(Diagnostic diagnostic) 1324/// A code block end action reports <see cref="Diagnostic"/>s about code blocks. 1331/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 1343/// An operation action can report <see cref="Diagnostic"/>s about <see cref="IOperation"/>s, and can also collect 1372/// An operation block action or operation block end action can use an <see cref="OperationAnalysisContext"/> to report <see cref="Diagnostic"/>s about an operation block. 1380private readonly Action<Diagnostic> _reportDiagnostic; 1381private readonly Func<Diagnostic, CancellationToken, bool> _isSupportedDiagnostic; 1436Action<Diagnostic> reportDiagnostic, 1437Func<Diagnostic, bool> isSupportedDiagnostic, 1449Action<Diagnostic> reportDiagnostic, 1450Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic, 1471/// Report a <see cref="Diagnostic"/> about a code block. 1473/// <param name="diagnostic"><see cref="Diagnostic"/> to be reported.</param> 1474public void ReportDiagnostic(Diagnostic diagnostic) 1505/// A syntax tree action can use a <see cref="SyntaxTreeAnalysisContext"/> to report <see cref="Diagnostic"/>s about a <see cref="SyntaxTree"/> for a code document. 1512private readonly Action<Diagnostic> _reportDiagnostic; 1513private readonly Func<Diagnostic, CancellationToken, bool> _isSupportedDiagnostic; 1546public SyntaxTreeAnalysisContext(SyntaxTree tree, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, Func<Diagnostic, bool> isSupportedDiagnostic, CancellationToken cancellationToken) 1554Action<Diagnostic> reportDiagnostic, 1555Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic, 1572/// Report a <see cref="Diagnostic"/> about a <see cref="SyntaxTree"/>. 1574/// <param name="diagnostic"><see cref="Diagnostic"/> to be reported.</param> 1575public void ReportDiagnostic(Diagnostic diagnostic) 1587/// An additional file action can use an <see cref="AdditionalFileAnalysisContext"/> to report <see cref="Diagnostic"/>s about a non-source <see cref="AdditionalText"/> document. 1591private readonly Action<Diagnostic> _reportDiagnostic; 1592private readonly Func<Diagnostic, CancellationToken, bool> _isSupportedDiagnostic; 1624Action<Diagnostic> reportDiagnostic, 1625Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic, 1644public void ReportDiagnostic(Diagnostic diagnostic) 1656/// A syntax node action can use a <see cref="SyntaxNodeAnalysisContext"/> to report <see cref="Diagnostic"/>s for a <see cref="SyntaxNode"/>. 1664private readonly Action<Diagnostic> _reportDiagnostic; 1665private readonly Func<Diagnostic, CancellationToken, bool> _isSupportedDiagnostic; 1716public SyntaxNodeAnalysisContext(SyntaxNode node, ISymbol? containingSymbol, SemanticModel semanticModel, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, Func<Diagnostic, bool> isSupportedDiagnostic, CancellationToken cancellationToken) 1722public SyntaxNodeAnalysisContext(SyntaxNode node, SemanticModel semanticModel, AnalyzerOptions options, Action<Diagnostic> reportDiagnostic, Func<Diagnostic, bool> isSupportedDiagnostic, CancellationToken cancellationToken) 1732Action<Diagnostic> reportDiagnostic, 1733Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic, 1751/// Report a <see cref="Diagnostic"/> about a <see cref="SyntaxNode"/>. 1753/// <param name="diagnostic"><see cref="Diagnostic"/> to be reported.</param> 1754public void ReportDiagnostic(Diagnostic diagnostic) 1766/// An operation action can use an <see cref="OperationAnalysisContext"/> to report <see cref="Diagnostic"/>s for an <see cref="IOperation"/>. 1774private readonly Action<Diagnostic> _reportDiagnostic; 1775private readonly Func<Diagnostic, CancellationToken, bool> _isSupportedDiagnostic; 1827Action<Diagnostic> reportDiagnostic, 1828Func<Diagnostic, bool> isSupportedDiagnostic, 1839Action<Diagnostic> reportDiagnostic, 1840Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic, 1860/// Report a <see cref="Diagnostic"/> about a <see cref="SyntaxNode"/>. 1862/// <param name="diagnostic"><see cref="Diagnostic"/> to be reported.</param> 1863public void ReportDiagnostic(Diagnostic diagnostic) 1894/// 2. Diagnostic's <see cref="Diagnostic.DefaultSeverity"/> is not <see cref="DiagnosticSeverity.Error"/>. 1897public ImmutableArray<Diagnostic> ReportedDiagnostics { get; } 1917ImmutableArray<Diagnostic> reportedDiagnostics,
DiagnosticAnalyzer\DiagnosticAnalysisContextHelpers.cs (3)
43internal static void VerifyArguments(Diagnostic diagnostic, Compilation? compilation, Func<Diagnostic, CancellationToken, bool> isSupportedDiagnostic, CancellationToken cancellationToken) 75internal static void VerifyDiagnosticLocationsInCompilation(Diagnostic diagnostic, Compilation compilation)
DiagnosticAnalyzer\DiagnosticQueue.cs (34)
20public abstract bool TryDequeue([NotNullWhen(returnValue: true)] out Diagnostic? d); 21public abstract void Enqueue(Diagnostic diagnostic); 24public abstract void EnqueueLocal(Diagnostic diagnostic, DiagnosticAnalyzer analyzer, bool isSyntaxDiagnostic); 25public abstract void EnqueueNonLocal(Diagnostic diagnostic, DiagnosticAnalyzer analyzer); 26public abstract ImmutableArray<Diagnostic> DequeueLocalSyntaxDiagnostics(DiagnosticAnalyzer analyzer); 27public abstract ImmutableArray<Diagnostic> DequeueLocalSemanticDiagnostics(DiagnosticAnalyzer analyzer); 28public abstract ImmutableArray<Diagnostic> DequeueNonLocalDiagnostics(DiagnosticAnalyzer analyzer); 40private readonly AsyncQueue<Diagnostic> _queue; 44_queue = new AsyncQueue<Diagnostic>(); 47public SimpleDiagnosticQueue(Diagnostic diagnostic) 49_queue = new AsyncQueue<Diagnostic>(); 53public override void Enqueue(Diagnostic diagnostic) 58public override void EnqueueLocal(Diagnostic diagnostic, DiagnosticAnalyzer analyzer, bool isSyntaxDiagnostic) 63public override void EnqueueNonLocal(Diagnostic diagnostic, DiagnosticAnalyzer analyzer) 68public override ImmutableArray<Diagnostic> DequeueLocalSemanticDiagnostics(DiagnosticAnalyzer analyzer) 73public override ImmutableArray<Diagnostic> DequeueLocalSyntaxDiagnostics(DiagnosticAnalyzer analyzer) 78public override ImmutableArray<Diagnostic> DequeueNonLocalDiagnostics(DiagnosticAnalyzer analyzer) 88public override bool TryDequeue([NotNullWhen(returnValue: true)] out Diagnostic? d) 104public override void Enqueue(Diagnostic diagnostic) 109public override void EnqueueLocal(Diagnostic diagnostic, DiagnosticAnalyzer analyzer, bool isSyntaxDiagnostic) 122public override void EnqueueNonLocal(Diagnostic diagnostic, DiagnosticAnalyzer analyzer) 129Diagnostic diagnostic, 139private static void EnqueueCore_NoLock(Dictionary<DiagnosticAnalyzer, SimpleDiagnosticQueue> diagnosticsMap, Diagnostic diagnostic, DiagnosticAnalyzer analyzer) 156public override bool TryDequeue([NotNullWhen(returnValue: true)] out Diagnostic? d) 164private bool TryDequeue_NoLock([NotNullWhen(returnValue: true)] out Diagnostic? d) 171private static bool TryDequeue_NoLock(Dictionary<DiagnosticAnalyzer, SimpleDiagnosticQueue>? lazyDiagnosticsMap, [NotNullWhen(returnValue: true)] out Diagnostic? d) 173Diagnostic? diag = null; 185public override ImmutableArray<Diagnostic> DequeueLocalSyntaxDiagnostics(DiagnosticAnalyzer analyzer) 190public override ImmutableArray<Diagnostic> DequeueLocalSemanticDiagnostics(DiagnosticAnalyzer analyzer) 195public override ImmutableArray<Diagnostic> DequeueNonLocalDiagnostics(DiagnosticAnalyzer analyzer) 200private ImmutableArray<Diagnostic> DequeueDiagnosticsCore(DiagnosticAnalyzer analyzer, Dictionary<DiagnosticAnalyzer, SimpleDiagnosticQueue>? lazyDiagnosticsMap) 204var builder = ImmutableArray.CreateBuilder<Diagnostic>(); 205while (queue.TryDequeue(out var d)) 213return ImmutableArray<Diagnostic>.Empty;
DiagnosticAnalyzer\DiagnosticSuppressor.cs (1)
35/// 2. Diagnostic's <see cref="Diagnostic.DefaultSeverity"/> is not <see cref="DiagnosticSeverity.Error"/>.
DiagnosticAnalyzer\Suppression.cs (8)
13/// Programmatic suppression of a <see cref="Diagnostic"/> by a <see cref="DiagnosticSuppressor"/>. 17private Suppression(SuppressionDescriptor descriptor, Diagnostic suppressedDiagnostic) 32/// Creates a suppression of a <see cref="Diagnostic"/> with the given <see cref="SuppressionDescriptor"/>. 39/// <see cref="Diagnostic"/> to be suppressed, which must be from <see cref="SuppressionAnalysisContext.ReportedDiagnostics"/> 41public static Suppression Create(SuppressionDescriptor descriptor, Diagnostic suppressedDiagnostic) 52public Diagnostic SuppressedDiagnostic { get; } 73&& EqualityComparer<Diagnostic>.Default.Equals(SuppressedDiagnostic, other.SuppressedDiagnostic); 80EqualityComparer<Diagnostic>.Default.GetHashCode(SuppressedDiagnostic));
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (4)
134public Diagnostic ApplySourceSuppressions(Diagnostic diagnostic) 152public bool IsDiagnosticSuppressed(Diagnostic diagnostic, [NotNullWhen(true)] out AttributeData? suppressingAttribute) 165private bool IsDiagnosticSuppressed(Diagnostic diagnostic, out SuppressMessageInfo info)
Emit\EditAndContinue\EmitDifferenceResult.cs (1)
24internal EmitDifferenceResult(bool success, ImmutableArray<Diagnostic> diagnostics, EmitBaseline? baseline, ImmutableArray<MethodDefinitionHandle> updatedMethods, ImmutableArray<TypeDefinitionHandle> changedTypes)
MetadataReader\MetadataHelpers.cs (1)
1003internal static void CheckAssemblyOrModuleName(string name, CommonMessageProvider messageProvider, int code, ArrayBuilder<Diagnostic> builder)
MetadataReference\PortableExecutableReference.cs (1)
186internal static Diagnostic ExceptionToDiagnostic(Exception e, CommonMessageProvider messageProvider, Location location, string display, MetadataImageKind kind)
ReferenceManager\CommonReferenceManager.Resolution.cs (3)
489Diagnostic? newDiagnostic = null; 531Debug.Assert(existing is Metadata || existing is Diagnostic); 536diagnostics.Add((Diagnostic)existing);
ReferenceManager\CommonReferenceManager.State.cs (3)
142private ImmutableArray<Diagnostic> _lazyDiagnostics; 205internal ImmutableArray<Diagnostic> Diagnostics 416ImmutableArray<Diagnostic> diagnostics,
RuleSet\RuleSet.cs (5)
288internal static ReportDiagnostic GetDiagnosticOptionsFromRulesetFile(string? rulesetFileFullPath, out Dictionary<string, ReportDiagnostic> diagnosticOptions, IList<Diagnostic>? diagnosticsOpt, CommonMessageProvider? messageProviderOpt) 299private static ReportDiagnostic GetDiagnosticOptionsFromRulesetFile(Dictionary<string, ReportDiagnostic> diagnosticOptions, string resolvedPath, IList<Diagnostic>? diagnosticsOpt, CommonMessageProvider? messageProviderOpt) 317diagnosticsOpt.Add(Diagnostic.Create(messageProviderOpt, messageProviderOpt.ERR_CantReadRulesetFile, resolvedPath, e.Message)); 326diagnosticsOpt.Add(Diagnostic.Create(messageProviderOpt, messageProviderOpt.ERR_CantReadRulesetFile, resolvedPath, new CodeAnalysisResourcesLocalizableErrorArgument(nameof(CodeAnalysisResources.FileNotFound)))); 333diagnosticsOpt.Add(Diagnostic.Create(messageProviderOpt, messageProviderOpt.ERR_CantReadRulesetFile, resolvedPath, e.Message));
SourceGeneration\GeneratorContexts.cs (3)
98/// Adds a <see cref="Diagnostic"/> to the users compilation 108public void ReportDiagnostic(Diagnostic diagnostic) 114internal (ImmutableArray<GeneratedSourceText> sources, ImmutableArray<Diagnostic> diagnostics) ToImmutableAndFree()
SourceGeneration\GeneratorDriver.cs (10)
78public GeneratorDriver RunGeneratorsAndUpdateCompilation(Compilation compilation, out Compilation outputCompilation, out ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken = default) 561var diagnostic = CreateGeneratorExceptionDiagnostic(provider, generator, e, isInit: phase == GeneratorRunPhase.Init); 562var filtered = compilation.Options.FilterDiagnostic(diagnostic, cancellationToken); 579private static Diagnostic CreateGeneratorExceptionDiagnostic(CommonMessageProvider provider, ISourceGenerator generator, Exception e, bool isInit) 596return Diagnostic.Create(descriptor, Location.None, generator.GetGeneratorType().Name, e.GetType().Name, e.Message, e.CreateDiagnosticDescription()); 599private static ImmutableArray<Diagnostic> FilterDiagnostics(Compilation compilation, ImmutableArray<Diagnostic> generatorDiagnostics, DiagnosticBag? driverDiagnostics, CancellationToken cancellationToken) 607ArrayBuilder<Diagnostic> filteredDiagnostics = ArrayBuilder<Diagnostic>.GetInstance(); 608foreach (var diag in generatorDiagnostics)
SourceGeneration\GeneratorState.cs (6)
26ImmutableArray<Diagnostic>.Empty, 51ImmutableArray<Diagnostic>.Empty, 67ImmutableArray<Diagnostic> diagnostics, 107ImmutableArray<Diagnostic> diagnostics, 127public GeneratorState WithError(Exception exception, Diagnostic error, TimeSpan elapsedTime, GeneratorRunPhase phase) 161internal ImmutableArray<Diagnostic> Diagnostics { get; }
SourceGeneration\IncrementalContexts.cs (3)
305/// Adds a <see cref="Diagnostic"/> to the users compilation 315public void ReportDiagnostic(Diagnostic diagnostic) 442internal (ImmutableArray<GeneratedSourceText> sources, ImmutableArray<Diagnostic> diagnostics, GeneratorRunStateTable executedSteps, ImmutableDictionary<string, object> hostOutputs) ToImmutableAndFree()
SourceGeneration\Nodes\AbstractSourceOutputNode.cs (2)
12using TOutput = System.ValueTuple<System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.GeneratedSourceText>, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.Diagnostic>>; 88public IIncrementalGeneratorNode<(IEnumerable<GeneratedSourceText>, IEnumerable<Diagnostic>)> WithTrackingName(string name) => throw ExceptionUtilities.Unreachable();
SourceGeneration\RunResults.cs (6)
19private ImmutableArray<Diagnostic> _lazyDiagnostics; 40/// The <see cref="Diagnostic"/>s produced by all generators run during this generation pass. 45public ImmutableArray<Diagnostic> Diagnostics 84ImmutableArray<Diagnostic> diagnostics, 116/// A collection of <see cref="Diagnostic"/>s reported by <see cref="Generator"/> 122public ImmutableArray<Diagnostic> Diagnostics { get; }
StrongName\StrongNameKeys.cs (6)
36internal readonly Diagnostic? DiagnosticOpt; 69internal StrongNameKeys(Diagnostic diagnostic) 175var diagnostic = GetError(keyFilePath, keyContainerName, new CodeAnalysisResourcesLocalizableErrorArgument(nameof(CodeAnalysisResources.AssemblySigningNotSupported)), messageProvider); 204internal static Diagnostic GetError(string? keyFilePath, string? keyContainerName, object message, CommonMessageProvider messageProvider) 217internal static Diagnostic GetContainerError(CommonMessageProvider messageProvider, string name, object message) 222internal static Diagnostic GetKeyFileError(CommonMessageProvider messageProvider, string path, object message)
Syntax\SyntaxNode.cs (1)
703public IEnumerable<Diagnostic> GetDiagnostics()
Syntax\SyntaxNodeOrToken.cs (2)
466public IEnumerable<Diagnostic> GetDiagnostics() 478return SpecializedCollections.EmptyEnumerable<Diagnostic>();
Syntax\SyntaxToken.cs (5)
24private static readonly Func<DiagnosticInfo, Diagnostic> s_createDiagnosticWithoutLocation = Diagnostic.Create; 657public IEnumerable<Diagnostic> GetDiagnostics() 661return SpecializedCollections.EmptyEnumerable<Diagnostic>(); 671? SpecializedCollections.EmptyEnumerable<Diagnostic>()
Syntax\SyntaxTree.cs (5)
179public abstract IEnumerable<Diagnostic> GetDiagnostics(CancellationToken cancellationToken = default); 186public abstract IEnumerable<Diagnostic> GetDiagnostics(SyntaxNode node); 193public abstract IEnumerable<Diagnostic> GetDiagnostics(SyntaxToken token); 200public abstract IEnumerable<Diagnostic> GetDiagnostics(SyntaxTrivia trivia); 208public abstract IEnumerable<Diagnostic> GetDiagnostics(SyntaxNodeOrToken nodeOrToken);
Syntax\SyntaxTrivia.cs (4)
421public IEnumerable<Diagnostic> GetDiagnostics() 425return SpecializedCollections.EmptyEnumerable<Diagnostic>(); 437? SpecializedCollections.EmptyEnumerable<Diagnostic>() 438: diagnostics.Select(Diagnostic.Create);
Microsoft.CodeAnalysis.Analyzers (161)
FixAnalyzers\FixerWithFixAllAnalyzer.cs (3)
231Diagnostic diagnostic = fixer.CreateDiagnostic(OverrideGetFixAllProviderRule, fixer.Name); 284Diagnostic diagnostic = invocation.CreateDiagnostic(CreateCodeActionEquivalenceKeyRule, EquivalenceKeyParameterName); 297Diagnostic diagnostic = objectCreation.CreateDiagnostic(OverrideCodeActionEquivalenceKeyRule, objectCreation.Constructor!.ContainingType, EquivalenceKeyPropertyName);
MetaAnalyzers\CompilerExtensionStrictApiAnalyzer.cs (1)
153context.ReportDiagnostic(Diagnostic.Create(descriptor, Location.Create(applicationSyntaxReference.SyntaxTree, applicationSyntaxReference.Span)));
MetaAnalyzers\CompilerExtensionTargetFrameworkAnalyzer.cs (1)
102context.ReportDiagnostic(Diagnostic.Create(
MetaAnalyzers\DiagnosticAnalyzerAPIUsageAnalyzer.cs (1)
182Diagnostic diagnostic = declaredType.CreateDiagnostic(rule, args);
MetaAnalyzers\DiagnosticAnalyzerAttributeAnalyzer.cs (2)
125Diagnostic diagnostic = namedType.CreateDiagnostic(MissingDiagnosticAnalyzerAttributeRule); 140Diagnostic diagnostic = attributeSyntax.CreateDiagnostic(AddLanguageSupportToAnalyzerRule, namedType.Name, missingLanguage);
MetaAnalyzers\DiagnosticAnalyzerFieldsAnalyzer.cs (1)
167Diagnostic diagnostic = typeSyntax.CreateDiagnostic(DoNotStorePerCompilationDataOntoFieldsRule, type.ToDisplayString());
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (20)
226out List<Diagnostic>? invalidFileDiagnostics); 234out List<Diagnostic>? invalidReleaseFileEntryDiagnostics); 443context.ReportDiagnostic(Diagnostic.Create(AddCompilationEndCustomTagRule, field.Locations[0], field.Name)); 455foreach (var diagnostic in invalidFileDiagnostics) 480var diagnostic = Diagnostic.Create(UseUniqueDiagnosticIdRule, location, ruleId, skippedAnalyzerName); 639private static void AnalyzeTitleCore(string title, IArgumentOperation argumentOperation, Location fixLocation, Action<Diagnostic> reportDiagnostic) 668Action<Diagnostic> reportDiagnostic) 689internal static bool TryGetAdditionalDocumentLocationInfo(Diagnostic diagnostic, 736private static void AnalyzeMessageCore(string message, IArgumentOperation argumentOperation, Location fixLocation, Action<Diagnostic> reportDiagnostic) 783private static void AnalyzeDescriptionCore(string description, IArgumentOperation argumentOperation, Location fixLocation, Action<Diagnostic> reportDiagnostic) 805Action<string, IArgumentOperation, Location, Action<Diagnostic>> analyzeStringValueCore, 842Action<string, IArgumentOperation, Location, Action<Diagnostic>> analyzeStringValueCore, 848Action<Diagnostic> reportDiagnostic, 860Action<string, IArgumentOperation, Location, Action<Diagnostic>> analyzeLocalizableStringValueCore, 865Action<Diagnostic> reportDiagnostic, 1044Diagnostic diagnostic = argument.CreateDiagnostic(ProvideHelpUriInDescriptorRule); 1079Diagnostic diagnostic = argument.CreateDiagnostic(ProvideCustomTagsInDescriptorRule); 1272var diagnostic = argument.CreateDiagnostic(EnableAnalyzerReleaseTrackingRule, ruleId); 1280var diagnostic = argument.Value.CreateDiagnostic(DiagnosticIdMustBeAConstantRule, arg1);
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_IdRangeAndCategoryValidation.cs (7)
71Action<Diagnostic> addDiagnostic) 131var diagnostic = argument.Value.CreateDiagnostic(DiagnosticIdMustBeInSpecifiedFormatRule, arg1, arg2, arg3.ToString(), arg4); 185var diagnostic = argument.Value.CreateDiagnostic(UseCategoriesFromSpecifiedRangeRule, arg1, arg2); 199out List<Diagnostic>? invalidFileDiagnostics) 232out List<Diagnostic>? invalidFileDiagnostics) 340var diagnostic = Diagnostic.Create(AnalyzerCategoryAndIdRangeFileInvalidRule, location, arg1, arg2);
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_ReleaseTracking.cs (16)
170out List<Diagnostic>? invalidFileDiagnostics) 181var diagnostics = new List<Diagnostic>(); 206var diagnostic = Diagnostic.Create(RemoveDuplicateEntriesForAnalyzerReleaseRule, location, arg1, arg2, arg3); 238var diagnostic = Diagnostic.Create(rule, location, arg1, arg2); 284Action<Diagnostic> addDiagnostic) 291var diagnostic = ruleIdArgument.CreateDiagnostic(DeclareDiagnosticIdInAnalyzerReleaseRule, properties, ruleId); 298var diagnostic = ruleIdArgument.CreateDiagnostic(UnexpectedAnalyzerDiagnosticForRemovedDiagnosticIdRule, ruleId); 327var diagnostic = ruleIdArgument.CreateDiagnostic(UpdateDiagnosticIdInAnalyzerReleaseRule, properties, ruleId); 396List<Diagnostic>? invalidReleaseTrackingDiagnostics, 405foreach (var diagnostic in invalidReleaseTrackingDiagnostics) 451var diagnostic = Diagnostic.Create(RemoveDuplicateEntriesBetweenAnalyzerReleasesRule, location, arg1, arg2, arg3); 471var diagnostic = Diagnostic.Create(InvalidRemovedOrChangedWithoutPriorNewEntryInAnalyzerReleasesFileRule, location, arg1, arg2, arg3);
MetaAnalyzers\DoNotUseFileTypesForAnalyzersOrGenerators.cs (2)
64var diagnostic = Diagnostic.Create(Rule, namedTypeSymbol.Locations[0], namedTypeSymbol.Name);
MetaAnalyzers\Fixers\AnalyzerReleaseTrackingFix.cs (3)
50foreach (var diagnostic in context.Diagnostics) 124private static bool IsAddEntryToUnshippedFileDiagnostic(Diagnostic diagnostic, [NotNullWhen(returnValue: true)] out string? entryToAdd) 139Diagnostic diagnostic,
MetaAnalyzers\Fixers\AnalyzerReleaseTrackingFix.FixAllProvider.cs (15)
28var diagnosticsToFix = new List<KeyValuePair<Project, ImmutableArray<Diagnostic>>>(); 33ImmutableArray<Diagnostic> diagnostics = await fixAllContext.GetDocumentDiagnosticsAsync(fixAllContext.Document!).ConfigureAwait(false); 34diagnosticsToFix.Add(new KeyValuePair<Project, ImmutableArray<Diagnostic>>(fixAllContext.Project, diagnostics)); 41ImmutableArray<Diagnostic> diagnostics = await fixAllContext.GetAllDiagnosticsAsync(project).ConfigureAwait(false); 42diagnosticsToFix.Add(new KeyValuePair<Project, ImmutableArray<Diagnostic>>(fixAllContext.Project, diagnostics)); 50ImmutableArray<Diagnostic> diagnostics = await fixAllContext.GetAllDiagnosticsAsync(project).ConfigureAwait(false); 51diagnosticsToFix.Add(new KeyValuePair<Project, ImmutableArray<Diagnostic>>(project, diagnostics)); 76private readonly List<KeyValuePair<Project, ImmutableArray<Diagnostic>>> _diagnosticsToFix; 79public FixAllAdditionalDocumentChangeAction(FixAllScope fixAllScope, Solution solution, List<KeyValuePair<Project, ImmutableArray<Diagnostic>>> diagnosticsToFix, string? equivalenceKey) 94foreach (KeyValuePair<Project, ImmutableArray<Diagnostic>> pair in _diagnosticsToFix) 97ImmutableArray<Diagnostic> diagnostics = pair.Value; 130private static async Task<SourceText> AddEntriesToUnshippedFileForDiagnosticsAsync(TextDocument unshippedDataDocument, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 133foreach (var diagnostic in diagnostics) 144private static async Task<SourceText> UpdateEntriesInUnshippedFileForDiagnosticsAsync(TextDocument unshippedDataDocument, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 147foreach (var diagnostic in diagnostics)
MetaAnalyzers\Fixers\CompareSymbolsCorrectlyFix.cs (1)
36foreach (var diagnostic in context.Diagnostics)
MetaAnalyzers\Fixers\ConfigureGeneratedCodeAnalysisFix.cs (1)
30foreach (var diagnostic in context.Diagnostics)
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.cs (4)
50foreach (var diagnostic in context.Diagnostics) 105Diagnostic diagnostic, 138private static bool TryGetFixValue(Diagnostic diagnostic, [NotNullWhen(returnValue: true)] out string? fixValue) 143Diagnostic diagnostic,
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.CustomFixAllProvider.cs (10)
41var diagnosticsToFix = new List<KeyValuePair<Project, ImmutableArray<Diagnostic>>>(); 46ImmutableArray<Diagnostic> diagnostics = await fixAllContext.GetDocumentDiagnosticsAsync(fixAllContext.Document!).ConfigureAwait(false); 47diagnosticsToFix.Add(new KeyValuePair<Project, ImmutableArray<Diagnostic>>(fixAllContext.Project, diagnostics)); 54ImmutableArray<Diagnostic> diagnostics = await fixAllContext.GetAllDiagnosticsAsync(project).ConfigureAwait(false); 55diagnosticsToFix.Add(new KeyValuePair<Project, ImmutableArray<Diagnostic>>(fixAllContext.Project, diagnostics)); 63ImmutableArray<Diagnostic> diagnostics = await fixAllContext.GetAllDiagnosticsAsync(project).ConfigureAwait(false); 64diagnosticsToFix.Add(new KeyValuePair<Project, ImmutableArray<Diagnostic>>(project, diagnostics)); 83private readonly List<KeyValuePair<Project, ImmutableArray<Diagnostic>>> _diagnosticsToFix; 86public FixAllAdditionalDocumentChangeAction(FixAllScope fixAllScope, Solution solution, List<KeyValuePair<Project, ImmutableArray<Diagnostic>>> diagnosticsToFix, string equivalenceKey) 107foreach (var diagnostic in diagnostics)
MetaAnalyzers\Fixers\EnableConcurrentExecutionFix.cs (1)
29foreach (var diagnostic in context.Diagnostics)
MetaAnalyzers\Fixers\PreferIsKindFix.cs (3)
24foreach (var diagnostic in context.Diagnostics) 63protected override async Task<Document?> FixAllAsync(FixAllContext fixAllContext, Document document, ImmutableArray<Diagnostic> diagnostics) 66foreach (var diagnostic in diagnostics)
MetaAnalyzers\RegisterActionAnalyzer.cs (7)
356Diagnostic diagnostic = invocationExpression.CreateDiagnostic(rule); 369Diagnostic diagnostic = argument.CreateDiagnostic(UnsupportedSymbolKindArgumentRule, symbol.Name); 412Diagnostic diagnostic = Diagnostic.Create(InvalidSyntaxKindTypeArgumentRule, location, typeArgument.Name, DiagnosticWellKnownNames.TLanguageKindEnumName, method.Name); 570Diagnostic diagnostic; 573diagnostic = Diagnostic.Create(StartActionWithNoRegisteredActionsRule, location, parameterName, parentRegisterMethodName); 577diagnostic = Diagnostic.Create(StartActionWithOnlyEndActionRule, location, parameterName, endActionName, statelessActionName, parentRegisterMethodName);
MetaAnalyzers\ReportDiagnosticAnalyzer.cs (2)
233method.Name.Equals(nameof(Diagnostic.Create), StringComparison.OrdinalIgnoreCase)) 245Diagnostic diagnostic = syntaxNode.CreateDiagnostic(InvalidReportDiagnosticRule, descriptorFields[0].Name);
src\roslyn\src\Compilers\Core\Portable\Diagnostic\DiagnosticArrayExtensions.cs (1)
11internal static bool HasAnyErrors<T>(this ImmutableArray<T> diagnostics) where T : Diagnostic
src\roslyn\src\RoslynAnalyzers\Microsoft.CodeAnalysis.BannedApiAnalyzers\Core\SymbolIsBannedAnalyzerBase.cs (6)
295void VerifyAttributes(Action<Diagnostic> reportDiagnostic, ImmutableArray<AttributeData> attributes, CancellationToken cancellationToken) 325bool VerifyType(Action<Diagnostic> reportDiagnostic, ITypeSymbol? type, SyntaxNode syntaxNode) 383bool VerifyTypeArguments(Action<Diagnostic> reportDiagnostic, ITypeSymbol? type, SyntaxNode syntaxNode, out ITypeSymbol? originalDefinition) 418void VerifySymbol(Action<Diagnostic> reportDiagnostic, ISymbol symbol, SyntaxNode syntaxNode) 450void VerifyDocumentationSyntax(Action<Diagnostic> reportDiagnostic, SyntaxNode syntaxNode, SyntaxNodeAnalysisContext context) 464void VerifyBaseTypesSyntax(Action<Diagnostic> reportDiagnostic, IEnumerable<SyntaxNode> typeSyntaxNodes, SyntaxNodeAnalysisContext context)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
34protected abstract Diagnostic CreateDiagnostic(IMethodSymbol containingMethod, SyntaxToken catchKeyword);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (20)
18public static Diagnostic CreateDiagnostic( 24public static Diagnostic CreateDiagnostic( 31public static Diagnostic CreateDiagnostic( 45public static Diagnostic CreateDiagnostic( 51public static Diagnostic CreateDiagnostic( 60public static Diagnostic CreateDiagnostic( 70public static Diagnostic CreateDiagnostic( 78public static Diagnostic CreateDiagnostic( 86public static Diagnostic CreateDiagnostic( 95public static Diagnostic CreateDiagnostic( 105public static Diagnostic CreateDiagnostic( 112public static Diagnostic CreateDiagnostic( 124return Diagnostic.Create( 132public static Diagnostic CreateDiagnostic( 140public static Diagnostic CreateDiagnostic( 149return Diagnostic.Create(rule, null, args); 152return Diagnostic.Create(rule, 168Action<Diagnostic> addDiagnostic, 187var diagnostic = Diagnostic.Create(rule, Location.None, properties, args);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
27Action<Diagnostic> reportDiagnostic,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\CodeFixContextExtensions.cs (2)
16internal static void RegisterFixes(this CodeFixContext context, IEnumerable<CodeAction> actions, Diagnostic diagnostic) 27internal static void RegisterFixes(this CodeFixContext context, IEnumerable<CodeAction> actions, ImmutableArray<Diagnostic> diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (9)
22public static async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync( 27var allDiagnostics = ImmutableArray<Diagnostic>.Empty; 41return ImmutableDictionary<Document, ImmutableArray<Diagnostic>>.Empty.SetItem(document, documentDiagnostics); 80allDiagnostics = await ProducerConsumer<ImmutableArray<Diagnostic>>.RunParallelAsync( 90using var _2 = ArrayBuilder<Diagnostic>.GetInstance(out var builder); 106return ImmutableDictionary<Document, ImmutableArray<Diagnostic>>.Empty; 132private static async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync( 134ImmutableArray<Diagnostic> diagnostics, 137var builder = ImmutableDictionary.CreateBuilder<Document, ImmutableArray<Diagnostic>>();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (7)
33/// cref="Diagnostic.Properties"/> for that diagnostic. The diagnostic itself is not passed along as it was 34/// computed with respect to the original user document, and as such its <see cref="Diagnostic.Location"/> and <see 35/// cref="Diagnostic.AdditionalLocations"/> will not be correct. 44protected sealed override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 56ImmutableArray<Diagnostic> diagnostics, 62using var _ = ArrayBuilder<(TDiagnosticNode diagnosticNode, Diagnostic diagnostic)>.GetInstance(out var originalNodes); 63foreach (var diagnostic in diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\MultiProjectSafeFixAllProvider.cs (1)
110static IEnumerable<TextSpan> GetDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (9)
57protected void RegisterCodeFix(CodeFixContext context, string title, string equivalenceKey, Diagnostic? diagnostic = null) 60protected void RegisterCodeFix(CodeFixContext context, string title, string equivalenceKey, CodeActionPriority priority, Diagnostic? diagnostic = null) 63protected Func<CancellationToken, Task<Document>> GetDocumentUpdater(CodeFixContext context, Diagnostic? diagnostic = null) 70Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 98Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken); 105/// <para/> This overload differs from <see cref="IncludeDiagnosticDuringFixAll(Diagnostic)"/> in that it also 111protected virtual bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 122/// cref="IncludeDiagnosticDuringFixAll(Diagnostic, Document, string, CancellationToken)"/> should be overridden 127protected virtual bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
184public static async Task<ImmutableArray<Diagnostic>> GetErrorsAsync(this Document document, CancellationToken cancellationToken, IList<string>? ignoreErrorCode = null)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
32public static string? TryGetAnalyzerConfigPathForDiagnosticConfiguration(this Project project, Diagnostic diagnostic) 38private static string? TryGetAnalyzerConfigPathForProjectOrDiagnosticConfiguration(Project project, Diagnostic? diagnostic)
Microsoft.CodeAnalysis.AnalyzerUtilities (23)
src\roslyn\src\Compilers\Core\Portable\Diagnostic\DiagnosticArrayExtensions.cs (1)
11internal static bool HasAnyErrors<T>(this ImmutableArray<T> diagnostics) where T : Diagnostic
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
34protected abstract Diagnostic CreateDiagnostic(IMethodSymbol containingMethod, SyntaxToken catchKeyword);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (20)
18public static Diagnostic CreateDiagnostic( 24public static Diagnostic CreateDiagnostic( 31public static Diagnostic CreateDiagnostic( 45public static Diagnostic CreateDiagnostic( 51public static Diagnostic CreateDiagnostic( 60public static Diagnostic CreateDiagnostic( 70public static Diagnostic CreateDiagnostic( 78public static Diagnostic CreateDiagnostic( 86public static Diagnostic CreateDiagnostic( 95public static Diagnostic CreateDiagnostic( 105public static Diagnostic CreateDiagnostic( 112public static Diagnostic CreateDiagnostic( 124return Diagnostic.Create( 132public static Diagnostic CreateDiagnostic( 140public static Diagnostic CreateDiagnostic( 149return Diagnostic.Create(rule, null, args); 152return Diagnostic.Create(rule, 168Action<Diagnostic> addDiagnostic, 187var diagnostic = Diagnostic.Create(rule, Location.None, properties, args);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
27Action<Diagnostic> reportDiagnostic,
Microsoft.CodeAnalysis.CodeStyle (86)
src\roslyn\src\Analyzers\Core\Analyzers\ConvertTypeofToNameof\AbstractConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
42context.ReportDiagnostic(Diagnostic.Create(Descriptor, location));
src\roslyn\src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderDiagnosticAnalyzer.cs (2)
71context.ReportDiagnostic(Diagnostic.Create(s_missingHeaderDescriptor, fileHeader.GetLocation(tree))); 78context.ReportDiagnostic(Diagnostic.Create(s_invalidHeaderDescriptor, fileHeader.GetLocation(tree)));
src\roslyn\src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (1)
98context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (22)
19/// Creates a <see cref="Diagnostic"/> instance. 28/// If null, <see cref="Diagnostic.AdditionalLocations"/> will return an empty list. 32/// can convey more detailed information to the fixer. If null, <see cref="Diagnostic.Properties"/> will return 36/// <returns>The <see cref="Diagnostic"/> instance.</returns> 37public static Diagnostic Create( 76/// <see cref="Diagnostic.AdditionalLocations"/>. 81/// <see cref="Diagnostic.AdditionalLocations"/>. 84/// <returns>The <see cref="Diagnostic"/> instance.</returns> 85public static Diagnostic CreateWithLocationTags( 104private static Diagnostic CreateWithLocationTags( 140/// <see cref="Diagnostic.AdditionalLocations"/>. 145/// <see cref="Diagnostic.AdditionalLocations"/>. 152/// <returns>The <see cref="Diagnostic"/> instance.</returns> 153public static Diagnostic CreateWithLocationTags( 174public static Diagnostic CreateWithLocationTags( 200private static Diagnostic CreateWithLocationTags( 241/// Creates a <see cref="Diagnostic"/> instance. 250/// If null, <see cref="Diagnostic.AdditionalLocations"/> will return an empty list. 254/// can convey more detailed information to the fixer. If null, <see cref="Diagnostic.Properties"/> will return 258/// <returns>The <see cref="Diagnostic"/> instance.</returns> 259public static Diagnostic CreateWithMessage( 274return Diagnostic.Create(
src\roslyn\src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
126var diagnostic = DiagnosticHelper.Create(
src\roslyn\src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (3)
65var diagnostic = TryGetDiagnostic( 92var diagnostic = TryGetDiagnostic( 109private Diagnostic? TryGetDiagnostic(
src\roslyn\src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (2)
72var diagnostic = Diagnostic.Create(
src\roslyn\src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (1)
112context.ReportDiagnostic(Diagnostic.Create(Descriptor,
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessaryCast\AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (3)
44var diagnostic = TryRemoveCastExpression( 55private Diagnostic? TryRemoveCastExpression(SemanticModel model, TCastExpression node, CancellationToken cancellationToken) 70return Diagnostic.Create(
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (6)
113foreach (var diagnostic in diagnostics) 142context.ReportDiagnostic(Diagnostic.Create(s_enableGenerateDocumentationFileIdDescriptor, Location.None)); 198private static IEnumerable<Diagnostic> CreateClassificationDiagnostics( 209yield return Diagnostic.Create(descriptor, tree.GetLocation(span)); 216private IEnumerable<Diagnostic> CreateFixableDiagnostics( 222yield return Diagnostic.Create(s_fixableIdDescriptor, tree.GetLocation(span));
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs (4)
73public void AnalyzeAssemblyOrModuleAttribute(SyntaxNode attributeSyntax, SemanticModel model, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken) 82reportDiagnostic(Diagnostic.Create(s_invalidScopeDescriptor, attributeSyntax.GetLocation())); 89reportDiagnostic(Diagnostic.Create(s_invalidOrMissingTargetDescriptor, attributeSyntax.GetLocation())); 112reportDiagnostic(Diagnostic.Create(LegacyFormatTargetDescriptor, targetValueOperation.Syntax.GetLocation(), properties, targetSymbolString));
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (20)
89Action<Diagnostic> reportDiagnostic, 389private static async Task<(ImmutableArray<Diagnostic> reportedDiagnostics, ImmutableArray<string> unhandledIds)> GetReportedDiagnosticsForIdsAsync( 450using var _3 = ArrayBuilder<Diagnostic>.GetInstance(out var reportedDiagnostics); 483static void AddAllDiagnostics(ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> diagnostics, ArrayBuilder<Diagnostic> reportedDiagnostics) 491static void AddAllCompilationDiagnosticsForTree(AnalysisResult analysisResult, SyntaxTree tree, ArrayBuilder<Diagnostic> reportedDiagnostics) 495foreach (var diagnostic in perAnalyzerDiagnostics) 507ImmutableArray<Diagnostic> diagnostics, 516foreach (var diagnostic in diagnostics) 544Diagnostic diagnostic, 584Diagnostic diagnostic, 612Action<Diagnostic> reportDiagnostic, 616using var _ = ArrayBuilder<Diagnostic>.GetInstance(out var diagnosticsBuilder); 622foreach (var diagnostic in effectiveDiagnostics) 630ArrayBuilder<Diagnostic> diagnosticsBuilder, 655var diagnostic = Diagnostic.Create(s_removeUnnecessarySuppressionDescriptor, pragma.GetLocation(), severity, additionalLocations, properties: null); 662ArrayBuilder<Diagnostic> diagnosticsBuilder, 670var diagnostic = Diagnostic.Create(s_removeUnnecessarySuppressionDescriptor, attribute.GetLocation(), severity, additionalLocations: null, properties: null);
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (3)
294public static bool TryGetUnusedValuePreference(Diagnostic diagnostic, out UnusedValuePreference preference) 315public static bool GetIsUnusedLocalDiagnostic(Diagnostic diagnostic) 321public static bool GetIsRemovableAssignmentDiagnostic(Diagnostic diagnostic)
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
215var diagnostic = DiagnosticHelper.Create(s_expressionValueIsUnusedRule, 573var diagnostic = DiagnosticHelper.Create(s_valueAssignedIsUnusedRule,
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (2)
122Action<Diagnostic> reportDiagnostic, 146var diagnostic = DiagnosticHelper.CreateWithMessage(s_unusedParameterRule, location,
src\roslyn\src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (7)
97protected abstract ImmutableArray<Diagnostic> AnalyzeCodeBlock(CodeBlockAnalysisContext context, SyntaxNode root); 98protected abstract ImmutableArray<Diagnostic> AnalyzeSemanticModel(SemanticModelAnalysisContext context, SyntaxNode root, TextSpanMutableIntervalTree? codeBlockIntervalTree); 100public bool TrySimplify(SemanticModel model, SyntaxNode node, [NotNullWhen(true)] out Diagnostic? diagnostic, TSimplifierOptions options, AnalyzerOptions analyzerOptions, CancellationToken cancellationToken) 121internal static Diagnostic CreateDiagnostic(SemanticModel model, TSimplifierOptions options, AnalyzerOptions analyzerOptions, TextSpan issueSpan, string diagnosticId, bool inDeclaration) 153var diagnostic = DiagnosticHelper.Create(descriptor, tree.GetLocation(issueSpan), notificationOption, analyzerOptions, additionalLocations: null, builder.ToImmutable()); 230foreach (var diagnostic in diagnostics) 283foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
670context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\Core\Analyzers\UseCollectionInitializer\UseCollectionInitializerHelpers.cs (1)
99public static bool ChangesSemantics(Diagnostic diagnostic)
src\roslyn\src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (2)
357var diagnostic = Diagnostic.Create(
src\roslyn\src\Compilers\Core\Portable\Diagnostic\DiagnosticArrayExtensions.cs (1)
11internal static bool HasAnyErrors<T>(this ImmutableArray<T> diagnostics) where T : Diagnostic
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
27Action<Diagnostic> reportDiagnostic,
Microsoft.CodeAnalysis.CodeStyle.Fixes (175)
src\roslyn\src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AbstractAddAccessibilityModifiersCodeFixProvider.cs (3)
26var diagnostic = context.Diagnostics.First(); 40Document document, ImmutableArray<Diagnostic> diagnostics, 45foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (5)
37var diagnostic = context.Diagnostics[0]; 53Document document, Diagnostic diagnostic, CancellationToken cancellationToken) 83Document document, ImmutableArray<Diagnostic> diagnostics, 91foreach (var diagnostic in diagnostics) 100Document document, SemanticModel semanticModel, Diagnostic diagnostic,
src\roslyn\src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (2)
69var diagnostic = context.Diagnostics.First(); 212ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\Core\CodeFixes\AddObsoleteAttribute\AbstractAddObsoleteAttributeCodeFixProvider.cs (1)
71Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (2)
65var diagnostic = context.Diagnostics.First(); 109SyntaxNode initialNode, SyntaxNode node, Diagnostic diagnostic)
src\roslyn\src\Analyzers\Core\CodeFixes\AddRequiredParentheses\AddRequiredParenthesesCodeFixProvider.cs (3)
26protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 37Document document, ImmutableArray<Diagnostic> diagnostics, 42foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (2)
393Document document, ImmutableArray<Diagnostic> diagnostics, 414foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (3)
18protected abstract Task<string> GetDescriptionAsync(Diagnostic diagnostic, SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken); 19protected abstract Task<(SyntaxTree syntaxTree, SyntaxNode root)?> GetRootInOtherSyntaxTreeAsync(SyntaxNode node, SemanticModel semanticModel, Diagnostic diagnostic, CancellationToken cancellationToken); 52SyntaxNode node, Document document, Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\ConvertTypeOfToNameOf\AbstractConvertTypeOfToNameOfCodeFixProvider.cs (2)
34Document document, ImmutableArray<Diagnostic> diagnostics, 38foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (1)
32foreach (var diagnostic in context.Diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (3)
35protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 39Document document, ImmutableArray<Diagnostic> diagnostics, 44foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (3)
51foreach (var diagnostic in context.Diagnostics) 68private async Task<Document> FixOneAsync(CodeFixContext context, Diagnostic diagnostic, CancellationToken cancellationToken) 86protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
24var diagnostic = context.Diagnostics.FirstOrDefault();
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (3)
26protected abstract bool IsCandidate(SyntaxNode node, SyntaxToken token, Diagnostic diagnostic); 37var diagnostic = context.Diagnostics.First(); 61TextSpan span, Diagnostic diagnostic)
src\roslyn\src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (2)
17protected abstract Task<CodeAction?> GetCodeFixAsync(SyntaxNode root, SyntaxNode node, Document document, Diagnostic diagnostics, CancellationToken cancellationToken); 27var diagnostic = context.Diagnostics[0];
src\roslyn\src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (2)
38ImmutableArray<Diagnostic> diagnostics, 44foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\MakeMemberStatic\AbstractMakeMemberStaticCodeFixProvider.cs (1)
28protected sealed override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor,
src\roslyn\src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (4)
20protected abstract bool IsSupportedDiagnostic(Diagnostic diagnostic, CancellationToken cancellationToken); 40var diagnostic = context.Diagnostics.First(); 108Diagnostic diagnostic, 151private SyntaxNode? GetContainingFunction(Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
32var diagnostic = context.Diagnostics.First();
src\roslyn\src\Analyzers\Core\CodeFixes\MakeTypeAbstract\AbstractMakeTypeAbstractCodeFixProvider.cs (1)
28protected sealed override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor,
src\roslyn\src\Analyzers\Core\CodeFixes\MakeTypePartial\AbstractMakeTypePartialCodeFixProvider.cs (2)
23protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 29foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (1)
40private static async Task<Solution> FixAllInDocumentAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.CustomFixAllProvider.cs (3)
51static async Task<ImmutableArray<Diagnostic>> GetSolutionDiagnosticsAsync(FixAllContext fixAllContext) 53var diagnostics = ImmutableArray.CreateBuilder<Diagnostic>(); 67ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
48var diagnostic = context.Diagnostics.First();
src\roslyn\src\Analyzers\Core\CodeFixes\NewLines\ConsecutiveStatementPlacement\ConsecutiveStatementPlacementCodeFixProvider.cs (3)
32var diagnostic = context.Diagnostics.First(); 40private static Task<Document> UpdateDocumentAsync(Document document, Diagnostic diagnostic, CancellationToken cancellationToken) 43public static async Task<Document> FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (4)
32var diagnostic = context.Diagnostics.First(); 40private static Task<Document> UpdateDocumentAsync(Document document, Diagnostic diagnostic, CancellationToken cancellationToken) 44Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 50foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\OrderModifiers\AbstractOrderModifiersCodeFixProvider.cs (2)
44Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 53foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (7)
52var diagnostic = context.Diagnostics.First(); 98Document document, Diagnostic diagnostic, 107Document document, ImmutableArray<Diagnostic> diagnostics, 117Document document, SyntaxEditor editor, ImmutableArray<Diagnostic> diagnostics, 121foreach (var diagnostic in diagnostics) 130Document document, SyntaxEditor editor, Diagnostic diagnostic, 213ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\Core\CodeFixes\QualifyMemberAccess\AbstractQualifyMemberAccessCodeFixProvider.cs (3)
21protected abstract TSimpleNameSyntax? GetNode(Diagnostic diagnostic, CancellationToken cancellationToken); 33Document document, ImmutableArray<Diagnostic> diagnostics, 38foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (3)
34var diagnostic = context.Diagnostics.First(); 53Document document, ImmutableArray<Diagnostic> diagnostics, 64foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsCodeFixProvider.cs (1)
53Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesCodeFixProvider.cs (1)
32Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs (3)
29foreach (var diagnostic in context.Diagnostics) 39protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 41foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs (3)
34foreach (var diagnostic in context.Diagnostics) 45protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 54foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnusedMembers\AbstractRemoveUnusedMembersCodeFixProvider.cs (2)
41ImmutableArray<Diagnostic> diagnostics, 51foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (17)
134var diagnostic = context.Diagnostics[0]; 203private static bool IsForEachIterationVariableDiagnostic(Diagnostic diagnostic, Document document, CancellationToken cancellationToken) 214private static string GetEquivalenceKey(Diagnostic diagnostic) 233protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 239private static IEnumerable<IGrouping<SyntaxNode, Diagnostic>> GetDiagnosticsGroupedByMember( 240ImmutableArray<Diagnostic> diagnostics, 252foreach (var diagnostic in diagnostics) 264private static IEnumerable<IGrouping<SyntaxNode, Diagnostic>> GetDiagnosticsGroupedByMember( 265ImmutableArray<Diagnostic> diagnostics, 272private static async Task<Document> PreprocessDocumentAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 284protected sealed override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 295ImmutableArray<Diagnostic> diagnostics, 346IEnumerable<Diagnostic> diagnostics, 383IOrderedEnumerable<Diagnostic> diagnostics, 399foreach (var diagnostic in diagnostics) 442IOrderedEnumerable<Diagnostic> diagnostics, 675foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\SimplifyBooleanExpression\SimplifyConditionalCodeFixProvider.cs (2)
36ImmutableArray<Diagnostic> diagnostics, 58SyntaxNode SimplifyConditional(SemanticModel semanticModel, Diagnostic diagnostic, SyntaxNode expr)
src\roslyn\src\Analyzers\Core\CodeFixes\SimplifyInterpolation\AbstractSimplifyInterpolationCodeFixProvider.cs (2)
46Document document, ImmutableArray<Diagnostic> diagnostics, 60foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\SimplifyLinqExpression\SimplifyLinqExpressionCodeFixProvider.cs (2)
34ImmutableArray<Diagnostic> diagnostics, 41foreach (var diagnostic in diagnostics.OrderByDescending(diagnostics => diagnostics.Location.SourceSpan.Start))
src\roslyn\src\Analyzers\Core\CodeFixes\UpdateLegacySuppressions\UpdateLegacySuppressionsCodeFixProvider.cs (3)
30foreach (var diagnostic in context.Diagnostics) 40protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 42foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (1)
21public abstract string SuggestedVersion(ImmutableArray<Diagnostic> diagnostics);
src\roslyn\src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (4)
87foreach (var diagnostic in context.Diagnostics) 103Solution originalSolution, Solution currentSolution, Diagnostic diagnostic, CancellationToken cancellationToken) 116Solution originalSolution, Solution currentSolution, Diagnostic diagnostic, CancellationToken cancellationToken) 392Diagnostic diagnostic,
src\roslyn\src\Analyzers\Core\CodeFixes\UseAutoProperty\UseAutoPropertyFixAllProvider.cs (1)
103foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullStatementCheckCodeFixProvider.cs (2)
33Document document, ImmutableArray<Diagnostic> diagnostics, 40foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixProvider.cs (3)
27protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 36Document document, ImmutableArray<Diagnostic> diagnostics, 47foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (4)
28protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 37Document document, ImmutableArray<Diagnostic> diagnostics, 45foreach (var diagnostic in diagnostics) 58Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\UseCollectionExpression\AbstractUseCollectionExpressionCodeFixProvider.cs (1)
27protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\UseCompoundAssignment\AbstractUseCompoundAssignmentCodeFixProvider.cs (2)
50Document document, ImmutableArray<Diagnostic> diagnostics, 56foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (3)
43Document document, Diagnostic diagnostic, 47Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, 59foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForAssignment\AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
58Diagnostic diagnostic,
src\roslyn\src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForReturn\AbstractUseConditionalExpressionForReturnCodeFixProvider.cs (1)
45Diagnostic diagnostic,
src\roslyn\src\Analyzers\Core\CodeFixes\UseExplicitTupleName\UseExplicitTupleNameCodeFixProvider.cs (2)
32Document document, ImmutableArray<Diagnostic> diagnostics, 37foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UseInferredMemberName\AbstractUseInferredMemberNameCodeFixProvider.cs (2)
27Document document, ImmutableArray<Diagnostic> diagnostics, 32foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (4)
31private static bool IsSupportedDiagnostic(Diagnostic diagnostic) 36var diagnostic = context.Diagnostics.First(); 46Document document, ImmutableArray<Diagnostic> diagnostics, 54foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\roslyn\src\Analyzers\Core\CodeFixes\UseNullPropagation\AbstractUseNullPropagationCodeFixProvider.cs (1)
67var firstDiagnostic = context.Diagnostics.First();
src\roslyn\src\Analyzers\Core\CodeFixes\UseSystemHashCode\UseSystemHashCodeCodeFixProvider.cs (2)
34Document document, ImmutableArray<Diagnostic> diagnostics, 52foreach (var diagnostic in diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\CodeFixContextExtensions.cs (2)
16internal static void RegisterFixes(this CodeFixContext context, IEnumerable<CodeAction> actions, Diagnostic diagnostic) 27internal static void RegisterFixes(this CodeFixContext context, IEnumerable<CodeAction> actions, ImmutableArray<Diagnostic> diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (9)
22public static async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync( 27var allDiagnostics = ImmutableArray<Diagnostic>.Empty; 41return ImmutableDictionary<Document, ImmutableArray<Diagnostic>>.Empty.SetItem(document, documentDiagnostics); 80allDiagnostics = await ProducerConsumer<ImmutableArray<Diagnostic>>.RunParallelAsync( 90using var _2 = ArrayBuilder<Diagnostic>.GetInstance(out var builder); 106return ImmutableDictionary<Document, ImmutableArray<Diagnostic>>.Empty; 132private static async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync( 134ImmutableArray<Diagnostic> diagnostics, 137var builder = ImmutableDictionary.CreateBuilder<Document, ImmutableArray<Diagnostic>>();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (7)
33/// cref="Diagnostic.Properties"/> for that diagnostic. The diagnostic itself is not passed along as it was 34/// computed with respect to the original user document, and as such its <see cref="Diagnostic.Location"/> and <see 35/// cref="Diagnostic.AdditionalLocations"/> will not be correct. 44protected sealed override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 56ImmutableArray<Diagnostic> diagnostics, 62using var _ = ArrayBuilder<(TDiagnosticNode diagnosticNode, Diagnostic diagnostic)>.GetInstance(out var originalNodes); 63foreach (var diagnostic in diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\MultiProjectSafeFixAllProvider.cs (1)
110static IEnumerable<TextSpan> GetDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (9)
57protected void RegisterCodeFix(CodeFixContext context, string title, string equivalenceKey, Diagnostic? diagnostic = null) 60protected void RegisterCodeFix(CodeFixContext context, string title, string equivalenceKey, CodeActionPriority priority, Diagnostic? diagnostic = null) 63protected Func<CancellationToken, Task<Document>> GetDocumentUpdater(CodeFixContext context, Diagnostic? diagnostic = null) 70Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 98Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken); 105/// <para/> This overload differs from <see cref="IncludeDiagnosticDuringFixAll(Diagnostic)"/> in that it also 111protected virtual bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 122/// cref="IncludeDiagnosticDuringFixAll(Diagnostic, Document, string, CancellationToken)"/> should be overridden 127protected virtual bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
184public static async Task<ImmutableArray<Diagnostic>> GetErrorsAsync(this Document document, CancellationToken cancellationToken, IList<string>? ignoreErrorCode = null)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
32public static string? TryGetAnalyzerConfigPathForDiagnosticConfiguration(this Project project, Diagnostic diagnostic) 38private static string? TryGetAnalyzerConfigPathForProjectOrDiagnosticConfiguration(Project project, Diagnostic? diagnostic)
Microsoft.CodeAnalysis.CSharp (169)
Binder\Binder_Crefs.cs (1)
1206foreach (Diagnostic diag in unusedDiagnostics.AsEnumerable())
Binder\Binder_Expressions.cs (1)
6697foreach (var diagnostic in bag.AsEnumerableWithoutResolution())
Binder\Binder_InterpolatedString.cs (1)
833foreach (var diagnostic in bag.AsEnumerableWithoutResolution())
Binder\Binder_Operators.cs (1)
1095foreach (var diagnostic in sourceBag.AsEnumerableWithoutResolution())
Binder\ForEachLoopBinder.cs (1)
523foreach (var d in createConversionDiagnostics.DiagnosticBag.AsEnumerableWithoutResolution())
Binder\SwitchBinder.cs (1)
25private ImmutableArray<Diagnostic> _switchGoverningDiagnostics;
BoundTree\UnboundLambda.cs (9)
1383FirstAmongEqualsSet<Diagnostic>? intersection = null; 1405FirstAmongEqualsSet<Diagnostic>? union = null; 1431private static bool PreventsSuccessfulDelegateConversion(FirstAmongEqualsSet<Diagnostic> set) 1433foreach (var diagnostic in set) 1443private static FirstAmongEqualsSet<Diagnostic> CreateFirstAmongEqualsSet(ImmutableArray<Diagnostic> bag) 1449return new FirstAmongEqualsSet<Diagnostic>( 1461private static int CanonicallyCompareDiagnostics(Diagnostic x, Diagnostic y)
CommandLine\CSharpCommandLineParser.cs (26)
56List<Diagnostic> diagnostics = new List<Diagnostic>(); 124int warningLevel = Diagnostic.DefaultWarningLevel; 370IEnumerable<Diagnostic> defineDiagnostics; 1632private static void ParseAndResolveReferencePaths(string? switchName, ReadOnlyMemory<char>? switchValue, string? baseDirectory, List<string> builder, MessageID origin, List<Diagnostic> diagnostics) 1659private static string? GetWin32Setting(string arg, string? value, List<Diagnostic> diagnostics) 1682List<Diagnostic> diagnostics, 1781public static IEnumerable<string> ParseConditionalCompilationSymbols(string value, out IEnumerable<Diagnostic> diagnostics) 1788internal static void ParseConditionalCompilationSymbols(ReadOnlyMemory<char> valueMemory, ArrayBuilder<string> defines, out IEnumerable<Diagnostic> diagnostics) 1794outputDiagnostics.Add(Diagnostic.Create(CSharp.MessageProvider.Instance, (int)ErrorCode.WRN_DefineIdentifierRequired, valueMemory.ToString())); 1826outputDiagnostics.Add(Diagnostic.Create(CSharp.MessageProvider.Instance, (int)ErrorCode.WRN_DefineIdentifierRequired, id)); 1833private static Platform ParsePlatform(string value, IList<Diagnostic> diagnostics) 1859private static OutputKind ParseTarget(string value, IList<Diagnostic> diagnostics) 1887private static IEnumerable<string> ParseUsings(string arg, string? value, IList<Diagnostic> diagnostics) 1901private static void ParseAnalyzers(string arg, ReadOnlyMemory<char>? valueMemory, List<CommandLineAnalyzerReference> analyzerReferences, List<Diagnostic> diagnostics) 1928private static void ParseAssemblyReferences(string arg, ReadOnlyMemory<char>? valueMemory, IList<Diagnostic> diagnostics, bool embedInteropTypes, List<CommandLineReference> commandLineReferences) 2012private static void ValidateWin32Settings(string? win32ResourceFile, string? win32IconResourceFile, string? win32ManifestFile, OutputKind outputKind, IList<Diagnostic> diagnostics) 2033private static IEnumerable<InstrumentationKind> ParseInstrumentationKinds(string value, IList<Diagnostic> diagnostics) 2055IList<Diagnostic> diagnostics, 2161private static void UnimplementedSwitch(IList<Diagnostic> diagnostics, string switchName) 2166internal override void GenerateErrorForNoFilesFoundInRecurse(string path, IList<Diagnostic> diagnostics) 2171private static void AddDiagnostic(IList<Diagnostic> diagnostics, ErrorCode errorCode) 2173diagnostics.Add(Diagnostic.Create(CSharp.MessageProvider.Instance, (int)errorCode)); 2176private static void AddDiagnostic(IList<Diagnostic> diagnostics, ErrorCode errorCode, params object[] arguments) 2178diagnostics.Add(Diagnostic.Create(CSharp.MessageProvider.Instance, (int)errorCode, arguments)); 2184private static void AddDiagnostic(IList<Diagnostic> diagnostics, Dictionary<string, ReportDiagnostic> warningOptions, ErrorCode errorCode, params object[] arguments)
CommandLine\CSharpCompiler.cs (2)
381private protected override void DiagnoseBadAccesses(TextWriter consoleOutput, ErrorLogger? errorLogger, Compilation compilation, ImmutableArray<Diagnostic> diagnostics) 384foreach (var diag in diagnostics)
Compilation\CSharpCompilation.cs (24)
75private ImmutableArray<Diagnostic> _lazyClsComplianceDiagnostics; 2173foreach (var diagnostic in noMainFoundDiagnostics.DiagnosticBag.AsEnumerable()) 2988public override ImmutableArray<Diagnostic> GetParseDiagnostics(CancellationToken cancellationToken = default) 2997public override ImmutableArray<Diagnostic> GetDeclarationDiagnostics(CancellationToken cancellationToken = default) 3005public override ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(CancellationToken cancellationToken = default) 3014public override ImmutableArray<Diagnostic> GetDiagnostics(CancellationToken cancellationToken = default) 3019internal ImmutableArray<Diagnostic> GetDiagnostics(CompilationStage stage, bool includeEarlierStages, Predicate<ISymbolInternal>? symbolFilter, CancellationToken cancellationToken) 3081foreach (var error in syntaxTree.Options.Errors) 3135private static void AppendLoadDirectiveDiagnostics(DiagnosticBag builder, SyntaxAndDeclarationManager syntaxAndDeclarations, SyntaxTree syntaxTree, Func<IEnumerable<Diagnostic>, IEnumerable<Diagnostic>>? locationFilterOpt = null) 3143IEnumerable<Diagnostic> diagnostics = directive.Diagnostics; 3201public ImmutableArray<Diagnostic> Diagnostics { get; } 3203public MethodBodyDiagnostics(SyntaxTree tree, TextSpan? span, ImmutableArray<Diagnostic> diagnostics) 3211private ImmutableArray<Diagnostic> GetDiagnosticsForMethodBodiesInTree(SyntaxTree tree, TextSpan? span, CancellationToken cancellationToken) 3308void updateCachedDiagnostics(ImmutableArray<Diagnostic> diagnostics, SyntaxTree tree, TextSpan? span) 3395private ReadOnlyBindingDiagnostic<AssemblySymbol> GetSourceDeclarationDiagnostics(SyntaxTree? syntaxTree = null, TextSpan? filterSpanWithinTree = null, Func<IEnumerable<Diagnostic>, SyntaxTree, TextSpan?, IEnumerable<Diagnostic>>? locationFilterOpt = null, Predicate<Symbol>? symbolFilter = null, CancellationToken cancellationToken = default) 3422var result = _lazyDeclarationDiagnostics?.AsEnumerable() ?? Enumerable.Empty<Diagnostic>(); 3467private static IEnumerable<Diagnostic> FilterDiagnosticsByLocation(IEnumerable<Diagnostic> diagnostics, SyntaxTree tree, TextSpan? filterSpanWithinTree) 3469foreach (var diagnostic in diagnostics) 3478internal ImmutableArray<Diagnostic> GetDiagnosticsForSyntaxTree( 3516IEnumerable<Diagnostic> methodBodyDiagnostics = GetDiagnosticsForMethodBodiesInTree(syntaxTree, filterSpanWithinTree, cancellationToken); 3530return result.ToReadOnlyAndFree<Diagnostic>();
Compilation\CSharpDiagnosticFilter.cs (5)
16/// Applies C#-specific modification and filtering of <see cref="Diagnostic"/>s. 25/// Modifies an input <see cref="Diagnostic"/> per the given options. For example, the 26/// severity may be escalated, or the <see cref="Diagnostic"/> may be filtered out entirely 35internal static Diagnostic? Filter( 36Diagnostic d,
Compilation\MemberSemanticModel.cs (4)
572public sealed override ImmutableArray<Diagnostic> GetSyntaxDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 577public sealed override ImmutableArray<Diagnostic> GetDeclarationDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 582public sealed override ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 587public sealed override ImmutableArray<Diagnostic> GetDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SpeculativeSemanticModelWithMemberModel.cs (4)
235public override ImmutableArray<Diagnostic> GetSyntaxDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 240public override ImmutableArray<Diagnostic> GetDeclarationDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 245public override ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 250public override ImmutableArray<Diagnostic> GetDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken))
Compilation\SyntaxTreeSemanticModel.cs (4)
114public override ImmutableArray<Diagnostic> GetSyntaxDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 121public override ImmutableArray<Diagnostic> GetDeclarationDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 128public override ImmutableArray<Diagnostic> GetMethodBodyDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken)) 135public override ImmutableArray<Diagnostic> GetDiagnostics(TextSpan? span = null, CancellationToken cancellationToken = default(CancellationToken))
Compiler\DocumentationCommentCompiler.cs (1)
887foreach (Diagnostic diag in node.GetDiagnostics())
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (2)
640foreach (Diagnostic diagnostic in CSharpSyntaxTree.Dummy.GetDiagnostics(treelessSyntax)) 656foreach (Diagnostic diagnostic in bindingDiagnostics.DiagnosticBag.AsEnumerable())
Compiler\MethodCompiler.cs (1)
948sourceMethod.SetDiagnostics(ImmutableArray<Diagnostic>.Empty, out diagsWritten);
CSharpCompilationOptions.cs (14)
73int warningLevel = Diagnostic.DefaultWarningLevel, 692internal override void ValidateOptions(ArrayBuilder<Diagnostic> builder) 701builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_NoMainOnDLL)); 706builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValue, nameof(MainTypeName), MainTypeName)); 712builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadPlatformType, Platform.ToString())); 722builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValue, nameof(OutputKind), OutputKind.ToString())); 727builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValue, nameof(OptimizationLevel), OptimizationLevel.ToString())); 732builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValue, nameof(ScriptClassName), ScriptClassName ?? "null")); 737builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValue, nameof(WarningLevel), WarningLevel)); 742builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValue, nameof(Usings), Usings.Where(u => !u.IsValidClrNamespaceName()).First() ?? "null")); 747builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadPrefer32OnLib)); 752builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValue, nameof(MetadataImportOptions), MetadataImportOptions.ToString())); 795internal override Diagnostic? FilterDiagnostic(Diagnostic diagnostic, CancellationToken cancellationToken)
CSharpParseOptions.cs (4)
247internal override void ValidateOptions(ArrayBuilder<Diagnostic> builder) 254builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadLanguageVersion, LanguageVersion.ToString())); 263builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_InvalidPreprocessingSymbol, "null")); 267builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_InvalidPreprocessingSymbol, symbol));
Declarations\DeclarationTreeBuilder.cs (6)
192var diagnostics = ImmutableArray<Diagnostic>.Empty; 230diagnostics: ImmutableArray<Diagnostic>.Empty, 234private static SingleNamespaceOrTypeDeclaration CreateSimpleProgram(GlobalStatementSyntax firstGlobalStatement, bool hasAwaitExpressions, bool isIterator, bool hasReturnWithExpression, ImmutableArray<Diagnostic> diagnostics) 345diagnostics: ImmutableArray<Diagnostic>.Empty, 357diagnostics: ImmutableArray<Diagnostic>.Empty); 518diagnostics: ImmutableArray<Diagnostic>.Empty);
Declarations\RootSingleNamespaceDeclaration.cs (1)
35ImmutableArray<Diagnostic> diagnostics,
Declarations\SingleNamespaceDeclaration.cs (2)
20ImmutableArray<Diagnostic> diagnostics) 70ImmutableArray<Diagnostic> diagnostics)
Declarations\SingleNamespaceDeclarationEx.cs (1)
20ImmutableArray<Diagnostic> diagnostics)
Declarations\SingleNamespaceOrTypeDeclaration.cs (2)
21public readonly ImmutableArray<Diagnostic> Diagnostics; 27ImmutableArray<Diagnostic> diagnostics)
Declarations\SingleTypeDeclaration.cs (1)
87ImmutableArray<Diagnostic> diagnostics,
Errors\CSDiagnostic.cs (3)
26internal override Diagnostic WithLocation(Location location) 41internal override Diagnostic WithSeverity(DiagnosticSeverity severity) 52internal override Diagnostic WithIsSuppressed(bool isSuppressed)
Errors\CSharpDiagnosticFormatter.cs (1)
15internal override bool HasDefaultHelpLinkUri(Diagnostic diagnostic)
Errors\ErrorFacts.cs (5)
178return Diagnostic.CompilerDiagnosticCategory; 206return Diagnostic.InfoAndHiddenWarningLevel; 2650foreach (Diagnostic diag in diagnostics.AsEnumerable()) // Checking the code would have resolved them anyway. 2661internal static bool PreventsSuccessfulDelegateConversion(ImmutableArray<Diagnostic> diagnostics) 2663foreach (var diag in diagnostics)
Errors\MessageProvider.cs (2)
87public override Diagnostic CreateDiagnostic(int code, Location location, params object[] args) 93public override Diagnostic CreateDiagnostic(DiagnosticInfo info)
Errors\SameDiagnosticComparer.cs (4)
10internal sealed class SameDiagnosticComparer : EqualityComparer<Diagnostic> 13public override bool Equals(Diagnostic? x, Diagnostic? y) => x is null ? y is null : x.Equals(y); 14public override int GetHashCode(Diagnostic obj) => obj.GetHashCode();
FlowAnalysis\DefiniteAssignment.cs (3)
544HashSet<Diagnostic> compatDiagnosticSet = new HashSet<Diagnostic>(compatDiagnostics.AsEnumerable(), SameDiagnosticComparer.Instance); 546foreach (var diagnostic in strictDiagnostics.AsEnumerable())
FlowAnalysis\FlowAnalysisPass.cs (2)
90IEnumerable<Diagnostic> getErrorsOnly(IEnumerable<Diagnostic> diags) => diags.Where(d => d.Severity == DiagnosticSeverity.Error);
Lowering\SyntheticBoundNodeFactory.cs (2)
36public MissingPredefinedMember(Diagnostic error) : base(error.ToString()) 46public Diagnostic Diagnostic { get; }
Symbols\Source\SourceAssemblySymbol.cs (2)
114private ImmutableArray<Diagnostic> _unusedFieldWarnings; 2686internal ImmutableArray<Diagnostic> GetUnusedFieldWarnings(CancellationToken cancellationToken)
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (2)
168Diagnostic diag = new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.ERR_DuplicateExplicitImpl, interfaceMember), this.GetFirstLocation()); 1867foreach (Diagnostic diagnostic in implementingMemberAndDiagnostics.Diagnostics.Diagnostics)
Symbols\Source\SourceMemberMethodSymbol.cs (4)
319private ImmutableArray<Diagnostic> _cachedDiagnostics; 320internal ImmutableArray<Diagnostic> Diagnostics 325internal ImmutableArray<Diagnostic> SetDiagnostics(ImmutableArray<Diagnostic> newSet, out bool diagsWritten)
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (4)
1112public static readonly ExternAliasesAndDiagnostics Empty = new ExternAliasesAndDiagnostics() { ExternAliases = ImmutableArray<AliasAndExternAliasDirective>.Empty, Diagnostics = ImmutableArray<Diagnostic>.Empty }; 1115public ImmutableArray<Diagnostic> Diagnostics { get; init; } 1150Diagnostics = ImmutableArray<Diagnostic>.Empty, 1156public ImmutableArray<Diagnostic> Diagnostics { get; init; }
Symbols\Symbol_Attributes.cs (3)
491var toRemove = new HashSet<Diagnostic>(ReferenceEqualityComparer.Instance); 494foreach (Diagnostic d in diagnostics.DiagnosticBag.AsEnumerableWithoutResolution()) 519foreach (Diagnostic d in diagnostics.DiagnosticBag.AsEnumerableWithoutResolution())
Symbols\Synthesized\SynthesizedBackingFieldSymbol.cs (2)
213var notAnnotatedDiagnosticsSet = new HashSet<Diagnostic>(notAnnotatedDiagnostics.AsEnumerable(), SameDiagnosticComparer.Instance); 216foreach (var diagnostic in annotatedDiagnostics.AsEnumerable())
Syntax\CSharpSyntaxNode.cs (1)
213public new IEnumerable<Diagnostic> GetDiagnostics()
Syntax\CSharpSyntaxTree.cs (7)
775public override IEnumerable<Diagnostic> GetDiagnostics(SyntaxNode node) 785private IEnumerable<Diagnostic> GetDiagnostics(GreenNode greenNode, int position) 797return SpecializedCollections.EmptyEnumerable<Diagnostic>(); 807public override IEnumerable<Diagnostic> GetDiagnostics(SyntaxToken token) 823public override IEnumerable<Diagnostic> GetDiagnostics(SyntaxTrivia trivia) 840public override IEnumerable<Diagnostic> GetDiagnostics(SyntaxNodeOrToken nodeOrToken) 856public override IEnumerable<Diagnostic> GetDiagnostics(CancellationToken cancellationToken = default)
Syntax\SyntaxFactory.cs (2)
2385foreach (var error in compilation.EndOfFileToken.GetDiagnostics()) 2441foreach (var error in token.GetDiagnostics())
Syntax\SyntaxTreeDiagnosticEnumerator.cs (1)
20public static IEnumerable<Diagnostic> EnumerateDiagnostics(SyntaxTree syntaxTree, GreenNode root, int position)
Microsoft.CodeAnalysis.CSharp.CodeStyle (33)
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (2)
35var diagnostic = AnalyzeNamespace(context, namespaceDeclaration); 40private Diagnostic? AnalyzeNamespace(SyntaxNodeAnalysisContext context, FileScopedNamespaceDeclarationSyntax declaration)
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (2)
39var diagnostic = AnalyzeNamespace(context, root, namespaceDeclaration); 44private Diagnostic? AnalyzeNamespace(SyntaxNodeAnalysisContext context, CompilationUnitSyntax root, BaseNamespaceDeclarationSyntax declaration)
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeAnonymousFunctionStatic\MakeAnonymousFunctionStaticDiagnosticAnalyzer.cs (1)
52Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (2)
112var diagnostic = Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (3)
44var methodToDiagnostic = PooledDictionary<IMethodSymbol, Diagnostic>.GetInstance(); 100SymbolAnalysisContext context, ReportDiagnostic severity, PooledDictionary<IMethodSymbol, Diagnostic> methodToDiagnostic) 133Dictionary<IMethodSymbol, Diagnostic> methodToDiagnostic)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryAsyncModifier\CSharpMakeMethodSynchronousDiagnosticAnalyzer.cs (1)
128context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
95context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (1)
101context.ReportDiagnostic(Diagnostic.Create(Descriptor, directive.GetLocation()));
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (5)
81private ImmutableArray<Diagnostic> AnalyzeSemanticModel(SemanticModelAnalysisContext context, int positionOfFirstReducingNullableDirective, TextSpanMutableIntervalTree? codeBlockIntervalTree, TextSpanMutableIntervalTree? possibleNullableImpactIntervalTree) 95using var diagnostics = TemporaryArray<Diagnostic>.Empty; 121diagnostics.Add(Diagnostic.Create(Descriptor, currentOptionsDirective.GetLocation())); 153diagnostics.Add(Diagnostic.Create(Descriptor, currentOptionsDirective.GetLocation())); 310foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryNullableWarningSuppressionsDiagnosticAnalyzer.cs (1)
37context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\UnnecessaryNullableWarningSuppressionsUtilities.cs (3)
21private static bool ContainsErrorOrWarning(IEnumerable<Diagnostic> diagnostics) 166Func<SyntaxNode, ImmutableArray<Diagnostic>> computeDiagnostics) 179IEnumerable<Diagnostic> updatedDiagnostics)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryUnsafeModifier\CSharpRemoveUnnecessaryUnsafeModifierDiagnosticAnalyzer.cs (1)
44context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryUnsafeModifier\UnnecessaryUnsafeModifierUtilities.cs (1)
22private static bool ContainsError(IEnumerable<Diagnostic> diagnostics)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
59foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (1)
217context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\UseExpressionBodyDiagnosticAnalyzer.cs (2)
79var diagnostic = AnalyzeSyntax(options, context.Node, context, helper, cancellationToken); 89private Diagnostic? AnalyzeSyntax(
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (2)
63var diagnostic = AnalyzeSyntax(context.SemanticModel, option, declaration, context.Options, context.CancellationToken); 70private static Diagnostic? AnalyzeSyntax(
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
310private Diagnostic CreateDiagnostic(Result result, NotificationOption2 notificationOption, AnalyzerOptions analyzerOptions)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (1)
38public static bool IsSafe(Diagnostic diagnostic)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Helpers\RemoveUnnecessaryImports\CSharpUnnecessaryImportsProvider.cs (1)
33foreach (var diagnostic in diagnostics)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (187)
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddBraces\CSharpAddBracesCodeFixProvider.cs (2)
31Document document, ImmutableArray<Diagnostic> diagnostics, 35foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (3)
43foreach (var diagnostic in context.Diagnostics) 67protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 73foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (2)
95Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 134Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
36var diagnostic = context.Diagnostics.First();
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceCodeFixProvider.cs (3)
33var diagnostic = context.Diagnostics.First(); 47Document document, ImmutableArray<Diagnostic> diagnostics, 50var diagnostic = diagnostics.First();
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (2)
41Document document, ImmutableArray<Diagnostic> diagnostics, 45foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (2)
33Diagnostic diagnostic, 48Diagnostic diagnostic,
src\roslyn\src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (4)
40var diagnostic = context.Diagnostics.First(); 51SemanticModel semanticModel, Diagnostic diagnostic, CancellationToken cancellationToken, 133Document document, ImmutableArray<Diagnostic> diagnostics, 139foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (4)
31Diagnostic diagnostic, 67var diagnostic = context.Diagnostics.First(); 75Document document, ImmutableArray<Diagnostic> diagnostics, 81foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (2)
62Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 126protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateConstructor\GenerateConstructorCodeFixProvider.cs (1)
47protected override bool IsCandidate(SyntaxNode node, SyntaxToken token, Diagnostic diagnostic)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateEnumMember\GenerateEnumMemberCodeFixProvider.cs (1)
37protected override bool IsCandidate(SyntaxNode node, SyntaxToken token, Diagnostic diagnostic)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateConversionCodeFixProvider.cs (1)
34protected override bool IsCandidate(SyntaxNode node, SyntaxToken token, Diagnostic diagnostic)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateMethodCodeFixProvider.cs (1)
53protected override bool IsCandidate(SyntaxNode node, SyntaxToken token, Diagnostic diagnostic)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateVariable\CSharpGenerateVariableCodeFixProvider.cs (1)
36protected override bool IsCandidate(SyntaxNode node, SyntaxToken token, Diagnostic diagnostic)
src\roslyn\src\Analyzers\CSharp\CodeFixes\HiddenExplicitCast\CSharpHiddenExplicitCastCodeFixProvider.cs (2)
37ImmutableArray<Diagnostic> diagnostics, 41foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\roslyn\src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (3)
32private static SyntaxNode? GetOriginalNode(SyntaxNode root, Diagnostic diagnostic) 59Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 64foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (3)
45Document document, ImmutableArray<Diagnostic> diagnostics, 53foreach (var diagnostic in diagnostics) 79Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (6)
35protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 44Document document, ImmutableArray<Diagnostic> diagnostics, 47foreach (var diagnostic in diagnostics) 55SyntaxEditor editor, Diagnostic diagnostic, CancellationToken cancellationToken) 70Diagnostic diagnostic, 111SyntaxEditor editor, Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
45protected override async Task<CodeAction?> GetCodeFixAsync(SyntaxNode root, SyntaxNode node, Document document, Diagnostic diagnostics, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (1)
36protected override async Task<CodeAction?> GetCodeFixAsync(SyntaxNode root, SyntaxNode node, Document document, Diagnostic diagnostics, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeAnonymousFunctionStatic\CSharpMakeAnonymousFunctionStaticCodeFixProvider.cs (2)
36protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 40foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixProvider.cs (1)
31Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (3)
33var diagnostic = context.Diagnostics.First(); 50protected override Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 62ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (2)
109protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 116foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
40protected override bool IsSupportedDiagnostic(Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (3)
34var diagnostic = context.Diagnostics.First(); 48Document document, ImmutableArray<Diagnostic> diagnostics, 51foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableCodeFixProvider.cs (2)
35ImmutableArray<Diagnostic> diagnostics, 39foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (1)
36ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStructReadOnly\CSharpMakeStructReadOnlyCodeFixProvider.cs (1)
34ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
74foreach (var diagnostic in context.Diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (3)
33var diagnostic = context.Diagnostics.First(); 43Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 49foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (3)
33var diagnostic = context.Diagnostics.First(); 43Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 49foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (5)
34var diagnostic = context.Diagnostics.First(); 43private static Task<Document> UpdateDocumentAsync(Document document, Diagnostic diagnostic, CancellationToken cancellationToken) 46public static async Task<Document> FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 52foreach (var diagnostic in diagnostics) 63Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (3)
33var diagnostic = context.Diagnostics.First(); 43Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 49foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (4)
36var diagnostic = context.Diagnostics.First(); 45public static async Task<Document> FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 54foreach (var diagnostic in diagnostics) 62Diagnostic diagnostic,
src\roslyn\src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (3)
75ImmutableArray<Diagnostic> diagnostics, 84foreach (var diagnostic in diagnostics) 92protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\QualifyMemberAccess\CSharpQualifyMemberAccessCodeFixProvider.cs (1)
21protected override SimpleNameSyntax? GetNode(Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (2)
55Document document, ImmutableArray<Diagnostic> diagnostics, 64foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (1)
37var diagnostic = context.Diagnostics.First();
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (1)
35var diagnostic = context.Diagnostics.First();
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnneccessaryUnsafeModifier\CSharpRemoveUnnecessaryUnsafeModifierCodeFixProvider.cs (1)
39private static async Task<Document> FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastCodeFixProvider.cs (1)
37Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs (2)
34Document document, ImmutableArray<Diagnostic> diagnostics, 39foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs (2)
40Document document, ImmutableArray<Diagnostic> diagnostics, 43foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveCodeFixProvider.cs (2)
36foreach (var diagnostic in context.Diagnostics) 47ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryNullableWarningSuppressionsCodeFixProvider.cs (1)
40private static async Task<Document> FixSingleDocumentAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnreachableCode\CSharpRemoveUnreachableCodeCodeFixProvider.cs (5)
29var diagnostic = context.Diagnostics[0]; 42protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 45private static bool IsSubsequentSection(Diagnostic diagnostic) 50ImmutableArray<Diagnostic> diagnostics, 54foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnusedLocalFunction\CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs (1)
36protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastCodeFixProvider.cs (2)
37ImmutableArray<Diagnostic> diagnostics, 43foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorCodeFixProvider.cs (2)
36protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 40foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternCodeFixProvider.cs (1)
38Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (4)
30Diagnostic diagnostic, CancellationToken cancellationToken, [NotNullWhen(true)] out RecordDeclarationSyntax? recordDeclaration) 85var diagnostic = context.Diagnostics.First(); 94Document document, ImmutableArray<Diagnostic> diagnostics, 97foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UpgradeProject\CSharpUpgradeProjectCodeFixProvider.cs (3)
65public override string SuggestedVersion(ImmutableArray<Diagnostic> diagnostics) 68private static LanguageVersion RequiredVersion(ImmutableArray<Diagnostic> diagnostics) 71foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (2)
40Document document, ImmutableArray<Diagnostic> diagnostics, 48foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
37Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseDefaultLiteral\CSharpUseDefaultLiteralCodeFixProvider.cs (1)
34Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (3)
97var diagnostic = context.Diagnostics.First(); 115protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 122foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExpressionBody\UseExpressionBodyCodeFixProvider.cs (5)
35protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 41var diagnostic = context.Diagnostics.First(); 53Document document, ImmutableArray<Diagnostic> diagnostics, 59foreach (var diagnostic in diagnostics) 75SemanticModel semanticModel, SyntaxEditor editor, Diagnostic diagnostic,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeFixProvider.cs (1)
28var diagnostic = context.Diagnostics[0];
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitlyTypedLambdaExpression\CSharpUseImplicitObjectCreationCodeFixProvider.cs (1)
39Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationCodeFixProvider.cs (2)
37protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 46Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (3)
45protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 49Document document, ImmutableArray<Diagnostic> diagnostics, 54foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseImplicitTypeCodeFixProvider.cs (3)
36protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 40Document document, ImmutableArray<Diagnostic> diagnostics, 45foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseIndexOperatorCodeFixProvider.cs (2)
35Document document, ImmutableArray<Diagnostic> diagnostics, 39foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (2)
45Document document, ImmutableArray<Diagnostic> diagnostics, 80private static InvocationExpressionSyntax GetInvocationExpression(Diagnostic d, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseInterpolatedVerbatimString\CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs (3)
35Document document, ImmutableArray<Diagnostic> diagnostics, 38foreach (var diagnostic in diagnostics) 47Diagnostic diagnostic,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (4)
33private static bool IsSupportedDiagnostic(Diagnostic diagnostic) 38var diagnostic = context.Diagnostics.First(); 49Document document, ImmutableArray<Diagnostic> diagnostics, 52foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs (2)
37Document document, ImmutableArray<Diagnostic> diagnostics, 40foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (3)
44protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 53Document document, ImmutableArray<Diagnostic> diagnostics, 65foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseNameofInAttribute\CSharpUseNameofInAttributeCodeFixProvider.cs (2)
36ImmutableArray<Diagnostic> diagnostics, 40foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (4)
52Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 60var diagnostic = context.Diagnostics.First(); 71Document document, ImmutableArray<Diagnostic> diagnostics, 75foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (3)
39Document document, ImmutableArray<Diagnostic> diagnostics, 42foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start)) 46private static void FixOne(SyntaxEditor editor, Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (3)
39Document document, ImmutableArray<Diagnostic> diagnostics, 50foreach (var diagnostic in diagnostics) 84Diagnostic diagnostic,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (3)
36Document document, ImmutableArray<Diagnostic> diagnostics, 39foreach (var diagnostic in diagnostics) 48Diagnostic diagnostic,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpUseNotPatternCodeFixProvider.cs (3)
34Document document, ImmutableArray<Diagnostic> diagnostics, 38foreach (var diagnostic in diagnostics) 48Diagnostic diagnostic,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
61foreach (var diagnostic in context.Diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (1)
43Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (1)
45foreach (var diagnostic in context.Diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseThrowExpression\UseThrowExpressionCodeFixProvider.cs (3)
30protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 39Document document, ImmutableArray<Diagnostic> diagnostics, 45foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseTupleSwap\CSharpUseTupleSwapCodeFixProvider.cs (3)
36Document document, ImmutableArray<Diagnostic> diagnostics, 39foreach (var diagnostic in diagnostics) 44SyntaxEditor editor, Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (3)
39Document document, ImmutableArray<Diagnostic> diagnostics, 42foreach (var diagnostic in diagnostics) 47SyntaxEditor editor, Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (3)
42Document document, ImmutableArray<Diagnostic> diagnostics, 51foreach (var diagnostic in diagnostics) 90private static IArrayCreationOperation GetArrayCreationOperation(SemanticModel semanticModel, Diagnostic diagnostic, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.CSharp.Features (251)
CodeFixes\GenerateType\GenerateTypeCodeFixProvider.cs (1)
40protected override bool IsCandidate(SyntaxNode node, SyntaxToken token, Diagnostic diagnostic)
CodeFixes\Suppression\CSharpSuppressionCodeFixProvider.cs (7)
37protected override SyntaxTriviaList CreatePragmaRestoreDirectiveTrivia(Diagnostic diagnostic, Func<SyntaxNode, CancellationToken, SyntaxNode> formatNode, bool needsLeadingEndOfLine, bool needsTrailingEndOfLine, CancellationToken cancellationToken) 44Diagnostic diagnostic, Func<SyntaxNode, CancellationToken, SyntaxNode> formatNode, bool needsLeadingEndOfLine, bool needsTrailingEndOfLine, CancellationToken cancellationToken) 51SyntaxToken disableOrRestoreKeyword, Diagnostic diagnostic, Func<SyntaxNode, CancellationToken, SyntaxNode> formatNode, bool needsLeadingEndOfLine, bool needsTrailingEndOfLine, CancellationToken cancellationToken) 103Diagnostic diagnostic, 130SyntaxNode targetNode, ISymbol targetSymbol, INamedTypeSymbol suppressMessageAttribute, Diagnostic diagnostic) 154Diagnostic diagnostic, 177private static AttributeArgumentListSyntax CreateAttributeArguments(ISymbol targetSymbol, Diagnostic diagnostic, bool isAssemblyAttribute)
ConvertProgram\ConvertToProgramMainCodeFixProvider.cs (1)
46Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
ConvertProgram\ConvertToTopLevelStatementsCodeFixProvider.cs (1)
45Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
Copilot\CSharpCopilotCodeFixProvider.cs (2)
77foreach (var diagnostic in context.Diagnostics) 92Diagnostic diagnostic,
Copilot\CSharpCopilotCodeFixProvider.DismissChangesCodeAction.cs (2)
21private sealed class CopilotDismissChangesCodeAction(SyntaxNode originalMethodNode, Diagnostic diagnostic) : CodeAction 32private sealed class TriggerDismissalCodeActionOperation(SyntaxNode originalMethodNode, Diagnostic diagnostic) : CodeActionOperation
Copilot\CSharpImplementNotImplementedExceptionDiagnosticAnalyzer.cs (2)
63context.ReportDiagnostic(Diagnostic.Create( 76context.ReportDiagnostic(Diagnostic.Create(
Copilot\CSharpImplementNotImplementedExceptionFixProvider.cs (2)
84Document document, ImmutableArray<Diagnostic> diagnostics, 90foreach (var diagnostic in diagnostics)
Diagnostics\Analyzers\CSharpSimplifyTypeNamesDiagnosticAnalyzer.cs (2)
51protected override ImmutableArray<Diagnostic> AnalyzeCodeBlock(CodeBlockAnalysisContext context, SyntaxNode root) 67protected override ImmutableArray<Diagnostic> AnalyzeSemanticModel(SemanticModelAnalysisContext context, SyntaxNode root, TextSpanMutableIntervalTree? codeBlockIntervalTree)
Diagnostics\Analyzers\FileBasedPrograms\FileLevelDirectiveDiagnosticAnalyzer.cs (1)
61context.ReportDiagnostic(Diagnostic.Create(
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.cs (5)
48private ImmutableArray<Diagnostic>.Builder? _diagnostics; 60public ImmutableArray<Diagnostic> Diagnostics => _diagnostics?.ToImmutable() ?? []; 62public ImmutableArray<Diagnostic>.Builder DiagnosticsBuilder 67Interlocked.CompareExchange(ref _diagnostics, ImmutableArray.CreateBuilder<Diagnostic>(), null); 289if (!_analyzer.TrySimplify(_semanticModel, node, out var diagnostic, _options, _analyzerOptions, _cancellationToken))
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (2)
3095protected override IEnumerable<Diagnostic> GetParseOptionsRudeEdits(ParseOptions oldOptions, ParseOptions newOptions) 3097foreach (var rudeEdit in base.GetParseOptionsRudeEdits(oldOptions, newOptions))
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (2)
35var diagnostic = AnalyzeNamespace(context, namespaceDeclaration); 40private Diagnostic? AnalyzeNamespace(SyntaxNodeAnalysisContext context, FileScopedNamespaceDeclarationSyntax declaration)
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (2)
39var diagnostic = AnalyzeNamespace(context, root, namespaceDeclaration); 44private Diagnostic? AnalyzeNamespace(SyntaxNodeAnalysisContext context, CompilationUnitSyntax root, BaseNamespaceDeclarationSyntax declaration)
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeAnonymousFunctionStatic\MakeAnonymousFunctionStaticDiagnosticAnalyzer.cs (1)
52Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs (2)
112var diagnostic = Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (3)
44var methodToDiagnostic = PooledDictionary<IMethodSymbol, Diagnostic>.GetInstance(); 100SymbolAnalysisContext context, ReportDiagnostic severity, PooledDictionary<IMethodSymbol, Diagnostic> methodToDiagnostic) 133Dictionary<IMethodSymbol, Diagnostic> methodToDiagnostic)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryAsyncModifier\CSharpMakeMethodSynchronousDiagnosticAnalyzer.cs (1)
128context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
95context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (1)
101context.ReportDiagnostic(Diagnostic.Create(Descriptor, directive.GetLocation()));
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (5)
81private ImmutableArray<Diagnostic> AnalyzeSemanticModel(SemanticModelAnalysisContext context, int positionOfFirstReducingNullableDirective, TextSpanMutableIntervalTree? codeBlockIntervalTree, TextSpanMutableIntervalTree? possibleNullableImpactIntervalTree) 95using var diagnostics = TemporaryArray<Diagnostic>.Empty; 121diagnostics.Add(Diagnostic.Create(Descriptor, currentOptionsDirective.GetLocation())); 153diagnostics.Add(Diagnostic.Create(Descriptor, currentOptionsDirective.GetLocation())); 310foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryNullableWarningSuppressionsDiagnosticAnalyzer.cs (1)
37context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\UnnecessaryNullableWarningSuppressionsUtilities.cs (3)
21private static bool ContainsErrorOrWarning(IEnumerable<Diagnostic> diagnostics) 166Func<SyntaxNode, ImmutableArray<Diagnostic>> computeDiagnostics) 179IEnumerable<Diagnostic> updatedDiagnostics)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryUnsafeModifier\CSharpRemoveUnnecessaryUnsafeModifierDiagnosticAnalyzer.cs (1)
44context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryUnsafeModifier\UnnecessaryUnsafeModifierUtilities.cs (1)
22private static bool ContainsError(IEnumerable<Diagnostic> diagnostics)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\CSharpRemoveUnreachableCodeDiagnosticAnalyzer.cs (1)
59foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (1)
217context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\UseExpressionBodyDiagnosticAnalyzer.cs (2)
79var diagnostic = AnalyzeSyntax(options, context.Node, context, helper, cancellationToken); 89private Diagnostic? AnalyzeSyntax(
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (2)
63var diagnostic = AnalyzeSyntax(context.SemanticModel, option, declaration, context.Options, context.CancellationToken); 70private static Diagnostic? AnalyzeSyntax(
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (1)
310private Diagnostic CreateDiagnostic(Result result, NotificationOption2 notificationOption, AnalyzerOptions analyzerOptions)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (1)
38public static bool IsSafe(Diagnostic diagnostic)
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddBraces\CSharpAddBracesCodeFixProvider.cs (2)
31Document document, ImmutableArray<Diagnostic> diagnostics, 35foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (3)
43foreach (var diagnostic in context.Diagnostics) 67protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 73foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (2)
95Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 134Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
36var diagnostic = context.Diagnostics.First();
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceCodeFixProvider.cs (3)
33var diagnostic = context.Diagnostics.First(); 47Document document, ImmutableArray<Diagnostic> diagnostics, 50var diagnostic = diagnostics.First();
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (2)
41Document document, ImmutableArray<Diagnostic> diagnostics, 45foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (2)
33Diagnostic diagnostic, 48Diagnostic diagnostic,
src\roslyn\src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (4)
40var diagnostic = context.Diagnostics.First(); 51SemanticModel semanticModel, Diagnostic diagnostic, CancellationToken cancellationToken, 133Document document, ImmutableArray<Diagnostic> diagnostics, 139foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (4)
31Diagnostic diagnostic, 67var diagnostic = context.Diagnostics.First(); 75Document document, ImmutableArray<Diagnostic> diagnostics, 81foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (2)
62Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 126protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateConstructor\GenerateConstructorCodeFixProvider.cs (1)
47protected override bool IsCandidate(SyntaxNode node, SyntaxToken token, Diagnostic diagnostic)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateEnumMember\GenerateEnumMemberCodeFixProvider.cs (1)
37protected override bool IsCandidate(SyntaxNode node, SyntaxToken token, Diagnostic diagnostic)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateConversionCodeFixProvider.cs (1)
34protected override bool IsCandidate(SyntaxNode node, SyntaxToken token, Diagnostic diagnostic)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateMethodCodeFixProvider.cs (1)
53protected override bool IsCandidate(SyntaxNode node, SyntaxToken token, Diagnostic diagnostic)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateVariable\CSharpGenerateVariableCodeFixProvider.cs (1)
36protected override bool IsCandidate(SyntaxNode node, SyntaxToken token, Diagnostic diagnostic)
src\roslyn\src\Analyzers\CSharp\CodeFixes\HiddenExplicitCast\CSharpHiddenExplicitCastCodeFixProvider.cs (2)
37ImmutableArray<Diagnostic> diagnostics, 41foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\roslyn\src\Analyzers\CSharp\CodeFixes\HideBase\HideBaseCodeFixProvider.cs (3)
32private static SyntaxNode? GetOriginalNode(SyntaxNode root, Diagnostic diagnostic) 59Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 64foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\InlineDeclaration\CSharpInlineDeclarationCodeFixProvider.cs (3)
45Document document, ImmutableArray<Diagnostic> diagnostics, 53foreach (var diagnostic in diagnostics) 79Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (6)
35protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 44Document document, ImmutableArray<Diagnostic> diagnostics, 47foreach (var diagnostic in diagnostics) 55SyntaxEditor editor, Diagnostic diagnostic, CancellationToken cancellationToken) 70Diagnostic diagnostic, 111SyntaxEditor editor, Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
45protected override async Task<CodeAction?> GetCodeFixAsync(SyntaxNode root, SyntaxNode node, Document document, Diagnostic diagnostics, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (1)
36protected override async Task<CodeAction?> GetCodeFixAsync(SyntaxNode root, SyntaxNode node, Document document, Diagnostic diagnostics, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeAnonymousFunctionStatic\CSharpMakeAnonymousFunctionStaticCodeFixProvider.cs (2)
36protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 40foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixProvider.cs (1)
31Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\PassInCapturedVariablesAsArgumentsCodeFixProvider.cs (3)
33var diagnostic = context.Diagnostics.First(); 50protected override Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 62ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMemberRequired\CSharpMakeMemberRequiredCodeFixProvider.cs (2)
109protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 116foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
40protected override bool IsSupportedDiagnostic(Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (3)
34var diagnostic = context.Diagnostics.First(); 48Document document, ImmutableArray<Diagnostic> diagnostics, 51foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStructFieldsWritable\CSharpMakeStructFieldsWritableCodeFixProvider.cs (2)
35ImmutableArray<Diagnostic> diagnostics, 39foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (1)
36ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStructReadOnly\CSharpMakeStructReadOnlyCodeFixProvider.cs (1)
34ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (1)
74foreach (var diagnostic in context.Diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (3)
33var diagnostic = context.Diagnostics.First(); 43Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 49foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (3)
33var diagnostic = context.Diagnostics.First(); 43Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 49foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (5)
34var diagnostic = context.Diagnostics.First(); 43private static Task<Document> UpdateDocumentAsync(Document document, Diagnostic diagnostic, CancellationToken cancellationToken) 46public static async Task<Document> FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 52foreach (var diagnostic in diagnostics) 63Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (3)
33var diagnostic = context.Diagnostics.First(); 43Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 49foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementCodeFixProvider.cs (4)
36var diagnostic = context.Diagnostics.First(); 45public static async Task<Document> FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 54foreach (var diagnostic in diagnostics) 62Diagnostic diagnostic,
src\roslyn\src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (3)
75ImmutableArray<Diagnostic> diagnostics, 84foreach (var diagnostic in diagnostics) 92protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\QualifyMemberAccess\CSharpQualifyMemberAccessCodeFixProvider.cs (1)
21protected override SimpleNameSyntax? GetNode(Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (2)
55Document document, ImmutableArray<Diagnostic> diagnostics, 64foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveInKeyword\RemoveInKeywordCodeFixProvider.cs (1)
37var diagnostic = context.Diagnostics.First();
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveNewModifier\RemoveNewModifierCodeFixProvider.cs (1)
35var diagnostic = context.Diagnostics.First();
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnneccessaryUnsafeModifier\CSharpRemoveUnnecessaryUnsafeModifierCodeFixProvider.cs (1)
39private static async Task<Document> FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastCodeFixProvider.cs (1)
37Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs (2)
34Document document, ImmutableArray<Diagnostic> diagnostics, 39foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs (2)
40Document document, ImmutableArray<Diagnostic> diagnostics, 43foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveCodeFixProvider.cs (2)
36foreach (var diagnostic in context.Diagnostics) 47ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryNullableWarningSuppressionsCodeFixProvider.cs (1)
40private static async Task<Document> FixSingleDocumentAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnreachableCode\CSharpRemoveUnreachableCodeCodeFixProvider.cs (5)
29var diagnostic = context.Diagnostics[0]; 42protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 45private static bool IsSubsequentSection(Diagnostic diagnostic) 50ImmutableArray<Diagnostic> diagnostics, 54foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnusedLocalFunction\CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs (1)
36protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastCodeFixProvider.cs (2)
37ImmutableArray<Diagnostic> diagnostics, 43foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorCodeFixProvider.cs (2)
36protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 40foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternCodeFixProvider.cs (1)
38Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (4)
30Diagnostic diagnostic, CancellationToken cancellationToken, [NotNullWhen(true)] out RecordDeclarationSyntax? recordDeclaration) 85var diagnostic = context.Diagnostics.First(); 94Document document, ImmutableArray<Diagnostic> diagnostics, 97foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UpgradeProject\CSharpUpgradeProjectCodeFixProvider.cs (3)
65public override string SuggestedVersion(ImmutableArray<Diagnostic> diagnostics) 68private static LanguageVersion RequiredVersion(ImmutableArray<Diagnostic> diagnostics) 71foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (2)
40Document document, ImmutableArray<Diagnostic> diagnostics, 48foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
37Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseDefaultLiteral\CSharpUseDefaultLiteralCodeFixProvider.cs (1)
34Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (3)
97var diagnostic = context.Diagnostics.First(); 115protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 122foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExpressionBody\UseExpressionBodyCodeFixProvider.cs (5)
35protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 41var diagnostic = context.Diagnostics.First(); 53Document document, ImmutableArray<Diagnostic> diagnostics, 59foreach (var diagnostic in diagnostics) 75SemanticModel semanticModel, SyntaxEditor editor, Diagnostic diagnostic,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExpressionBodyForLambda\UseExpressionBodyForLambdaCodeFixProvider.cs (1)
28var diagnostic = context.Diagnostics[0];
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitlyTypedLambdaExpression\CSharpUseImplicitObjectCreationCodeFixProvider.cs (1)
39Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationCodeFixProvider.cs (2)
37protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 46Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (3)
45protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 49Document document, ImmutableArray<Diagnostic> diagnostics, 54foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseImplicitTypeCodeFixProvider.cs (3)
36protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 40Document document, ImmutableArray<Diagnostic> diagnostics, 45foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseIndexOperatorCodeFixProvider.cs (2)
35Document document, ImmutableArray<Diagnostic> diagnostics, 39foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (2)
45Document document, ImmutableArray<Diagnostic> diagnostics, 80private static InvocationExpressionSyntax GetInvocationExpression(Diagnostic d, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseInterpolatedVerbatimString\CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs (3)
35Document document, ImmutableArray<Diagnostic> diagnostics, 38foreach (var diagnostic in diagnostics) 47Diagnostic diagnostic,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (4)
33private static bool IsSupportedDiagnostic(Diagnostic diagnostic) 38var diagnostic = context.Diagnostics.First(); 49Document document, ImmutableArray<Diagnostic> diagnostics, 52foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs (2)
37Document document, ImmutableArray<Diagnostic> diagnostics, 40foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (3)
44protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 53Document document, ImmutableArray<Diagnostic> diagnostics, 65foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseNameofInAttribute\CSharpUseNameofInAttributeCodeFixProvider.cs (2)
36ImmutableArray<Diagnostic> diagnostics, 40foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (4)
52Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 60var diagnostic = context.Diagnostics.First(); 71Document document, ImmutableArray<Diagnostic> diagnostics, 75foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (3)
39Document document, ImmutableArray<Diagnostic> diagnostics, 42foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start)) 46private static void FixOne(SyntaxEditor editor, Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (3)
39Document document, ImmutableArray<Diagnostic> diagnostics, 50foreach (var diagnostic in diagnostics) 84Diagnostic diagnostic,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (3)
36Document document, ImmutableArray<Diagnostic> diagnostics, 39foreach (var diagnostic in diagnostics) 48Diagnostic diagnostic,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpUseNotPatternCodeFixProvider.cs (3)
34Document document, ImmutableArray<Diagnostic> diagnostics, 38foreach (var diagnostic in diagnostics) 48Diagnostic diagnostic,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (1)
61foreach (var diagnostic in context.Diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorFixAllProvider.cs (1)
50foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (1)
43Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockCodeFixProvider.cs (1)
45foreach (var diagnostic in context.Diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseSystemThreadingLock\CSharpUseSystemThreadingLockFixAllProvider.cs (1)
42foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseThrowExpression\UseThrowExpressionCodeFixProvider.cs (3)
30protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 39Document document, ImmutableArray<Diagnostic> diagnostics, 45foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseTupleSwap\CSharpUseTupleSwapCodeFixProvider.cs (3)
36Document document, ImmutableArray<Diagnostic> diagnostics, 39foreach (var diagnostic in diagnostics) 44SyntaxEditor editor, Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (3)
39Document document, ImmutableArray<Diagnostic> diagnostics, 42foreach (var diagnostic in diagnostics) 47SyntaxEditor editor, Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (3)
42Document document, ImmutableArray<Diagnostic> diagnostics, 51foreach (var diagnostic in diagnostics) 90private static IArrayCreationOperation GetArrayCreationOperation(SemanticModel semanticModel, Diagnostic diagnostic, CancellationToken cancellationToken)
StringIndentation\CSharpStringIndentationService.cs (1)
101foreach (var error in errors)
UsePatternMatching\CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs (1)
37Document document, ImmutableArray<Diagnostic> diagnostics,
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (11)
Microsoft.CodeQuality.Analyzers\QualityGuidelines\CSharpAvoidDuplicateElementInitializationFixer.cs (1)
32var diagnostic = context.Diagnostics.FirstOrDefault();
Microsoft.NetCore.Analyzers\InteropServices\CSharpDisableRuntimeMarshalling.FixAllProvider.cs (2)
26protected override async Task<Document?> FixAllAsync(FixAllContext fixAllContext, Document document, ImmutableArray<Diagnostic> diagnostics) 38foreach (var diagnostic in diagnostics)
Microsoft.NetCore.Analyzers\InteropServices\CSharpDisableRuntimeMarshalling.Fixer.cs (1)
42foreach (var diagnostic in context.Diagnostics)
Microsoft.NetCore.Analyzers\Performance\CSharpCollapseMultiplePathOperations.Fixer.cs (1)
28var diagnostic = context.Diagnostics[0];
Microsoft.NetCore.Analyzers\Performance\CSharpPreferDictionaryTryMethodsOverContainsKeyGuardFixer.cs (3)
29var diagnostic = context.Diagnostics.FirstOrDefault(); 57private static async Task<CodeAction?> GetTryGetValueActionAsync(Diagnostic diagnostic, SyntaxNode root, Document document, MemberAccessExpressionSyntax containsKeyAccess, InvocationExpressionSyntax containsKeyInvocation, CancellationToken cancellationToken) 208private static CodeAction? GetTryAddAction(Diagnostic diagnostic, SyntaxNode root, Document document, InvocationExpressionSyntax containsKeyInvocation, MemberAccessExpressionSyntax containsKeyAccess)
Microsoft.NetCore.Analyzers\Runtime\CSharpAvoidRedundantRegexIsMatchBeforeMatch.Fixer.cs (3)
51var diagnostic = context.Diagnostics[0]; 112Diagnostic diagnostic, 185Diagnostic diagnostic,
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
Simplification\CSharpSimplificationService.cs (1)
190foreach (var diagnostic in diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Helpers\RemoveUnnecessaryImports\CSharpUnnecessaryImportsProvider.cs (1)
33foreach (var diagnostic in diagnostics)
Microsoft.CodeAnalysis.ExternalAccess.HotReload (2)
Api\HotReloadService.cs (2)
101public required ImmutableArray<Diagnostic> PersistentDiagnostics { get; init; } 107public required ImmutableArray<(ProjectId project, ImmutableArray<Diagnostic> diagnostics)> TransientDiagnostics { get; init; }
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (2)
CodeActions\OmniSharpCodeFixContextFactory.cs (2)
20ImmutableArray<Diagnostic> diagnostics, 21Action<CodeAction, ImmutableArray<Diagnostic>> registerCodeFix,
Microsoft.CodeAnalysis.Features (523)
AddImport\AbstractAddImportFeatureService.cs (4)
491public async Task<ImmutableArray<(Diagnostic Diagnostic, ImmutableArray<AddImportFixData> Fixes)>> GetFixesForDiagnosticsAsync( 492Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, int maxResultsPerDiagnostic, 499var result = new FixedSizeArrayBuilder<(Diagnostic, ImmutableArray<AddImportFixData>)>(diagnostics.Length); 501foreach (var diagnostic in diagnostics)
AddImport\IAddImportFeatureService.cs (5)
19/// Gets data for how to fix a particular <see cref="Diagnostic" /> id within the specified Document. Useful when 28/// Gets data for how to fix a set of <see cref="Diagnostic" />s within the specified Document. The fix data can be 31Task<ImmutableArray<(Diagnostic Diagnostic, ImmutableArray<AddImportFixData> Fixes)>> GetFixesForDiagnosticsAsync( 32Document document, TextSpan span, ImmutableArray<Diagnostic> diagnostics, int maxResultsPerDiagnostic, 45/// Gets data for how to fix a particular <see cref="Diagnostic" /> id within the specified Document. Similar to
AddMissingReference\AbstractAddMissingReferenceCodeFixProvider.cs (1)
63foreach (var diagnostic in context.Diagnostics)
CodeFixes\CodeFixCollection.cs (4)
21ImmutableArray<Diagnostic> diagnostics) 36public ImmutableArray<Diagnostic> Diagnostics { get; } = ThrowIfDefaultOrEmpty(diagnostics); 38private static ImmutableArray<Diagnostic> ThrowIfDefaultOrEmpty(ImmutableArray<Diagnostic> diagnostics)
CodeFixes\Configuration\ConfigurationUpdater.cs (8)
67private readonly Diagnostic? _diagnostic; 79Diagnostic? diagnosticToConfigure, 109Diagnostic diagnostic, 128Diagnostic diagnostic, 200Diagnostic diagnostic, 212Diagnostic diagnostic, 341Diagnostic diagnostic, 383internal static ImmutableArray<IOption2> GetCodeStyleOptionsForDiagnostic(Diagnostic diagnostic, Project project)
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (6)
37public bool IsFixableDiagnostic(Diagnostic diagnostic) 55public Task<ImmutableArray<CodeFix>> GetFixesAsync(TextDocument document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) 58public Task<ImmutableArray<CodeFix>> GetFixesAsync(Project project, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) 61private static ImmutableArray<CodeFix> GetConfigurations(Project project, IEnumerable<Diagnostic> diagnostics) 64foreach (var diagnostic in diagnostics) 101TopLevelConfigureCodeStyleOptionCodeAction? GetCodeActionForCodeStyleOption(IOption2 option, Diagnostic diagnostic, bool hasMultipleOptions)
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.TopLevelConfigureCodeStyleOptionCodeAction.cs (1)
14public TopLevelConfigureCodeStyleOptionCodeAction(Diagnostic diagnostic, ImmutableArray<CodeAction> nestedActions)
CodeFixes\Configuration\ConfigureSeverity\ConfigureSeverityLevelCodeFixProvider.cs (9)
41public bool IsFixableDiagnostic(Diagnostic diagnostic) 47public Task<ImmutableArray<CodeFix>> GetFixesAsync(TextDocument document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) 50public Task<ImmutableArray<CodeFix>> GetFixesAsync(Project project, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) 53private static ImmutableArray<CodeFix> GetConfigurations(Project project, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) 56var analyzerDiagnosticsByCategory = new SortedDictionary<string, ArrayBuilder<Diagnostic>>(); 57using var disposer = ArrayBuilder<Diagnostic>.GetInstance(out var analyzerDiagnostics); 58foreach (var diagnostic in diagnostics) 79var diagnosticsForCategory = analyzerDiagnosticsByCategory.GetOrAdd(diagnostic.Descriptor.Category, _ => ArrayBuilder<Diagnostic>.GetInstance()); 99void AddBulkConfigurationCodeFixes(ImmutableArray<Diagnostic> diagnostics, string? category)
CodeFixes\Configuration\ConfigureSeverity\ConfigureSeverityLevelCodeFixProvider.TopLevelConfigureSeverityCodeAction.cs (1)
12private sealed class TopLevelConfigureSeverityCodeAction(Diagnostic diagnostic, ImmutableArray<CodeAction> nestedActions) : AbstractConfigurationActionWithNestedActions(nestedActions, string.Format(FeaturesResources.Configure_0_severity, diagnostic.Id))
CodeFixes\FixAllOccurrences\IFixMultipleOccurrencesService.cs (2)
20ImmutableDictionary<Document, ImmutableArray<Diagnostic>> diagnosticsToFix, 35ImmutableDictionary<Project, ImmutableArray<Diagnostic>> diagnosticsToFix,
CodeFixes\Service\CodeFixService.cs (14)
505var uniqueDiagnosticToEquivalenceKeysMap = new Dictionary<Diagnostic, PooledHashSet<string?>>(); 510var diagnosticAndEquivalenceKeyToFixersMap = new Dictionary<(Diagnostic diagnostic, string? equivalenceKey), CodeFixProvider>(); 550var primaryDiagnostic = dxs.First(); 658ImmutableArray<Diagnostic> diagnostics, 659Dictionary<Diagnostic, PooledHashSet<string?>> uniqueDiagosticToEquivalenceKeysMap, 660Dictionary<(Diagnostic diagnostic, string? equivalenceKey), CodeFixProvider> diagnosticAndEquivalenceKeyToFixersMap, 694static ImmutableArray<Diagnostic> FilterApplicableDiagnostics( 695ImmutableArray<Diagnostic> applicableDiagnostics, 698Dictionary<Diagnostic, PooledHashSet<string?>> uniqueDiagosticToEquivalenceKeysMap, 699Dictionary<(Diagnostic diagnostic, string? equivalenceKey), CodeFixProvider> diagnosticAndEquivalenceKeyToFixersMap) 701using var disposer = ArrayBuilder<Diagnostic>.GetInstance(out var newApplicableDiagnostics); 702foreach (var diagnostic in applicableDiagnostics) 777Func<Diagnostic, bool> hasFix, 778Func<ImmutableArray<Diagnostic>, Task<ImmutableArray<CodeFix>>> getFixes,
CodeFixes\Service\CodeFixService.FixAllDiagnosticProvider.cs (4)
43public override async Task<IEnumerable<Diagnostic>> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken) 52public override async Task<IEnumerable<Diagnostic>> GetDocumentSpanDiagnosticsAsync(Document document, TextSpan fixAllSpan, CancellationToken cancellationToken) 62public override async Task<IEnumerable<Diagnostic>> GetAllDiagnosticsAsync(Project project, CancellationToken cancellationToken) 71public override async Task<IEnumerable<Diagnostic>> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken)
CodeFixes\Service\CodeFixService.FixAllPredefinedDiagnosticProvider.cs (8)
17private readonly ImmutableArray<Diagnostic> _diagnostics; 19public FixAllPredefinedDiagnosticProvider(ImmutableArray<Diagnostic> diagnostics) 22public override Task<IEnumerable<Diagnostic>> GetAllDiagnosticsAsync(Project project, CancellationToken cancellationToken) 23=> Task.FromResult<IEnumerable<Diagnostic>>(_diagnostics); 25public override Task<IEnumerable<Diagnostic>> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken) 26=> Task.FromResult<IEnumerable<Diagnostic>>(_diagnostics); 28public override Task<IEnumerable<Diagnostic>> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken) 29=> SpecializedTasks.EmptyEnumerable<Diagnostic>();
CodeFixes\Suppression\AbstractSuppressionBatchFixAllProvider.cs (16)
45ImmutableDictionary<Document, ImmutableArray<Diagnostic>> documentsAndDiagnosticsToFixMap, 74private async Task<ImmutableArray<(Diagnostic diagnostic, CodeAction action)>> GetDiagnosticsAndCodeActionsAsync( 75ImmutableDictionary<Document, ImmutableArray<Diagnostic>> documentsAndDiagnosticsToFixMap, 95return await ProducerConsumer<(Diagnostic diagnostic, CodeAction action)>.RunParallelAsync( 112Document document, ImmutableArray<Diagnostic> diagnostics, 113Action<(Diagnostic diagnostic, CodeAction action)> onItemFound, 135ImmutableDictionary<Project, ImmutableArray<Diagnostic>> projectsAndDiagnosticsToFixMap, 146var bag = new ConcurrentBag<(Diagnostic diagnostic, CodeAction action)>(); 175private static Action<CodeAction, ImmutableArray<Diagnostic>> GetRegisterCodeFixAction( 177Action<(Diagnostic diagnostic, CodeAction action)> onItemFound) 200Project project, ImmutableArray<Diagnostic> diagnostics, 201ConcurrentBag<(Diagnostic diagnostic, CodeAction action)> fixes, 208ImmutableArray<(Diagnostic diagnostic, CodeAction action)> batchOfFixes, 227ImmutableArray<(Diagnostic diagnostic, CodeAction action)> diagnosticsAndCodeActions, 250ImmutableArray<(Diagnostic diagnostic, CodeAction action)> diagnosticsAndCodeActions, 273ImmutableArray<(Diagnostic diagnostic, CodeAction action)> diagnosticsAndCodeActions,
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (12)
44public bool IsFixableDiagnostic(Diagnostic diagnostic) 47protected abstract SyntaxTriviaList CreatePragmaDisableDirectiveTrivia(Diagnostic diagnostic, Func<SyntaxNode, CancellationToken, SyntaxNode> formatNode, bool needsLeadingEndOfLine, bool needsTrailingEndOfLine, CancellationToken cancellationToken); 48protected abstract SyntaxTriviaList CreatePragmaRestoreDirectiveTrivia(Diagnostic diagnostic, Func<SyntaxNode, CancellationToken, SyntaxNode> formatNode, bool needsLeadingEndOfLine, bool needsTrailingEndOfLine, CancellationToken cancellationToken); 54Diagnostic diagnostic, 61SyntaxNode targetNode, ISymbol targetSymbol, INamedTypeSymbol suppressMessageAttribute, Diagnostic diagnostic); 80protected static string GetOrMapDiagnosticId(Diagnostic diagnostic, out bool includeTitle) 142TextDocument textDocument, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) 150internal async Task<ImmutableArray<PragmaWarningCodeAction>> GetPragmaSuppressionsAsync(Document document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) 157Document document, TextSpan span, IEnumerable<Diagnostic> diagnostics, bool skipSuppressMessage, bool skipUnsuppress, CancellationToken cancellationToken) 170Project project, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken) 186Document? documentOpt, Project project, IEnumerable<Diagnostic> diagnostics, SuppressionTargetInfo suppressionTargetInfo, bool skipSuppressMessage, bool skipUnsuppress, CancellationToken cancellationToken) 205foreach (var diagnostic in diagnostics)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageCodeAction.cs (2)
18Project project, Diagnostic diagnostic, 22private readonly Diagnostic _diagnostic = diagnostic;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (24)
28private readonly IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>> _diagnosticsBySymbol; 33IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>> diagnosticsBySymbol, 41internal static CodeAction Create(string title, AbstractSuppressionCodeFixProvider fixer, Document triggerDocument, ImmutableDictionary<Document, ImmutableArray<Diagnostic>> diagnosticsByDocument) 48internal static CodeAction Create(string title, AbstractSuppressionCodeFixProvider fixer, Project triggerProject, ImmutableDictionary<Project, ImmutableArray<Diagnostic>> diagnosticsByProject) 70ImmutableDictionary<Document, ImmutableArray<Diagnostic>> diagnosticsByDocument, 99ImmutableDictionary<Project, ImmutableArray<Diagnostic>> diagnosticsByProject, 138foreach (var diagnostic in diagnostics) 152private static async Task<IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>>> CreateDiagnosticsBySymbolAsync(AbstractSuppressionCodeFixProvider fixer, IEnumerable<KeyValuePair<Document, ImmutableArray<Diagnostic>>> diagnosticsByDocument, CancellationToken cancellationToken) 154var diagnosticsMapBuilder = ImmutableDictionary.CreateBuilder<ISymbol, List<Diagnostic>>(); 157foreach (var diagnostic in diagnostics) 173private static async Task<IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>>> CreateDiagnosticsBySymbolAsync(Project project, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 175var diagnosticsMapBuilder = ImmutableDictionary.CreateBuilder<ISymbol, List<Diagnostic>>(); 179foreach (var diagnostic in diagnostics) 190private static void AddDiagnosticForSymbolIfNeeded(ISymbol targetSymbol, Diagnostic diagnostic, ImmutableDictionary<ISymbol, List<Diagnostic>>.Builder diagnosticsMapBuilder) 206private static IEnumerable<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>> CreateDiagnosticsBySymbol(ImmutableDictionary<ISymbol, List<Diagnostic>>.Builder diagnosticsMapBuilder) 211var builder = new List<KeyValuePair<ISymbol, ImmutableArray<Diagnostic>>>(); 218private static ImmutableArray<Diagnostic> GetUniqueDiagnostics(List<Diagnostic> diagnostics) 221var uniqueDiagnostics = ArrayBuilder<Diagnostic>.GetInstance(); 222foreach (var diagnostic in diagnostics)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.LocalSuppressMessageCodeAction.cs (2)
20Diagnostic diagnostic) : AbstractSuppressionCodeAction(fixer, FeaturesResources.in_Source_attribute) 26private readonly Diagnostic _diagnostic = diagnostic;
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs (9)
30ImmutableArray<Diagnostic> pragmaDiagnostics, 45ImmutableArray<Diagnostic> diagnostics, 50var currentDiagnosticSpans = new Dictionary<Diagnostic, TextSpan>(); 51foreach (var diagnostic in diagnostics) 60var diagnostic = diagnostics[i]; 71diagnostic = Diagnostic.Create( 130private static void UpdateDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics, Dictionary<Diagnostic, TextSpan> currentDiagnosticSpans, IEnumerable<TextChange> textChanges) 136foreach (var diagnostic in diagnostics)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaHelpers.cs (2)
105Diagnostic diagnostic, 157Diagnostic diagnostic,
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaWarningBatchFixAllProvider.cs (4)
27Document document, ImmutableArray<Diagnostic> diagnostics, 28Action<(Diagnostic diagnostic, CodeAction action)> onItemFound, 32var pragmaDiagnosticsBuilder = ArrayBuilder<Diagnostic>.GetInstance(); 34foreach (var diagnostic in diagnostics.Where(d => d.Location.IsInSource && !d.IsSuppressed))
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.PragmaWarningCodeAction.cs (3)
18private readonly Diagnostic _diagnostic; 25Diagnostic diagnostic, 39Diagnostic diagnostic,
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs (9)
35Document document, ImmutableArray<Diagnostic> diagnostics, 36Action<(Diagnostic diagnostic, CodeAction action)> onItemFound, 41using var _2 = ArrayBuilder<Diagnostic>.GetInstance(out var pragmaDiagnosticsBuilder); 43foreach (var diagnostic in diagnostics.Where(d => d.Location.IsInSource && d.IsSuppressed)) 85Project project, ImmutableArray<Diagnostic> diagnostics, 86ConcurrentBag<(Diagnostic diagnostic, CodeAction action)> bag, 89foreach (var diagnostic in diagnostics.Where(d => !d.Location.IsInSource && d.IsSuppressed)) 106ImmutableArray<(Diagnostic diagnostic, CodeAction action)> batchOfFixes, 119var newBatchOfFixes = new List<(Diagnostic diagnostic, CodeAction action)>();
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.cs (3)
20private readonly Diagnostic _diagnostic; 27Diagnostic diagnostic, 49Diagnostic diagnostic,
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Attribute.cs (2)
29Diagnostic diagnostic, 38Diagnostic diagnostic,
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (6)
35Diagnostic diagnostic, 49Diagnostic diagnostic, 118private static bool CanRemovePragmaTrivia(SyntaxToken token, Diagnostic diagnostic, AbstractSuppressionCodeFixProvider fixer, bool isStartToken, out int indexOfTriviaToRemove) 212var dummyDiagnosticWithLocationToCheck = Diagnostic.Create(_diagnostic.Descriptor, locationToCheck); 213var effectiveDiagnostic = CompilationWithAnalyzers.GetEffectiveDiagnostics([dummyDiagnosticWithLocationToCheck], model.Compilation).FirstOrDefault();
CodeFixes\Suppression\SuppressionHelpers.cs (7)
18public static bool CanBeSuppressed(Diagnostic diagnostic) 21public static bool CanBeSuppressedWithAttribute(Diagnostic diagnostic) 33public static bool CanBeUnsuppressed(Diagnostic diagnostic) 36private static bool CanBeSuppressedOrUnsuppressed(Diagnostic diagnostic, bool checkCanBeSuppressed) 68public static bool IsNotConfigurableDiagnostic(Diagnostic diagnostic) 74public static bool IsCompilerDiagnostic(Diagnostic diagnostic) 80public static bool IsSynthesizedExternalSourceDiagnostic(Diagnostic diagnostic)
CodeFixes\Suppression\TopLevelSuppressionCodeAction.cs (1)
10internal sealed class TopLevelSuppressionCodeAction(Diagnostic diagnostic, ImmutableArray<NestedSuppressionCodeAction> nestedActions) : AbstractConfigurationActionWithNestedActions(ImmutableArray<CodeAction>.CastUp(nestedActions), string.Format(FeaturesResources.Suppress_0, diagnostic.Id))
Completion\Providers\AbstractInternalsVisibleToCompletionProvider.cs (1)
193foreach (var diagnostic in attribute.GetDiagnostics())
Copilot\CopilotChangeAnalysis.cs (3)
32/// <param name="IdToCount">Mapping from <see cref="Diagnostic.Id"/> to the number of diagnostics produced for that id.</param> 33/// <param name="CategoryToCount">Mapping from <see cref="Diagnostic.Category"/> to the number of diagnostics produced for that category.</param> 34/// <param name="SeverityToCount">Mapping from <see cref="Diagnostic.Severity"/> to the number of diagnostics produced for that severity.</param>
Copilot\ICopilotCodeAnalysisService.cs (2)
57Task<ImmutableArray<Diagnostic>> GetCachedDocumentDiagnosticsAsync(Document document, TextSpan? span, ImmutableArray<string> promptTitles, CancellationToken cancellationToken); 65Task StartRefinementSessionAsync(Document oldDocument, Document newDocument, Diagnostic? primaryDiagnostic, CancellationToken cancellationToken);
Diagnostics\Analyzers\UnboundIdentifiersDiagnosticAnalyzerBase.cs (1)
80context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptor, typeName.GetLocation(), typeName.ToString()));
Diagnostics\Service\DiagnosticAnalyzerService_CoreAnalyze.cs (5)
133async Task<ImmutableArray<Diagnostic>> GetPragmaSuppressionAnalyzerDiagnosticsAsync() 152using var _ = ArrayBuilder<Diagnostic>.GetInstance(out var diagnosticsBuilder); 162return await ProducerConsumer<Diagnostic>.RunParallelAsync( 176using var _ = ArrayBuilder<Diagnostic>.GetInstance(out var diagnosticsBuilder); 195Action<Diagnostic> reportDiagnostic,
Diagnostics\Service\DocumentAnalysisExecutor.cs (3)
336static bool IsUnusedImportDiagnostic(Diagnostic d) 351bool shouldInclude(Diagnostic d) => span.Value.IntersectsWith(d.Location.SourceSpan) && !IsUnusedImportDiagnostic(d); 370var diagnostic = await diagnosticData.ToDiagnosticAsync(textDocument.Project, cancellationToken).ConfigureAwait(false);
Diagnostics\Service\DocumentAnalysisExecutor_Helpers.cs (13)
28internal static Diagnostic CreateAnalyzerExceptionDiagnostic(DiagnosticAnalyzer analyzer, Exception e) 44return Diagnostic.Create(descriptor, Location.None, analyzerName, e.GetType(), e.Message); 78public static async Task<ImmutableArray<Diagnostic>> ComputeDocumentDiagnosticAnalyzerDiagnosticsAsync( 88ImmutableArray<Diagnostic> diagnostics; 124private static async Task VerifyDiagnosticLocationsAsync(ImmutableArray<Diagnostic> diagnostics, Project project, CancellationToken cancellationToken) 126foreach (var diagnostic in diagnostics) 209internal static bool AreEquivalent(Diagnostic[] diagnosticsA, Diagnostic[] diagnosticsB) 211var set = new HashSet<Diagnostic>(diagnosticsA, DiagnosticComparer.Instance); 215private sealed class DiagnosticComparer : IEqualityComparer<Diagnostic?> 219public bool Equals(Diagnostic? x, Diagnostic? y) 229public int GetHashCode(Diagnostic? obj)
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (8)
558var syntaxError = syntaxDiagnostics.FirstOrDefault(d => d.Severity == DiagnosticSeverity.Error); 828protected static Diagnostic CreateProjectRudeEdit(ProjectSettingKind kind, string oldValue, string newValue) 829=> Diagnostic.Create( 834protected virtual IEnumerable<Diagnostic> GetParseOptionsRudeEdits(ParseOptions oldOptions, ParseOptions newOptions) 871protected virtual IEnumerable<Diagnostic> GetCompilationOptionsRudeEdits(CompilationOptions oldOptions, CompilationOptions newOptions) 916public IEnumerable<Diagnostic> GetProjectSettingRudeEdits(Project oldProject, Project newProject) 923foreach (var rudeEdit in GetParseOptionsRudeEdits(oldProject.ParseOptions, newProject.ParseOptions)) 928foreach (var rudeEdit in GetCompilationOptionsRudeEdits(oldProject.CompilationOptions, newProject.CompilationOptions))
EditAndContinue\DebuggingSession.cs (7)
275internal Task<(Guid Mvid, Diagnostic? Error)> GetProjectModuleIdAsync(Project project, CancellationToken cancellationToken) 282(Guid Mvid, Diagnostic? Error) ReadMvid() 297return (Mvid: Guid.Empty, Error: Diagnostic.Create(descriptor, Location.None, [outputs.AssemblyDisplayPath, e.Message])); 313ArrayBuilder<Diagnostic> diagnostics, 374ArrayBuilder<Diagnostic> diagnostics, 427diagnostics.Add(Diagnostic.Create(descriptor, Location.None, [fileBeingRead, e.Message])); 454public async ValueTask<ImmutableArray<Diagnostic>> GetDocumentDiagnosticsAsync(Document document, ActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken)
EditAndContinue\DocumentAnalysisResults.cs (3)
41public Diagnostic? SyntaxError { get; } 112Diagnostic? syntaxError, 185public static DocumentAnalysisResults Blocked(DocumentId documentId, string filePath, ImmutableArray<RudeEditDiagnostic> rudeEdits, Diagnostic? syntaxError, TimeSpan elapsedTime, bool hasChanges)
EditAndContinue\EditAndContinueDiagnosticDescriptors.cs (4)
278public static bool IsDocumentReadError(this Diagnostic diagnostic) 281public static bool IsNoEffectDiagnostic(this Diagnostic diagnostic) 284public static bool IsEncDiagnostic(this Diagnostic diagnostic) 287public static bool IsRudeEdit(this Diagnostic diagnostic)
EditAndContinue\EditAndContinueService.cs (1)
202public ValueTask<ImmutableArray<Diagnostic>> GetDocumentDiagnosticsAsync(Document document, ActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken)
EditAndContinue\EditSession.cs (23)
122private async Task<Diagnostic?> GetUnsupportedChangesDiagnosticAsync(EmitDifferenceResult emitResult, CancellationToken cancellationToken) 144return Diagnostic.Create(descriptor, Location.None); 155public async Task<string?> ReportModuleDiagnosticsAsync(Guid mvid, Project oldProject, Project newProject, ImmutableArray<DocumentAnalysisResults> documentAnalyses, ArrayBuilder<Diagnostic> diagnostics, CancellationToken cancellationToken) 168diagnostics.Add(Diagnostic.Create(descriptor, location, messageArgs)); 497internal static async Task GetProjectDifferencesAsync(TraceLog log, Project? oldProject, Project newProject, ProjectDifferences documentDifferences, ArrayBuilder<Diagnostic> diagnostics, CancellationToken cancellationToken) 551private static async ValueTask<TextDocumentStates<SourceGeneratedDocumentState>> GetSourceGeneratedDocumentStatesAsync(TraceLog log, Project project, ArrayBuilder<Diagnostic>? diagnostics, CancellationToken cancellationToken) 559foreach (var generatorDiagnostic in generatorDiagnostics) 617ArrayBuilder<Diagnostic> diagnostics, 634diagnostics.Add(Diagnostic.Create(descriptor, Location.Create(newDocument.FilePath!, textSpan: default, lineSpan: default), [newDocument.FilePath])); 682diagnostics.Add(Diagnostic.Create( 733private static bool HasProjectSettingsBlockingRudeEdits(Project oldProject, Project newProject, ArrayBuilder<Diagnostic> diagnostics) 741foreach (var diagnostic in analyzer.GetProjectSettingRudeEdits(oldProject, newProject)) 750private static bool HasReferenceRudeEdits(ImmutableDictionary<string, OneOrMany<AssemblyIdentity>> oldReferencedAssemblies, Compilation newCompilation, ArrayBuilder<Diagnostic> projectDiagnostics) 771projectDiagnostics.Add(Diagnostic.Create( 781projectDiagnostics.Add(Diagnostic.Create( 1092var projectDiagnostics = ArrayBuilder<Diagnostic>.GetInstance(); 1103using var _6 = PooledDictionary<ProjectId, ArrayBuilder<Diagnostic>>.GetInstance(out var diagnosticBuilders); 1131Diagnostic? syntaxError = null; 1418foreach (var emitDiagnostic in emitResult.Diagnostics) 1439var unsupportedChangesDiagnostic = await GetUnsupportedChangesDiagnosticAsync(emitResult, cancellationToken).ConfigureAwait(false); 1513projectDiagnostics = ArrayBuilder<Diagnostic>.GetInstance(); 1530var diagnostic = Diagnostic.Create(
EditAndContinue\EditSessionTelemetry.cs (2)
90public void LogProjectAnalysisSummary(ProjectAnalysisSummary? summary, Guid projectTelemetryId, IEnumerable<Diagnostic> diagnostics) 95foreach (var diagnostic in diagnostics)
EditAndContinue\EmitSolutionUpdateResults.cs (12)
87var diagnostic = Diagnostic.Create( 132public required Diagnostic? SyntaxError { get; init; } 387private static void ClassifyRudeEdits(ImmutableArray<Diagnostic> diagnostics, out bool blocking, out bool noEffect) 392foreach (var diagnostic in diagnostics) 404public ImmutableArray<Diagnostic> GetAllDiagnostics() 406using var _ = ArrayBuilder<Diagnostic>.GetInstance(out var result); 424public ImmutableArray<(ProjectId projectId, ImmutableArray<Diagnostic> diagnostics)> GetTransientDiagnostics() 426using var _ = ArrayBuilder<(ProjectId projectId, ImmutableArray<Diagnostic> diagnostics)>.GetInstance(out var result); 443public ImmutableArray<Diagnostic> GetPersistentDiagnostics() 445using var _ = ArrayBuilder<Diagnostic>.GetInstance(out var result); 449foreach (var diagnostic in diagnostics)
EditAndContinue\IEditAndContinueAnalyzer.cs (1)
30IEnumerable<Diagnostic> GetProjectSettingRudeEdits(Project oldProject, Project newProject);
EditAndContinue\IEditAndContinueService.cs (1)
21ValueTask<ImmutableArray<Diagnostic>> GetDocumentDiagnosticsAsync(Document document, ActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken);
EditAndContinue\ProjectDiagnostics.cs (2)
12internal readonly record struct ProjectDiagnostics(ProjectId ProjectId, ImmutableArray<Diagnostic> Diagnostics); 24foreach (var diagnostic in projectDiagnostics)
EditAndContinue\RudeEditDiagnostic.cs (2)
41internal Diagnostic ToDiagnostic(SyntaxTree? tree) 44return Diagnostic.Create(descriptor, tree?.GetLocation(Span) ?? Location.None, Arguments);
EditAndContinue\SolutionUpdate.cs (4)
18Diagnostic? syntaxError, 30public readonly Diagnostic? SyntaxError = syntaxError; 37Diagnostic? syntaxError, 65foreach (var diagnostic in projectDiagnostics.Diagnostics)
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDetectionCodeFixProvider.cs (3)
41public void Fix(SyntaxEditor editor, Diagnostic diagnostic, CancellationToken cancellationToken) 54Document document, ImmutableArray<Diagnostic> diagnostics, 57foreach (var diagnostic in diagnostics)
ExternalAccess\UnitTesting\API\UnitTestingHotReloadService.cs (1)
88public async Task<(ImmutableArray<Update> updates, ImmutableArray<Diagnostic> diagnostics)> EmitSolutionUpdateAsync(Solution solution, bool commitUpdates, CancellationToken cancellationToken)
ExtractMethod\Extensions.cs (1)
51var set = new HashSet<Diagnostic>(node.GetDiagnostics());
PreferFrameworkType\PreferFrameworkTypeCodeFixProvider.cs (4)
28var diagnostic = context.Diagnostics[0]; 38Document document, ImmutableArray<Diagnostic> diagnostics, 44foreach (var diagnostic in diagnostics) 59protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic)
RemoveUnusedVariable\AbstractRemoveUnusedVariableCodeFixProvider.cs (3)
41var diagnostic = context.Diagnostics.First(); 55protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor syntaxEditor, CancellationToken cancellationToken) 66foreach (var diagnostic in diagnostics)
SimplifyThisOrMe\AbstractSimplifyThisOrMeCodeFixProvider.cs (1)
37Document document, ImmutableArray<Diagnostic> diagnostics,
SimplifyTypeNames\AbstractSimplifyTypeNamesCodeFixProvider.cs (2)
92Document document, ImmutableArray<Diagnostic> diagnostics, 99foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\Analyzers\ConvertTypeofToNameof\AbstractConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
42context.ReportDiagnostic(Diagnostic.Create(Descriptor, location));
src\roslyn\src\Analyzers\Core\Analyzers\FileHeaders\AbstractFileHeaderDiagnosticAnalyzer.cs (2)
71context.ReportDiagnostic(Diagnostic.Create(s_missingHeaderDescriptor, fileHeader.GetLocation(tree))); 78context.ReportDiagnostic(Diagnostic.Create(s_invalidHeaderDescriptor, fileHeader.GetLocation(tree)));
src\roslyn\src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (1)
98context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (22)
19/// Creates a <see cref="Diagnostic"/> instance. 28/// If null, <see cref="Diagnostic.AdditionalLocations"/> will return an empty list. 32/// can convey more detailed information to the fixer. If null, <see cref="Diagnostic.Properties"/> will return 36/// <returns>The <see cref="Diagnostic"/> instance.</returns> 37public static Diagnostic Create( 76/// <see cref="Diagnostic.AdditionalLocations"/>. 81/// <see cref="Diagnostic.AdditionalLocations"/>. 84/// <returns>The <see cref="Diagnostic"/> instance.</returns> 85public static Diagnostic CreateWithLocationTags( 104private static Diagnostic CreateWithLocationTags( 140/// <see cref="Diagnostic.AdditionalLocations"/>. 145/// <see cref="Diagnostic.AdditionalLocations"/>. 152/// <returns>The <see cref="Diagnostic"/> instance.</returns> 153public static Diagnostic CreateWithLocationTags( 174public static Diagnostic CreateWithLocationTags( 200private static Diagnostic CreateWithLocationTags( 241/// Creates a <see cref="Diagnostic"/> instance. 250/// If null, <see cref="Diagnostic.AdditionalLocations"/> will return an empty list. 254/// can convey more detailed information to the fixer. If null, <see cref="Diagnostic.Properties"/> will return 258/// <returns>The <see cref="Diagnostic"/> instance.</returns> 259public static Diagnostic CreateWithMessage( 274return Diagnostic.Create(
src\roslyn\src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
126var diagnostic = DiagnosticHelper.Create(
src\roslyn\src\Analyzers\Core\Analyzers\NamingStyle\NamingStyleDiagnosticAnalyzerBase.cs (3)
65var diagnostic = TryGetDiagnostic( 92var diagnostic = TryGetDiagnostic( 109private Diagnostic? TryGetDiagnostic(
src\roslyn\src\Analyzers\Core\Analyzers\PopulateSwitch\AbstractPopulateSwitchDiagnosticAnalyzer.cs (2)
72var diagnostic = Diagnostic.Create(
src\roslyn\src\Analyzers\Core\Analyzers\RemoveRedundantEquality\AbstractRemoveRedundantEqualityDiagnosticAnalyzer.cs (1)
112context.ReportDiagnostic(Diagnostic.Create(Descriptor,
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessaryCast\AbstractRemoveUnnecessaryCastDiagnosticAnalyzer.cs (3)
44var diagnostic = TryRemoveCastExpression( 55private Diagnostic? TryRemoveCastExpression(SemanticModel model, TCastExpression node, CancellationToken cancellationToken) 70return Diagnostic.Create(
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (6)
113foreach (var diagnostic in diagnostics) 142context.ReportDiagnostic(Diagnostic.Create(s_enableGenerateDocumentationFileIdDescriptor, Location.None)); 198private static IEnumerable<Diagnostic> CreateClassificationDiagnostics( 209yield return Diagnostic.Create(descriptor, tree.GetLocation(span)); 216private IEnumerable<Diagnostic> CreateFixableDiagnostics( 222yield return Diagnostic.Create(s_fixableIdDescriptor, tree.GetLocation(span));
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs (4)
73public void AnalyzeAssemblyOrModuleAttribute(SyntaxNode attributeSyntax, SemanticModel model, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken) 82reportDiagnostic(Diagnostic.Create(s_invalidScopeDescriptor, attributeSyntax.GetLocation())); 89reportDiagnostic(Diagnostic.Create(s_invalidOrMissingTargetDescriptor, attributeSyntax.GetLocation())); 112reportDiagnostic(Diagnostic.Create(LegacyFormatTargetDescriptor, targetValueOperation.Syntax.GetLocation(), properties, targetSymbolString));
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (20)
89Action<Diagnostic> reportDiagnostic, 389private static async Task<(ImmutableArray<Diagnostic> reportedDiagnostics, ImmutableArray<string> unhandledIds)> GetReportedDiagnosticsForIdsAsync( 450using var _3 = ArrayBuilder<Diagnostic>.GetInstance(out var reportedDiagnostics); 483static void AddAllDiagnostics(ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> diagnostics, ArrayBuilder<Diagnostic> reportedDiagnostics) 491static void AddAllCompilationDiagnosticsForTree(AnalysisResult analysisResult, SyntaxTree tree, ArrayBuilder<Diagnostic> reportedDiagnostics) 495foreach (var diagnostic in perAnalyzerDiagnostics) 507ImmutableArray<Diagnostic> diagnostics, 516foreach (var diagnostic in diagnostics) 544Diagnostic diagnostic, 584Diagnostic diagnostic, 612Action<Diagnostic> reportDiagnostic, 616using var _ = ArrayBuilder<Diagnostic>.GetInstance(out var diagnosticsBuilder); 622foreach (var diagnostic in effectiveDiagnostics) 630ArrayBuilder<Diagnostic> diagnosticsBuilder, 655var diagnostic = Diagnostic.Create(s_removeUnnecessarySuppressionDescriptor, pragma.GetLocation(), severity, additionalLocations, properties: null); 662ArrayBuilder<Diagnostic> diagnosticsBuilder, 670var diagnostic = Diagnostic.Create(s_removeUnnecessarySuppressionDescriptor, attribute.GetLocation(), severity, additionalLocations: null, properties: null);
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (3)
294public static bool TryGetUnusedValuePreference(Diagnostic diagnostic, out UnusedValuePreference preference) 315public static bool GetIsUnusedLocalDiagnostic(Diagnostic diagnostic) 321public static bool GetIsRemovableAssignmentDiagnostic(Diagnostic diagnostic)
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
215var diagnostic = DiagnosticHelper.Create(s_expressionValueIsUnusedRule, 573var diagnostic = DiagnosticHelper.Create(s_valueAssignedIsUnusedRule,
src\roslyn\src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs (2)
122Action<Diagnostic> reportDiagnostic, 146var diagnostic = DiagnosticHelper.CreateWithMessage(s_unusedParameterRule, location,
src\roslyn\src\Analyzers\Core\Analyzers\SimplifyTypeNames\SimplifyTypeNamesDiagnosticAnalyzerBase.cs (7)
97protected abstract ImmutableArray<Diagnostic> AnalyzeCodeBlock(CodeBlockAnalysisContext context, SyntaxNode root); 98protected abstract ImmutableArray<Diagnostic> AnalyzeSemanticModel(SemanticModelAnalysisContext context, SyntaxNode root, TextSpanMutableIntervalTree? codeBlockIntervalTree); 100public bool TrySimplify(SemanticModel model, SyntaxNode node, [NotNullWhen(true)] out Diagnostic? diagnostic, TSimplifierOptions options, AnalyzerOptions analyzerOptions, CancellationToken cancellationToken) 121internal static Diagnostic CreateDiagnostic(SemanticModel model, TSimplifierOptions options, AnalyzerOptions analyzerOptions, TextSpan issueSpan, string diagnosticId, bool inDeclaration) 153var diagnostic = DiagnosticHelper.Create(descriptor, tree.GetLocation(issueSpan), notificationOption, analyzerOptions, additionalLocations: null, builder.ToImmutable()); 230foreach (var diagnostic in diagnostics) 283foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (1)
670context.ReportDiagnostic(Diagnostic.Create(
src\roslyn\src\Analyzers\Core\Analyzers\UseCollectionInitializer\UseCollectionInitializerHelpers.cs (1)
99public static bool ChangesSemantics(Diagnostic diagnostic)
src\roslyn\src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (2)
357var diagnostic = Diagnostic.Create(
src\roslyn\src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AbstractAddAccessibilityModifiersCodeFixProvider.cs (3)
26var diagnostic = context.Diagnostics.First(); 40Document document, ImmutableArray<Diagnostic> diagnostics, 45foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\AddAnonymousTypeMemberName\AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs (5)
37var diagnostic = context.Diagnostics[0]; 53Document document, Diagnostic diagnostic, CancellationToken cancellationToken) 83Document document, ImmutableArray<Diagnostic> diagnostics, 91foreach (var diagnostic in diagnostics) 100Document document, SemanticModel semanticModel, Diagnostic diagnostic,
src\roslyn\src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (2)
69var diagnostic = context.Diagnostics.First(); 212ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\Core\CodeFixes\AddObsoleteAttribute\AbstractAddObsoleteAttributeCodeFixProvider.cs (1)
71Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\Core\CodeFixes\AddParameter\AbstractAddParameterCodeFixProvider.cs (2)
65var diagnostic = context.Diagnostics.First(); 109SyntaxNode initialNode, SyntaxNode node, Diagnostic diagnostic)
src\roslyn\src\Analyzers\Core\CodeFixes\AddRequiredParentheses\AddRequiredParenthesesCodeFixProvider.cs (3)
26protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 37Document document, ImmutableArray<Diagnostic> diagnostics, 42foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (2)
393Document document, ImmutableArray<Diagnostic> diagnostics, 414foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (3)
18protected abstract Task<string> GetDescriptionAsync(Diagnostic diagnostic, SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken); 19protected abstract Task<(SyntaxTree syntaxTree, SyntaxNode root)?> GetRootInOtherSyntaxTreeAsync(SyntaxNode node, SemanticModel semanticModel, Diagnostic diagnostic, CancellationToken cancellationToken); 52SyntaxNode node, Document document, Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\ConvertTypeOfToNameOf\AbstractConvertTypeOfToNameOfCodeFixProvider.cs (2)
34Document document, ImmutableArray<Diagnostic> diagnostics, 38foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\FileHeaders\AbstractFileHeaderCodeFixProvider.cs (1)
32foreach (var diagnostic in context.Diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (3)
35protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 39Document document, ImmutableArray<Diagnostic> diagnostics, 44foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\Formatting\FormattingCodeFixProvider.cs (3)
51foreach (var diagnostic in context.Diagnostics) 68private async Task<Document> FixOneAsync(CodeFixContext context, Diagnostic diagnostic, CancellationToken cancellationToken) 86protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorCodeFixProvider.cs (1)
24var diagnostic = context.Diagnostics.FirstOrDefault();
src\roslyn\src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberCodeFixProvider.cs (3)
26protected abstract bool IsCandidate(SyntaxNode node, SyntaxToken token, Diagnostic diagnostic); 37var diagnostic = context.Diagnostics.First(); 61TextSpan span, Diagnostic diagnostic)
src\roslyn\src\Analyzers\Core\CodeFixes\Iterator\AbstractIteratorCodeFixProvider.cs (2)
17protected abstract Task<CodeAction?> GetCodeFixAsync(SyntaxNode root, SyntaxNode node, Document document, Diagnostic diagnostics, CancellationToken cancellationToken); 27var diagnostic = context.Diagnostics[0];
src\roslyn\src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (2)
38ImmutableArray<Diagnostic> diagnostics, 44foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\MakeMemberStatic\AbstractMakeMemberStaticCodeFixProvider.cs (1)
28protected sealed override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor,
src\roslyn\src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (4)
20protected abstract bool IsSupportedDiagnostic(Diagnostic diagnostic, CancellationToken cancellationToken); 40var diagnostic = context.Diagnostics.First(); 108Diagnostic diagnostic, 151private SyntaxNode? GetContainingFunction(Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
32var diagnostic = context.Diagnostics.First();
src\roslyn\src\Analyzers\Core\CodeFixes\MakeTypeAbstract\AbstractMakeTypeAbstractCodeFixProvider.cs (1)
28protected sealed override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor,
src\roslyn\src\Analyzers\Core\CodeFixes\MakeTypePartial\AbstractMakeTypePartialCodeFixProvider.cs (2)
23protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 29foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (1)
40private static async Task<Solution> FixAllInDocumentAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.CustomFixAllProvider.cs (3)
51static async Task<ImmutableArray<Diagnostic>> GetSolutionDiagnosticsAsync(FixAllContext fixAllContext) 53var diagnostics = ImmutableArray.CreateBuilder<Diagnostic>(); 67ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
48var diagnostic = context.Diagnostics.First();
src\roslyn\src\Analyzers\Core\CodeFixes\NewLines\ConsecutiveStatementPlacement\ConsecutiveStatementPlacementCodeFixProvider.cs (3)
32var diagnostic = context.Diagnostics.First(); 40private static Task<Document> UpdateDocumentAsync(Document document, Diagnostic diagnostic, CancellationToken cancellationToken) 43public static async Task<Document> FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\NewLines\MultipleBlankLines\AbstractMultipleBlankLinesCodeFixProvider.cs (4)
32var diagnostic = context.Diagnostics.First(); 40private static Task<Document> UpdateDocumentAsync(Document document, Diagnostic diagnostic, CancellationToken cancellationToken) 44Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 50foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\OrderModifiers\AbstractOrderModifiersCodeFixProvider.cs (2)
44Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 53foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (7)
52var diagnostic = context.Diagnostics.First(); 98Document document, Diagnostic diagnostic, 107Document document, ImmutableArray<Diagnostic> diagnostics, 117Document document, SyntaxEditor editor, ImmutableArray<Diagnostic> diagnostics, 121foreach (var diagnostic in diagnostics) 130Document document, SyntaxEditor editor, Diagnostic diagnostic, 213ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\Core\CodeFixes\QualifyMemberAccess\AbstractQualifyMemberAccessCodeFixProvider.cs (3)
21protected abstract TSimpleNameSyntax? GetNode(Diagnostic diagnostic, CancellationToken cancellationToken); 33Document document, ImmutableArray<Diagnostic> diagnostics, 38foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveAsyncModifier\AbstractRemoveAsyncModifierCodeFixProvider.cs (3)
34var diagnostic = context.Diagnostics.First(); 53Document document, ImmutableArray<Diagnostic> diagnostics, 64foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnnecessaryImports\AbstractRemoveUnnecessaryImportsCodeFixProvider.cs (1)
53Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesCodeFixProvider.cs (1)
32Document document, ImmutableArray<Diagnostic> diagnostics,
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs (3)
29foreach (var diagnostic in context.Diagnostics) 39protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 41foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnnecessarySuppressions\RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs (3)
34foreach (var diagnostic in context.Diagnostics) 45protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 54foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnusedMembers\AbstractRemoveUnusedMembersCodeFixProvider.cs (2)
41ImmutableArray<Diagnostic> diagnostics, 51foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (17)
134var diagnostic = context.Diagnostics[0]; 203private static bool IsForEachIterationVariableDiagnostic(Diagnostic diagnostic, Document document, CancellationToken cancellationToken) 214private static string GetEquivalenceKey(Diagnostic diagnostic) 233protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 239private static IEnumerable<IGrouping<SyntaxNode, Diagnostic>> GetDiagnosticsGroupedByMember( 240ImmutableArray<Diagnostic> diagnostics, 252foreach (var diagnostic in diagnostics) 264private static IEnumerable<IGrouping<SyntaxNode, Diagnostic>> GetDiagnosticsGroupedByMember( 265ImmutableArray<Diagnostic> diagnostics, 272private static async Task<Document> PreprocessDocumentAsync(Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 284protected sealed override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 295ImmutableArray<Diagnostic> diagnostics, 346IEnumerable<Diagnostic> diagnostics, 383IOrderedEnumerable<Diagnostic> diagnostics, 399foreach (var diagnostic in diagnostics) 442IOrderedEnumerable<Diagnostic> diagnostics, 675foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\SimplifyBooleanExpression\SimplifyConditionalCodeFixProvider.cs (2)
36ImmutableArray<Diagnostic> diagnostics, 58SyntaxNode SimplifyConditional(SemanticModel semanticModel, Diagnostic diagnostic, SyntaxNode expr)
src\roslyn\src\Analyzers\Core\CodeFixes\SimplifyInterpolation\AbstractSimplifyInterpolationCodeFixProvider.cs (2)
46Document document, ImmutableArray<Diagnostic> diagnostics, 60foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\SimplifyLinqExpression\SimplifyLinqExpressionCodeFixProvider.cs (2)
34ImmutableArray<Diagnostic> diagnostics, 41foreach (var diagnostic in diagnostics.OrderByDescending(diagnostics => diagnostics.Location.SourceSpan.Start))
src\roslyn\src\Analyzers\Core\CodeFixes\UpdateLegacySuppressions\UpdateLegacySuppressionsCodeFixProvider.cs (3)
30foreach (var diagnostic in context.Diagnostics) 40protected override async Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) 42foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (1)
21public abstract string SuggestedVersion(ImmutableArray<Diagnostic> diagnostics);
src\roslyn\src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (4)
87foreach (var diagnostic in context.Diagnostics) 103Solution originalSolution, Solution currentSolution, Diagnostic diagnostic, CancellationToken cancellationToken) 116Solution originalSolution, Solution currentSolution, Diagnostic diagnostic, CancellationToken cancellationToken) 392Diagnostic diagnostic,
src\roslyn\src\Analyzers\Core\CodeFixes\UseAutoProperty\UseAutoPropertyFixAllProvider.cs (1)
103foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullStatementCheckCodeFixProvider.cs (2)
33Document document, ImmutableArray<Diagnostic> diagnostics, 40foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixProvider.cs (3)
27protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 36Document document, ImmutableArray<Diagnostic> diagnostics, 47foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UseCoalesceExpression\UseCoalesceExpressionForTernaryConditionalCheckCodeFixProvider.cs (4)
28protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 37Document document, ImmutableArray<Diagnostic> diagnostics, 45foreach (var diagnostic in diagnostics) 58Diagnostic diagnostic, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\UseCollectionExpression\AbstractUseCollectionExpressionCodeFixProvider.cs (1)
27protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken)
src\roslyn\src\Analyzers\Core\CodeFixes\UseCompoundAssignment\AbstractUseCompoundAssignmentCodeFixProvider.cs (2)
50Document document, ImmutableArray<Diagnostic> diagnostics, 56foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UseConditionalExpression\AbstractUseConditionalExpressionCodeFixProvider.cs (3)
43Document document, Diagnostic diagnostic, 47Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, 59foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForAssignment\AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs (1)
58Diagnostic diagnostic,
src\roslyn\src\Analyzers\Core\CodeFixes\UseConditionalExpression\ForReturn\AbstractUseConditionalExpressionForReturnCodeFixProvider.cs (1)
45Diagnostic diagnostic,
src\roslyn\src\Analyzers\Core\CodeFixes\UseExplicitTupleName\UseExplicitTupleNameCodeFixProvider.cs (2)
32Document document, ImmutableArray<Diagnostic> diagnostics, 37foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UseInferredMemberName\AbstractUseInferredMemberNameCodeFixProvider.cs (2)
27Document document, ImmutableArray<Diagnostic> diagnostics, 32foreach (var diagnostic in diagnostics)
src\roslyn\src\Analyzers\Core\CodeFixes\UseIsNullCheck\AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs (4)
31private static bool IsSupportedDiagnostic(Diagnostic diagnostic) 36var diagnostic = context.Diagnostics.First(); 46Document document, ImmutableArray<Diagnostic> diagnostics, 54foreach (var diagnostic in diagnostics.OrderByDescending(d => d.Location.SourceSpan.Start))
src\roslyn\src\Analyzers\Core\CodeFixes\UseNullPropagation\AbstractUseNullPropagationCodeFixProvider.cs (1)
67var firstDiagnostic = context.Diagnostics.First();
src\roslyn\src\Analyzers\Core\CodeFixes\UseSystemHashCode\UseSystemHashCodeCodeFixProvider.cs (2)
34Document document, ImmutableArray<Diagnostic> diagnostics, 52foreach (var diagnostic in diagnostics)
SyncNamespaces\AbstractSyncNamespacesService.cs (13)
58private static async Task<ImmutableDictionary<Project, ImmutableArray<Diagnostic>>> GetDiagnosticsByProjectAsync( 64var builder = ImmutableDictionary.CreateBuilder<Project, ImmutableArray<Diagnostic>>(); 75private static async Task<ImmutableArray<Diagnostic>> GetDiagnosticsAsync( 98ImmutableDictionary<Project, ImmutableArray<Diagnostic>> diagnosticsByProject, 104var firstDiagnostic = diagnosticsByProject 154private static readonly Task<IEnumerable<Diagnostic>> EmptyDiagnosticResult = Task.FromResult(Enumerable.Empty<Diagnostic>()); 156private readonly ImmutableDictionary<Project, ImmutableArray<Diagnostic>> _diagnosticsByProject; 158internal DiagnosticProvider(ImmutableDictionary<Project, ImmutableArray<Diagnostic>> diagnosticsByProject) 163public override Task<IEnumerable<Diagnostic>> GetAllDiagnosticsAsync(Project project, CancellationToken cancellationToken) 168public override async Task<IEnumerable<Diagnostic>> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken) 175public override Task<IEnumerable<Diagnostic>> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken) 178? Task.FromResult<IEnumerable<Diagnostic>>(diagnostics)
Microsoft.CodeAnalysis.Razor.Compiler (17)
Analyzers\ComponentParameterNullableWarningSuppressor.cs (1)
34foreach (var diagnostic in context.ReportedDiagnostics)
SourceGenerators\Diagnostics\RazorDiagnostics.cs (2)
92public static Diagnostic AsDiagnostic(this RazorDiagnostic razorDiagnostic) 127return Diagnostic.Create(descriptor, location);
SourceGenerators\IncrementalValueProviderExtensions.cs (4)
29internal static IncrementalValuesProvider<TSource> ReportDiagnostics<TSource>(this IncrementalValuesProvider<(TSource?, Diagnostic?)> source, IncrementalGeneratorInitializationContext context) 43internal static IncrementalValueProvider<TSource> ReportDiagnostics<TSource>(this IncrementalValueProvider<(TSource?, Diagnostic?)> source, IncrementalGeneratorInitializationContext context) 57internal static IncrementalValueProvider<TSource> ReportDiagnostics<TSource>(this IncrementalValueProvider<(TSource?, ImmutableArray<Diagnostic>)> source, IncrementalGeneratorInitializationContext context) 62foreach (var diagnostic in diagnostics)
SourceGenerators\RazorSourceGenerator.cs (1)
358var csharpDiagnostic = razorDiagnostic.AsDiagnostic();
SourceGenerators\RazorSourceGenerator.RazorProviders.cs (9)
21private (RazorSourceGenerationOptions?, ImmutableArray<Diagnostic>) ComputeRazorSourceGeneratorOptions(((AnalyzerConfigOptionsProvider, ParseOptions), ImmutableArray<MetadataReference>) pair, CancellationToken ct) 33using var diagnostics = new PooledArrayBuilder<Diagnostic>(capacity: 2); 65private static RazorLanguageVersion ParseRazorLanguageVersion(AnalyzerConfigOptions globalOptions, ref PooledArrayBuilder<Diagnostic> diagnostics) 70diagnostics.Add(Diagnostic.Create( 81private static int ParseRazorWarningLevel(AnalyzerConfigOptions globalOptions, RazorLanguageVersion razorLanguageVersion, ref PooledArrayBuilder<Diagnostic> diagnostics) 101diagnostics.Add(Diagnostic.Create( 108private static (SourceGeneratorProjectItem?, Diagnostic?) ComputeProjectItems((AdditionalText, AnalyzerConfigOptionsProvider) pair, CancellationToken ct) 139var diagnostic = Diagnostic.Create(
Microsoft.CodeAnalysis.Rebuild (1)
VisualBasicCompilationFactory.cs (1)
79var diagnostic = diagnostics?.FirstOrDefault(x => x.IsUnsuppressedError);
Microsoft.CodeAnalysis.ResxSourceGenerator (23)
src\roslyn\src\Compilers\Core\Portable\Diagnostic\DiagnosticArrayExtensions.cs (1)
11internal static bool HasAnyErrors<T>(this ImmutableArray<T> diagnostics) where T : Diagnostic
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
34protected abstract Diagnostic CreateDiagnostic(IMethodSymbol containingMethod, SyntaxToken catchKeyword);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (20)
18public static Diagnostic CreateDiagnostic( 24public static Diagnostic CreateDiagnostic( 31public static Diagnostic CreateDiagnostic( 45public static Diagnostic CreateDiagnostic( 51public static Diagnostic CreateDiagnostic( 60public static Diagnostic CreateDiagnostic( 70public static Diagnostic CreateDiagnostic( 78public static Diagnostic CreateDiagnostic( 86public static Diagnostic CreateDiagnostic( 95public static Diagnostic CreateDiagnostic( 105public static Diagnostic CreateDiagnostic( 112public static Diagnostic CreateDiagnostic( 124return Diagnostic.Create( 132public static Diagnostic CreateDiagnostic( 140public static Diagnostic CreateDiagnostic( 149return Diagnostic.Create(rule, null, args); 152return Diagnostic.Create(rule, 168Action<Diagnostic> addDiagnostic, 187var diagnostic = Diagnostic.Create(rule, Location.None, properties, args);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
27Action<Diagnostic> reportDiagnostic,
Microsoft.CodeAnalysis.Scripting (8)
CompilationErrorException.cs (2)
20public ImmutableArray<Diagnostic> Diagnostics { get; } 22public CompilationErrorException(string message, ImmutableArray<Diagnostic> diagnostics)
Hosting\CommandLine\CommandLineRunner.cs (3)
130var errors = Compiler.Arguments.Errors.Concat(diagnosticsInfos.Select(Diagnostic.Create)); 376private void DisplayDiagnostics(ImmutableArray<Diagnostic> diagnostics) 389foreach (var diagnostic in ordered.Take(MaxDisplayCount))
Script.cs (3)
231public ImmutableArray<Diagnostic> Compile(CancellationToken cancellationToken = default(CancellationToken)) 234internal abstract ImmutableArray<Diagnostic> CommonCompile(CancellationToken cancellationToken); 358internal override ImmutableArray<Diagnostic> CommonCompile(CancellationToken cancellationToken)
Microsoft.CodeAnalysis.VisualBasic (133)
Binding\Binder.vb (2)
894Public Shared Sub ReportDiagnostic(diagBag As DiagnosticBag, diag As Diagnostic) 924Public Shared Sub ReportDiagnostic(diagBag As BindingDiagnosticBag, diag As Diagnostic)
Binding\Binder_Expressions.vb (1)
1106For Each diag As Diagnostic In tree.GetDiagnostics(root)
Binding\MemberSemanticModel.vb (4)
412Public NotOverridable Overrides Function GetSyntaxDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 427Public NotOverridable Overrides Function GetDeclarationDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 442Public NotOverridable Overrides Function GetMethodBodyDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 459Public NotOverridable Overrides Function GetDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic)
CommandLine\CommandLineDiagnosticFormatter.vb (2)
30Public Overrides Function Format(diagnostic As Diagnostic, Optional formatter As IFormatProvider = Nothing) As String 130Private Function GetDiagnosticSpanAndFileText(diagnostic As Diagnostic, <Out> ByRef text As SourceText) As TextSpan?
CommandLine\VisualBasicCommandLineParser.vb (25)
84Dim diagnostics As List(Of Diagnostic) = New List(Of Diagnostic)() 240Dim conditionalCompilationDiagnostics As IEnumerable(Of Diagnostic) = Nothing 1608Private Shared Function GetWin32Setting(arg As String, value As String, diagnostics As List(Of Diagnostic)) As String 1658Private Shared Sub ValidateWin32Settings(noWin32Manifest As Boolean, win32ResSetting As String, win32IconSetting As String, win32ManifestSetting As String, outputKind As OutputKind, diagnostics As List(Of Diagnostic)) 1678Private Shared Function ParseTarget(optionName As String, value As String, diagnostics As IList(Of Diagnostic)) As OutputKind 1701Friend Shared Function ParseAssemblyReferences(name As String, value As String, diagnostics As IList(Of Diagnostic), embedInteropTypes As Boolean) As IEnumerable(Of CommandLineReference) 1712Private Shared Function ParseAnalyzers(name As String, value As String, diagnostics As IList(Of Diagnostic)) As IEnumerable(Of CommandLineAnalyzerReference) 1730diagnostics As IList(Of Diagnostic), 1782Private Shared Sub AddInvalidSwitchValueDiagnostic(diagnostics As IList(Of Diagnostic), ByVal name As String, ByVal nullStringText As String) 1792Private Shared Sub ParseGlobalImports(value As String, globalImports As List(Of GlobalImport), errors As List(Of Diagnostic)) 1796Dim importDiagnostics As ImmutableArray(Of Diagnostic) = Nothing 1809diagnosticBuilder As ArrayBuilder(Of Diagnostic)) As ImmutableDictionary(Of String, InternalSyntax.CConst) 1818diagnosticBuilder.Add(Diagnostic.Create(VisualBasic.MessageProvider.Instance, ERRID.ERR_InvalidPreprocessorConstantType, symbol.Key, symbol.Value.GetType())) 1855<Out> ByRef diagnostics As IEnumerable(Of Diagnostic), 1859Dim diagnosticBuilder = ArrayBuilder(Of Diagnostic).GetInstance() 2116Private Shared Iterator Function ParseInstrumentationKinds(value As String, diagnostics As IList(Of Diagnostic)) As IEnumerable(Of InstrumentationKind) 2163Private Shared Function ParsePlatform(name As String, value As String, errors As List(Of Diagnostic)) As Platform 2197Private Shared Function ParseFileAlignment(name As String, value As String, errors As List(Of Diagnostic)) As Integer 2220Private Shared Function ParseBaseAddress(name As String, value As String, errors As List(Of Diagnostic)) As ULong 2290Private Shared Sub UnimplementedSwitch(diagnostics As IList(Of Diagnostic), switchName As String) 2294Friend Overrides Sub GenerateErrorForNoFilesFoundInRecurse(path As String, errors As IList(Of Diagnostic)) 2298Private Shared Sub AddDiagnostic(diagnostics As IList(Of Diagnostic), errorCode As ERRID, ParamArray arguments As Object()) 2299diagnostics.Add(Diagnostic.Create(VisualBasic.MessageProvider.Instance, CInt(errorCode), arguments)) 2318Private Sub GetCompilationAndModuleNames(diagnostics As List(Of Diagnostic),
CommandLine\VisualBasicCompiler.vb (1)
306Private Protected Overrides Sub DiagnoseBadAccesses(consoleOutput As TextWriter, errorLogger As ErrorLogger, compilation As Compilation, diagnostics As ImmutableArray(Of Diagnostic))
Compilation\MethodCompiler.vb (2)
679If CType(method, SourceMethodSymbol).SetDiagnostics(ImmutableArray(Of Diagnostic).Empty) Then 1249If sourceMethod IsNot Nothing AndAlso sourceMethod.SetDiagnostics(ImmutableArray(Of Diagnostic).Empty) Then
Compilation\SpeculativeSemanticModelWithMemberModel.vb (4)
137Public Overrides Function GetSyntaxDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 141Public Overrides Function GetDeclarationDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 145Public Overrides Function GetMethodBodyDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 149Public Overrides Function GetDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic)
Compilation\SpeculativeSyntaxTreeSemanticModel.vb (3)
113Public Overrides Function GetSyntaxDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 117Public Overrides Function GetDeclarationDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 121Public Overrides Function GetDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic)
Compilation\SyntaxTreeSemanticModel.vb (4)
93Public Overrides Function GetDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 105Public Overrides Function GetSyntaxDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 120Public Overrides Function GetDeclarationDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 135Public Overrides Function GetMethodBodyDiagnostics(Optional span As TextSpan? = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic)
Compilation\VisualBasicCompilation.vb (15)
122Private _lazyClsComplianceDiagnostics As ImmutableArray(Of Diagnostic) 1506Return New EntryPoint(Nothing, ImmutableArray(Of Diagnostic).Empty) 1510Dim diagnostics As ImmutableArray(Of Diagnostic) = Nothing 1518Private Function FindEntryPoint(cancellationToken As CancellationToken, ByRef sealedDiagnostics As ImmutableArray(Of Diagnostic)) As MethodSymbol 1673Public ReadOnly Diagnostics As ImmutableArray(Of Diagnostic) 1675Public Sub New(methodSymbol As MethodSymbol, diagnostics As ImmutableArray(Of Diagnostic)) 2082Public Overrides Function GetDiagnostics(Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 2091Public Overrides Function GetParseDiagnostics(Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 2101Public Overrides Function GetDeclarationDiagnostics(Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 2111Public Overrides Function GetMethodBodyDiagnostics(Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 2124Friend Overloads Function GetDiagnostics(stage As CompilationStage, Optional includeEarlierStages As Boolean = True, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 2235Private Shared Iterator Function FilterDiagnosticsByLocation(diagnostics As IEnumerable(Of Diagnostic), tree As SyntaxTree, filterSpanWithinTree As TextSpan?) As IEnumerable(Of Diagnostic) 2247Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of Diagnostic) 2291Return result.ToReadOnlyAndFree(Of Diagnostic)()
Compilation\VisualBasicDiagnosticFilter.vb (5)
13''' Applies Visual Basic-specific modification and filtering of <see cref="Diagnostic"/>s. 21''' Modifies an input <see cref="Diagnostic"/> per the given options. For example, the 22''' severity may be escalated, or the <see cref="Diagnostic"/> may be filtered out entirely 30diagnostic As Diagnostic, 34cancellationToken As CancellationToken) As Diagnostic
Errors\DiagnosticFormatter.vb (1)
27Friend Overrides Function HasDefaultHelpLinkUri(diagnostic As Diagnostic) As Boolean
Errors\ErrorFactories.vb (1)
130Return Diagnostic.CompilerDiagnosticCategory
Errors\MessageProvider.vb (2)
88Public Overrides Function CreateDiagnostic(code As Integer, location As Location, ParamArray args() As Object) As Diagnostic 92Public Overrides Function CreateDiagnostic(info As DiagnosticInfo) As Diagnostic
Errors\VBDiagnostic.vb (3)
21Friend Overrides Function WithLocation(location As Location) As Diagnostic 33Friend Overrides Function WithSeverity(severity As DiagnosticSeverity) As Diagnostic 41Friend Overrides Function WithIsSuppressed(isSuppressed As Boolean) As Diagnostic
GlobalImport.vb (5)
68Public Shared Function Parse(importedNames As String, <Out()> ByRef diagnostics As ImmutableArray(Of Diagnostic)) As GlobalImport 103Public Shared Function Parse(importedNames As IEnumerable(Of String), <Out()> ByRef diagnostics As ImmutableArray(Of Diagnostic)) As IEnumerable(Of GlobalImport) 106diagnostics = errors.ToReadOnlyAndFree(Of Diagnostic)() 111Friend Function MapDiagnostic(unmappedDiag As Diagnostic) As Diagnostic
OptionsValidator.vb (1)
41Dim syntaxErrors As IEnumerable(Of Diagnostic) = clause.GetSyntaxErrors(tree)
Symbols\Source\SourceAssemblySymbol.vb (1)
65Private _lazyAssemblyLevelDeclarationErrors As ImmutableArray(Of Diagnostic)
Symbols\Source\SourceFile.vb (1)
468Friend Function GetDeclarationErrorsInSpan(filterSpan As TextSpan, cancellationToken As CancellationToken) As IEnumerable(Of Diagnostic)
Symbols\Source\SourceMethodSymbol.vb (3)
57Private _cachedDiagnostics As ImmutableArray(Of Diagnostic) 566Friend ReadOnly Property Diagnostics As ImmutableArray(Of Diagnostic) 575Friend Function SetDiagnostics(diags As ImmutableArray(Of Diagnostic)) As Boolean
Symbols\Source\SourceModuleSymbol.vb (8)
81Private _lazyLinkedAssemblyDiagnostics As ImmutableArray(Of Diagnostic) 392For Each d As Diagnostic In diagBagForThisImport.DiagnosticBag.AsEnumerable() 586locationFilter As Func(Of IEnumerable(Of Diagnostic), SyntaxTree, TextSpan?, IEnumerable(Of Diagnostic)), 587cancellationToken As CancellationToken) As ImmutableArray(Of Diagnostic) 588Dim builder = ArrayBuilder(Of Diagnostic).GetInstance() 643For Each d As Diagnostic In declarationDiagnostics 1022For Each d As Diagnostic In diagBag.DiagnosticBag.AsEnumerableWithoutResolution()
Symbols\Source\SynthesizedMyGroupCollectionPropertyAccessorSymbol.vb (1)
80For Each diag As Diagnostic In tree.GetDiagnostics(root)
Syntax\SyntaxTreeDiagnosticEnumerator.vb (2)
31Private _current As Diagnostic 147Public ReadOnly Property Current As Diagnostic
Syntax\VisualBasicSyntaxNode.vb (10)
178Friend Shared EmptyErrorCollection As New ReadOnlyCollection(Of Diagnostic)(Array.Empty(Of Diagnostic)) 184Friend Function GetSyntaxErrors(tree As SyntaxTree) As ReadOnlyCollection(Of Diagnostic) 188Friend Shared Function DoGetSyntaxErrors(tree As SyntaxTree, nodeOrToken As SyntaxNodeOrToken) As ReadOnlyCollection(Of Diagnostic) 195Dim errorList As New List(Of Diagnostic) 222Return New ReadOnlyCollection(Of Diagnostic)(errorList) 241errorList As List(Of Diagnostic), 267Private Shared Function CreateSyntaxError(tree As SyntaxTree, nodeOrToken As SyntaxNodeOrToken, errorInfo As DiagnosticInfo) As Diagnostic 274Private Shared Function CreateSyntaxError(tree As SyntaxTree, nodeOrToken As SyntaxTrivia, errorInfo As DiagnosticInfo) As Diagnostic 461Public Shadows Function GetDiagnostics() As IEnumerable(Of Diagnostic)
Syntax\VisualBasicSyntaxTree.vb (8)
320Public Overrides Function GetDiagnostics(node As SyntaxNode) As IEnumerable(Of Diagnostic) 332Public Overrides Function GetDiagnostics(token As SyntaxToken) As IEnumerable(Of Diagnostic) 342Public Overrides Function GetDiagnostics(trivia As SyntaxTrivia) As IEnumerable(Of Diagnostic) 353Public Overrides Function GetDiagnostics(nodeOrToken As SyntaxNodeOrToken) As IEnumerable(Of Diagnostic) 363Public Overrides Function GetDiagnostics(Optional cancellationToken As CancellationToken = Nothing) As IEnumerable(Of Diagnostic) 367Friend Iterator Function EnumerateDiagnostics(node As InternalSyntax.VisualBasicSyntaxNode, position As Integer, InDocumentationComment As Boolean) As IEnumerable(Of Diagnostic) 375Friend Overloads Function GetDiagnostics(node As InternalSyntax.VisualBasicSyntaxNode, position As Integer, InDocumentationComment As Boolean) As IEnumerable(Of Diagnostic) 383Return SpecializedCollections.EmptyEnumerable(Of Diagnostic)()
VisualBasicCompilationOptions.vb (13)
1023Friend Overrides Sub ValidateOptions(builder As ArrayBuilder(Of Diagnostic)) 1031builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_VBCoreNetModuleConflict)) 1035builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_InvalidSwitchValue, NameOf(Platform), Platform.ToString())) 1043builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_InvalidSwitchValue, NameOf(OutputKind), OutputKind.ToString())) 1047builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_InvalidSwitchValue, NameOf(OptimizationLevel), OptimizationLevel.ToString())) 1051builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_InvalidSwitchValue, NameOf(ScriptClassName), If(ScriptClassName, "Nothing"))) 1055builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_InvalidSwitchValue, NameOf(MainTypeName), MainTypeName)) 1059builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_InvalidSwitchValue, NameOf(RootNamespace), RootNamespace)) 1063builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_InvalidSwitchValue, NameOf(OptionStrict), OptionStrict.ToString())) 1068builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_LibAnycpu32bitPreferredConflict, NameOf(Platform), Platform.ToString())) 1072builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_InvalidSwitchValue, NameOf(MetadataImportOptions), MetadataImportOptions.ToString())) 1133Friend Overrides Function FilterDiagnostic(diagnostic As Diagnostic, cancellationToken As CancellationToken) As Diagnostic
VisualBasicExtensions.vb (1)
280Friend Function GetSyntaxErrors(token As SyntaxToken, tree As SyntaxTree) As ReadOnlyCollection(Of Diagnostic)
VisualBasicParseOptions.vb (4)
245Friend Overrides Sub ValidateOptions(builder As ArrayBuilder(Of Diagnostic)) 250builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_BadLanguageVersion, LanguageVersion.ToString)) 256builder.Add(Diagnostic.Create(ErrorFactory.ErrorInfo(ERRID.ERR_ConditionalCompilationConstantNotValid, 264builder.Add(Diagnostic.Create(MessageProvider.Instance, ERRID.ERR_InvalidPreprocessorConstantType, symbol.Key, symbol.Value.GetType))
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (1)
src\roslyn\src\Analyzers\VisualBasic\Analyzers\RemoveUnnecessaryByVal\VisualBasicRemoveUnnecessaryByValDiagnosticAnalyzer.vb (1)
32syntaxContext.ReportDiagnostic(Diagnostic.Create(Descriptor, modifier.GetLocation(), additionalLocations:={parameterSyntax.GetLocation()}))
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (16)
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\ConvertToAsync\VisualBasicConvertToAsyncFunctionCodeFixProvider.vb (2)
39Protected Overrides Async Function GetDescriptionAsync(diagnostic As Diagnostic, node As SyntaxNode, semanticModel As SemanticModel, cancellationToken As CancellationToken) As Task(Of String) 44Protected Overrides Async Function GetRootInOtherSyntaxTreeAsync(node As SyntaxNode, semanticModel As SemanticModel, diagnostic As Diagnostic, cancellationToken As CancellationToken) As Task(Of (SyntaxTree As SyntaxTree, root As SyntaxNode)?)
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\GenerateConstructor\GenerateConstructorCodeFixProvider.vb (1)
56Protected Overrides Function IsCandidate(node As SyntaxNode, token As SyntaxToken, diagnostic As Diagnostic) As Boolean
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\GenerateEnumMember\GenerateEnumMemberCodeFixProvider.vb (1)
39Protected Overrides Function IsCandidate(node As SyntaxNode, token As SyntaxToken, diagnostic As Diagnostic) As Boolean
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\GenerateConversionCodeFixProvider.vb (1)
39Protected Overrides Function IsCandidate(node As SyntaxNode, token As SyntaxToken, diagnostic As Diagnostic) As Boolean
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\GenerateParameterizedMemberCodeFixProvider.vb (1)
58Protected Overrides Function IsCandidate(node As SyntaxNode, token As SyntaxToken, diagnostic As Diagnostic) As Boolean
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\GenerateVariable\VisualBasicGenerateVariableCodeFixProvider.vb (1)
51Protected Overrides Function IsCandidate(node As SyntaxNode, token As SyntaxToken, diagnostic As Diagnostic) As Boolean
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicChangeToYieldCodeFixProvider.vb (1)
40Protected Overrides Function GetCodeFixAsync(root As SyntaxNode, node As SyntaxNode, document As Document, diagnostics As Diagnostic, cancellationToken As CancellationToken) As Task(Of CodeAction)
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
42Protected Overrides Async Function GetCodeFixAsync(root As SyntaxNode, node As SyntaxNode, document As Document, diagnostics As Diagnostic, cancellationToken As CancellationToken) As Task(Of CodeAction)
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\MakeMethodAsynchronous\VisualBasicMakeMethodAsynchronousCodeFixProvider.vb (1)
34Protected Overrides Function IsSupportedDiagnostic(diagnostic As Diagnostic, cancellationToken As CancellationToken) As Boolean
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\QualifyMemberAccess\VisualBasicQualifyMemberAccessCodeFixProvider.vb (1)
27Protected Overrides Function GetNode(diagnostic As Diagnostic, cancellationToken As CancellationToken) As SimpleNameSyntax
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryByVal\VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb (1)
35Protected Overrides Async Function FixAllAsync(document As Document, diagnostics As ImmutableArray(Of Diagnostic), editor As SyntaxEditor, cancellationToken As CancellationToken) As Task
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb (1)
53diagnostics As ImmutableArray(Of Diagnostic),
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\SimplifyObjectCreation\VisualBasicSimplifyObjectCreationCodeFixProvider.vb (1)
34Protected Overrides Async Function FixAllAsync(document As Document, diagnostics As ImmutableArray(Of Diagnostic), editor As SyntaxEditor, cancellationToken As CancellationToken) As Task
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\UseIsNotExpression\VisualBasicUseIsNotExpressionCodeFixProvider.vb (2)
33diagnostics As ImmutableArray(Of Diagnostic), 47diagnostic As Diagnostic,
Microsoft.CodeAnalysis.VisualBasic.Features (39)
CodeFixes\GenerateType\GenerateTypeCodeFixProvider.vb (1)
47Protected Overrides Function IsCandidate(node As SyntaxNode, token As SyntaxToken, diagnostic As Diagnostic) As Boolean
CodeFixes\Suppression\VisualBasicSuppressionCodeFixProvider.vb (8)
27Protected Overrides Function CreatePragmaRestoreDirectiveTrivia(diagnostic As Diagnostic, formatNode As Func(Of SyntaxNode, CancellationToken, SyntaxNode), needsLeadingEndOfLine As Boolean, needsTrailingEndOfLine As Boolean, cancellationToken As CancellationToken) As SyntaxTriviaList 34Protected Overrides Function CreatePragmaDisableDirectiveTrivia(diagnostic As Diagnostic, formatNode As Func(Of SyntaxNode, CancellationToken, SyntaxNode), needsLeadingEndOfLine As Boolean, needsTrailingEndOfLine As Boolean, cancellationToken As CancellationToken) As SyntaxTriviaList 41Private Shared Function GetErrorCodes(diagnostic As Diagnostic, ByRef includeTitle As Boolean) As SeparatedSyntaxList(Of IdentifierNameSyntax) 53diagnostic As Diagnostic, 119diagnostic As Diagnostic, 154diagnostic As Diagnostic) As SyntaxNode 167diagnostic As Diagnostic, 176Private Shared Function CreateAttributeArguments(targetSymbol As ISymbol, diagnostic As Diagnostic, isAssemblyAttribute As Boolean) As ArgumentListSyntax
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.vb (6)
44Private _diagnostics As ImmutableArray(Of Diagnostic).Builder 54Public ReadOnly Property Diagnostics As ImmutableArray(Of Diagnostic) 56Return If(_diagnostics?.ToImmutable(), ImmutableArray(Of Diagnostic).Empty) 60Public ReadOnly Property DiagnosticsBuilder As ImmutableArray(Of Diagnostic).Builder 63Interlocked.CompareExchange(_diagnostics, ImmutableArray.CreateBuilder(Of Diagnostic)(), Nothing) 188Dim diagnostic As Diagnostic = Nothing
Diagnostics\Analyzers\VisualBasicSimplifyTypeNamesDiagnosticAnalyzer.vb (4)
37Protected Overrides Function AnalyzeCodeBlock(context As CodeBlockAnalysisContext, root As SyntaxNode) As ImmutableArray(Of Diagnostic) 45Return ImmutableArray(Of Diagnostic).Empty 53Protected Overrides Function AnalyzeSemanticModel(context As SemanticModelAnalysisContext, root As SyntaxNode, codeBlockIntervalTree As TextSpanMutableIntervalTree) As ImmutableArray(Of Diagnostic) 56Return ImmutableArray(Of Diagnostic).Empty
EditAndContinue\VisualBasicEditAndContinueAnalyzer.vb (2)
2362Protected Overrides Iterator Function GetParseOptionsRudeEdits(oldOptions As ParseOptions, newOptions As ParseOptions) As IEnumerable(Of Diagnostic) 2387Protected Overrides Iterator Function GetCompilationOptionsRudeEdits(oldOptions As CompilationOptions, newOptions As CompilationOptions) As IEnumerable(Of Diagnostic)
RemoveSharedFromModuleMembers\VisualBasicRemoveSharedFromModuleMembersCodeFixProvider.vb (1)
57Protected Overrides Function FixAllAsync(document As Document, diagnostics As ImmutableArray(Of Diagnostic), editor As SyntaxEditor, cancellationToken As CancellationToken) As Task
src\roslyn\src\Analyzers\VisualBasic\Analyzers\RemoveUnnecessaryByVal\VisualBasicRemoveUnnecessaryByValDiagnosticAnalyzer.vb (1)
32syntaxContext.ReportDiagnostic(Diagnostic.Create(Descriptor, modifier.GetLocation(), additionalLocations:={parameterSyntax.GetLocation()}))
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\ConvertToAsync\VisualBasicConvertToAsyncFunctionCodeFixProvider.vb (2)
39Protected Overrides Async Function GetDescriptionAsync(diagnostic As Diagnostic, node As SyntaxNode, semanticModel As SemanticModel, cancellationToken As CancellationToken) As Task(Of String) 44Protected Overrides Async Function GetRootInOtherSyntaxTreeAsync(node As SyntaxNode, semanticModel As SemanticModel, diagnostic As Diagnostic, cancellationToken As CancellationToken) As Task(Of (SyntaxTree As SyntaxTree, root As SyntaxNode)?)
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\GenerateConstructor\GenerateConstructorCodeFixProvider.vb (1)
56Protected Overrides Function IsCandidate(node As SyntaxNode, token As SyntaxToken, diagnostic As Diagnostic) As Boolean
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\GenerateEnumMember\GenerateEnumMemberCodeFixProvider.vb (1)
39Protected Overrides Function IsCandidate(node As SyntaxNode, token As SyntaxToken, diagnostic As Diagnostic) As Boolean
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\GenerateConversionCodeFixProvider.vb (1)
39Protected Overrides Function IsCandidate(node As SyntaxNode, token As SyntaxToken, diagnostic As Diagnostic) As Boolean
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\GenerateParameterizedMember\GenerateParameterizedMemberCodeFixProvider.vb (1)
58Protected Overrides Function IsCandidate(node As SyntaxNode, token As SyntaxToken, diagnostic As Diagnostic) As Boolean
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\GenerateVariable\VisualBasicGenerateVariableCodeFixProvider.vb (1)
51Protected Overrides Function IsCandidate(node As SyntaxNode, token As SyntaxToken, diagnostic As Diagnostic) As Boolean
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicChangeToYieldCodeFixProvider.vb (1)
40Protected Overrides Function GetCodeFixAsync(root As SyntaxNode, node As SyntaxNode, document As Document, diagnostics As Diagnostic, cancellationToken As CancellationToken) As Task(Of CodeAction)
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\Iterator\VisualBasicConvertToIteratorCodeFixProvider.vb (1)
42Protected Overrides Async Function GetCodeFixAsync(root As SyntaxNode, node As SyntaxNode, document As Document, diagnostics As Diagnostic, cancellationToken As CancellationToken) As Task(Of CodeAction)
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\MakeMethodAsynchronous\VisualBasicMakeMethodAsynchronousCodeFixProvider.vb (1)
34Protected Overrides Function IsSupportedDiagnostic(diagnostic As Diagnostic, cancellationToken As CancellationToken) As Boolean
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\QualifyMemberAccess\VisualBasicQualifyMemberAccessCodeFixProvider.vb (1)
27Protected Overrides Function GetNode(diagnostic As Diagnostic, cancellationToken As CancellationToken) As SimpleNameSyntax
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryByVal\VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb (1)
35Protected Overrides Async Function FixAllAsync(document As Document, diagnostics As ImmutableArray(Of Diagnostic), editor As SyntaxEditor, cancellationToken As CancellationToken) As Task
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\RemoveUnnecessaryCast\VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb (1)
53diagnostics As ImmutableArray(Of Diagnostic),
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\SimplifyObjectCreation\VisualBasicSimplifyObjectCreationCodeFixProvider.vb (1)
34Protected Overrides Async Function FixAllAsync(document As Document, diagnostics As ImmutableArray(Of Diagnostic), editor As SyntaxEditor, cancellationToken As CancellationToken) As Task
src\roslyn\src\Analyzers\VisualBasic\CodeFixes\UseIsNotExpression\VisualBasicUseIsNotExpressionCodeFixProvider.vb (2)
33diagnostics As ImmutableArray(Of Diagnostic), 47diagnostic As Diagnostic,
Microsoft.CodeAnalysis.VisualBasic.NetAnalyzers (2)
Microsoft.NetCore.Analyzers\Performance\BasicPreferDictionaryTryMethodsOverContainsKeyGuardFixer.vb (2)
43Private Shared Async Function GetTryGetValueActionAsync(root As SyntaxNode, diagnostic As Diagnostic, document As Document, containsKeyAccess As MemberAccessExpressionSyntax, containsKeyInvocation As InvocationExpressionSyntax, cancellationToken As CancellationToken) As Task(Of CodeAction) 183Private Shared Function GetTryAddAction(root As SyntaxNode, diagnostic As Diagnostic, document As Document, containsKeyAccess As MemberAccessExpressionSyntax, containsKeyInvocation As InvocationExpressionSyntax) As CodeAction
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
CodeCleanup\Providers\ReduceTokensCodeCleanupProvider.vb (2)
330Private Shared Function HasOverflow(diagnostics As IEnumerable(Of Diagnostic)) As Boolean 331Return diagnostics.Any(Function(diagnostic As Diagnostic) diagnostic.Id = "BC30036")
Workspace\LanguageServices\VisualBasicSyntaxTreeFactoryService.vb (1)
42Dim diagnostics As IEnumerable(Of Diagnostic) = Nothing
Microsoft.CodeAnalysis.Workspaces (171)
CodeFixes\CodeFix.cs (3)
13/// <see cref="Diagnostic"/>s that this <see cref="CodeAction"/> will fix. 24public readonly ImmutableArray<Diagnostic> Diagnostics; 26public CodeFix(CodeAction action, ImmutableArray<Diagnostic> diagnostics)
CodeFixes\CodeFixContext.cs (18)
21private readonly Action<CodeAction, ImmutableArray<Diagnostic>> _registerCodeFix; 60public ImmutableArray<Diagnostic> Diagnostics { get; } 75/// Additionally, the <see cref="Diagnostic.Id"/> of each diagnostic must be in the set of the <see cref="CodeFixProvider.FixableDiagnosticIds"/> of the associated <see cref="CodeFixProvider"/>. 88ImmutableArray<Diagnostic> diagnostics, 89Action<CodeAction, ImmutableArray<Diagnostic>> registerCodeFix, 107/// Additionally, the <see cref="Diagnostic.Id"/> of each diagnostic must be in the set of the <see cref="CodeFixProvider.FixableDiagnosticIds"/> of the associated <see cref="CodeFixProvider"/>. 119ImmutableArray<Diagnostic> diagnostics, 120Action<CodeAction, ImmutableArray<Diagnostic>> registerCodeFix, 138/// The <see cref="Diagnostic.Id"/> of this diagnostic must be in the set of the <see cref="CodeFixProvider.FixableDiagnosticIds"/> of the associated <see cref="CodeFixProvider"/>. 146Diagnostic diagnostic, 147Action<CodeAction, ImmutableArray<Diagnostic>> registerCodeFix, 163/// The <see cref="Diagnostic.Id"/> of this diagnostic must be in the set of the <see cref="CodeFixProvider.FixableDiagnosticIds"/> of the associated <see cref="CodeFixProvider"/>. 170Diagnostic diagnostic, 171Action<CodeAction, ImmutableArray<Diagnostic>> registerCodeFix, 186public void RegisterCodeFix(CodeAction action, Diagnostic diagnostic) 206public void RegisterCodeFix(CodeAction action, IEnumerable<Diagnostic> diagnostics) 221public void RegisterCodeFix(CodeAction action, ImmutableArray<Diagnostic> diagnostics) 238private static void VerifyDiagnosticsArgument(ImmutableArray<Diagnostic> diagnostics, TextSpan span)
CodeFixes\CodeFixProvider.cs (1)
31/// The context must only contain diagnostics with a <see cref="Diagnostic.Id"/> included in the <see cref="FixableDiagnosticIds"/> for the current provider.
CodeFixes\FixAllOccurrences\BatchFixAllProvider.cs (5)
86private static async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> DetermineDiagnosticsAsync(FixAllContext fixAllContext, IProgress<CodeAnalysisProgress> progressTracker) 110ImmutableDictionary<Document, ImmutableArray<Diagnostic>> documentToDiagnostics) 137FixAllContext fixAllContext, ImmutableArray<Diagnostic> orderedDiagnostics) 145foreach (var diagnostic in orderedDiagnostics) 229private static Action<CodeAction, ImmutableArray<Diagnostic>> GetRegisterCodeFixAction(
CodeFixes\FixAllOccurrences\DocumentBasedFixAllProvider.cs (3)
19/// cref="Diagnostic"/> only affect the <see cref="Document"/> the diagnostic was produced in. 25/// cref="FixAllAsync(FixAllContext, Document, ImmutableArray{Diagnostic})"/> for implementors to process. 57protected abstract Task<Document?> FixAllAsync(FixAllContext fixAllContext, Document document, ImmutableArray<Diagnostic> diagnostics);
CodeFixes\FixAllOccurrences\FixAllContext.cs (9)
222public async Task<ImmutableArray<Diagnostic>> GetDocumentDiagnosticsAsync(Document document) 238private static async Task<ImmutableArray<Diagnostic>> GetFilteredDiagnosticsAsync( 239Task<IEnumerable<Diagnostic>> getDiagnosticsTask, 259internal async Task<ImmutableArray<Diagnostic>> GetDocumentSpanDiagnosticsAsync(Document document, TextSpan filterSpan) 280public Task<ImmutableArray<Diagnostic>> GetProjectDiagnosticsAsync(Project project) 294public Task<ImmutableArray<Diagnostic>> GetAllDiagnosticsAsync(Project project) 309private async Task<ImmutableArray<Diagnostic>> GetProjectDiagnosticsAsync(Project project, bool includeAllDocumentDiagnostics) 344internal Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync() 347internal Task<ImmutableDictionary<Project, ImmutableArray<Diagnostic>>> GetProjectDiagnosticsToFixAsync()
CodeFixes\FixAllOccurrences\FixAllContext.DiagnosticProvider.cs (9)
30public abstract Task<IEnumerable<Diagnostic>> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken); 35public abstract Task<IEnumerable<Diagnostic>> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken); 41public abstract Task<IEnumerable<Diagnostic>> GetAllDiagnosticsAsync(Project project, CancellationToken cancellationToken); 43internal static async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync(FixAllContext fixAllContext) 50static async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixWorkerAsync(FixAllContext fixAllContext) 67internal static async Task<ImmutableDictionary<Project, ImmutableArray<Diagnostic>>> GetProjectDiagnosticsToFixAsync( 85return await ProducerConsumer<(Project project, ImmutableArray<Diagnostic> diagnostics)>.RunParallelAsync( 94var projectsAndDiagnostics = ImmutableDictionary.CreateBuilder<Project, ImmutableArray<Diagnostic>>(); 109return ImmutableDictionary<Project, ImmutableArray<Diagnostic>>.Empty;
CodeFixes\FixAllOccurrences\FixAllContext.SpanBasedDiagnosticProvider.cs (1)
34public abstract Task<IEnumerable<Diagnostic>> GetDocumentSpanDiagnosticsAsync(Document document, TextSpan fixAllSpan, CancellationToken cancellationToken);
CodeFixes\FixAllOccurrences\FixAllProvider.cs (7)
46/// <see cref="WellKnownFixAllProviders.BatchFixer"/> in the case where fixes for a <see cref="Diagnostic"/> 55public static FixAllProvider Create(Func<FixAllContext, Document, ImmutableArray<Diagnostic>, Task<Document?>> fixAllAsync) 61/// fixes for a <see cref="Diagnostic"/> only affect the <see cref="Document"/> the diagnostic was produced in. 75Func<FixAllContext, Document, ImmutableArray<Diagnostic>, Task<Document?>> fixAllAsync, 82Func<FixAllContext, Document, ImmutableArray<Diagnostic>, Task<Document?>> fixAllAsync, 104Func<FixAllContext, Document, ImmutableArray<Diagnostic>, Task<Document?>> fixAllAsync, 110protected override Task<Document?> FixAllAsync(FixAllContext context, Document document, ImmutableArray<Diagnostic> diagnostics)
CodeFixes\FixAllOccurrences\FixAllState.cs (4)
64ImmutableDictionary<Document, ImmutableArray<Diagnostic>> diagnosticsToFix, 86ImmutableDictionary<Project, ImmutableArray<Diagnostic>> diagnosticsToFix, 105private static ImmutableHashSet<string> GetDiagnosticsIds(IEnumerable<ImmutableArray<Diagnostic>> diagnosticsCollection) 110foreach (var diagnostic in diagnostics)
CodeFixes\FixAllOccurrences\FixAllState.FixMultipleDiagnosticProvider.cs (11)
21public ImmutableDictionary<Document, ImmutableArray<Diagnostic>> DocumentDiagnosticsMap { get; } 22public ImmutableDictionary<Project, ImmutableArray<Diagnostic>> ProjectDiagnosticsMap { get; } 24public FixMultipleDiagnosticProvider(ImmutableDictionary<Document, ImmutableArray<Diagnostic>> diagnosticsMap) 27ProjectDiagnosticsMap = ImmutableDictionary<Project, ImmutableArray<Diagnostic>>.Empty; 30public FixMultipleDiagnosticProvider(ImmutableDictionary<Project, ImmutableArray<Diagnostic>> diagnosticsMap) 33DocumentDiagnosticsMap = ImmutableDictionary<Document, ImmutableArray<Diagnostic>>.Empty; 36public override async Task<IEnumerable<Diagnostic>> GetAllDiagnosticsAsync(Project project, CancellationToken cancellationToken) 38var allDiagnosticsBuilder = ArrayBuilder<Diagnostic>.GetInstance(); 39ImmutableArray<Diagnostic> diagnostics; 59public override async Task<IEnumerable<Diagnostic>> GetDocumentDiagnosticsAsync(Document document, CancellationToken cancellationToken) 69public override async Task<IEnumerable<Diagnostic>> GetProjectDiagnosticsAsync(Project project, CancellationToken cancellationToken)
CodeFixes\Supression\IConfigurationFixProvider.cs (3)
22bool IsFixableDiagnostic(Diagnostic diagnostic); 28Task<ImmutableArray<CodeFix>> GetFixesAsync(TextDocument document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken); 34Task<ImmutableArray<CodeFix>> GetFixesAsync(Project project, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken);
CodeFixesAndRefactorings\FixAllLogger.cs (2)
155public static void LogDiagnosticsStats(int correlationId, ImmutableDictionary<Document, ImmutableArray<Diagnostic>> documentsAndDiagnosticsToFixMap) 165public static void LogDiagnosticsStats(int correlationId, ImmutableDictionary<Project, ImmutableArray<Diagnostic>> projectsAndDiagnosticsToFixMap)
CodeFixesAndRefactorings\FixAllProviderInfo.cs (5)
98public abstract bool CanBeFixed(Diagnostic diagnostic); 105public override bool CanBeFixed(Diagnostic diagnostic) 115private readonly Func<Diagnostic, bool> _canBeSuppressedOrUnsuppressed = suppressionFixer.IsFixableDiagnostic; 117public override bool CanBeFixed(Diagnostic diagnostic) 126public override bool CanBeFixed(Diagnostic diagnostic)
Diagnostics\AbstractDiagnosticPropertiesService.cs (2)
13public ImmutableDictionary<string, string> GetAdditionalProperties(Diagnostic diagnostic) 19Diagnostic diagnostic,
Diagnostics\DiagnosticAnalysisResultBuilder.cs (12)
34public void AddExternalSyntaxDiagnostics(DocumentId documentId, ImmutableArray<Diagnostic> diagnostics) 39public void AddExternalSemanticDiagnostics(DocumentId documentId, ImmutableArray<Diagnostic> diagnostics) 48ref Dictionary<DocumentId, List<DiagnosticData>>? lazyLocals, DocumentId documentId, ImmutableArray<Diagnostic> diagnostics) 50foreach (var diagnostic in diagnostics) 93private static void AddDocumentDiagnostic(ref Dictionary<DocumentId, List<DiagnosticData>>? map, TextDocument document, Diagnostic diagnostic) 108public void AddSyntaxDiagnostics(SyntaxTree tree, ImmutableArray<Diagnostic> diagnostics) 111public void AddDiagnosticTreatedAsLocalSemantic(Diagnostic diagnostic) 114public void AddSemanticDiagnostics(SyntaxTree tree, ImmutableArray<Diagnostic> diagnostics) 117public void AddCompilationDiagnostics(ImmutableArray<Diagnostic> diagnostics) 127ref Dictionary<DocumentId, List<DiagnosticData>>? lazyLocals, SyntaxTree? tree, Diagnostic diagnostic) 180ref Dictionary<DocumentId, List<DiagnosticData>>? lazyLocals, SyntaxTree? tree, ImmutableArray<Diagnostic> diagnostics) 182foreach (var diagnostic in diagnostics)
Diagnostics\DiagnosticData.cs (10)
156public async Task<Diagnostic> ToDiagnosticAsync(Project project, CancellationToken cancellationToken) 164public Diagnostic ToDiagnostic(Location location, ImmutableArray<Location> additionalLocations) 166return Diagnostic.Create( 207public static DiagnosticData? Create(Diagnostic? diagnostic, Project project) 228public static DiagnosticData Create(Diagnostic diagnostic, TextDocument document) 255Diagnostic diagnostic, 282private static ImmutableDictionary<string, string?>? GetAdditionalProperties(TextDocument document, Diagnostic diagnostic) 288private static ImmutableArray<DiagnosticDataLocation> GetAdditionalLocations(TextDocument document, Diagnostic diagnostic) 350var diagnostic = Diagnostic.Create(descriptor, Location.None, effectiveSeverity, additionalLocations: null, properties: null, messageArgs: messageArguments);
Diagnostics\DocumentDiagnosticAnalyzer.cs (2)
19public virtual async Task<ImmutableArray<Diagnostic>> AnalyzeSyntaxAsync(TextDocument textDocument, SyntaxTree? tree, CancellationToken cancellationToken) 22public virtual async Task<ImmutableArray<Diagnostic>> AnalyzeSemanticsAsync(TextDocument textDocument, SyntaxTree? tree, CancellationToken cancellationToken)
Diagnostics\Extensions.cs (12)
28public static async Task<ImmutableArray<Diagnostic>> ToDiagnosticsAsync(this IEnumerable<DiagnosticData> diagnostics, Project project, CancellationToken cancellationToken) 30var result = ArrayBuilder<Diagnostic>.GetInstance(); 107ImmutableArray<Diagnostic> additionalPragmaSuppressionDiagnostics, 156ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>>? diagnosticsByAnalyzerMap; 247ImmutableDictionary<DiagnosticAnalyzer, ImmutableArray<Diagnostic>> diagnosticsByAnalyzer, 263ImmutableArray<Diagnostic> diagnostics, 310public static ImmutableArray<Diagnostic> Filter( 311this ImmutableArray<Diagnostic> diagnostics, 412public static async Task<ImmutableArray<Diagnostic>> GetSourceGeneratorDiagnosticsAsync(Project project, CancellationToken cancellationToken) 432public static ImmutableArray<DiagnosticData> ConvertToLocalDiagnostics(ImmutableArray<Diagnostic> diagnostics, TextDocument targetTextDocument, TextSpan? span = null) 435foreach (var diagnostic in diagnostics) 449public static bool IsReportedInDocument(Diagnostic diagnostic, TextDocument targetTextDocument)
Diagnostics\FileContentLoadAnalyzer.cs (2)
28public override async Task<ImmutableArray<Diagnostic>> AnalyzeSyntaxAsync( 42return [Diagnostic.Create(
Diagnostics\GeneratorDiagnosticsPlaceholderAnalyzer.cs (3)
28public override async Task<ImmutableArray<Diagnostic>> AnalyzeSemanticsAsync(TextDocument textDocument, SyntaxTree? tree, CancellationToken cancellationToken) 33using var _ = ArrayBuilder<Diagnostic>.GetInstance(out var result); 35foreach (var diagnostic in diagnostics)
Diagnostics\IDiagnosticPropertiesService.cs (1)
12ImmutableDictionary<string, string> GetAdditionalProperties(Diagnostic diagnostic);
Log\WorkspaceStructureLogger.cs (3)
92foreach (var diagnostic in await project.GetSourceGeneratorDiagnosticsAsync(cancellationToken).ConfigureAwait(false)) 183foreach (var diagnostic in compilation.GetDiagnostics(cancellationToken)) 189private static XElement CreateElementForDiagnostic(Diagnostic diagnostic)
Shared\Extensions\TelemetryExtensions.cs (1)
53public static string GetTelemetryDiagnosticID(this Diagnostic diagnostic)
src\roslyn\src\Compilers\Core\Portable\Diagnostic\DiagnosticArrayExtensions.cs (1)
11internal static bool HasAnyErrors<T>(this ImmutableArray<T> diagnostics) where T : Diagnostic
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
27Action<Diagnostic> reportDiagnostic,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\CodeFixContextExtensions.cs (2)
16internal static void RegisterFixes(this CodeFixContext context, IEnumerable<CodeAction> actions, Diagnostic diagnostic) 27internal static void RegisterFixes(this CodeFixContext context, IEnumerable<CodeAction> actions, ImmutableArray<Diagnostic> diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (11)
22public static async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync( 27var allDiagnostics = ImmutableArray<Diagnostic>.Empty; 41return ImmutableDictionary<Document, ImmutableArray<Diagnostic>>.Empty.SetItem(document, documentDiagnostics); 80allDiagnostics = await ProducerConsumer<ImmutableArray<Diagnostic>>.RunParallelAsync( 90using var _2 = ArrayBuilder<Diagnostic>.GetInstance(out var builder); 106return ImmutableDictionary<Document, ImmutableArray<Diagnostic>>.Empty; 113static async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetSpanDiagnosticsAsync( 117var builder = PooledDictionary<Document, ArrayBuilder<Diagnostic>>.GetInstance(); 132private static async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync( 134ImmutableArray<Diagnostic> diagnostics, 137var builder = ImmutableDictionary.CreateBuilder<Document, ImmutableArray<Diagnostic>>();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (7)
33/// cref="Diagnostic.Properties"/> for that diagnostic. The diagnostic itself is not passed along as it was 34/// computed with respect to the original user document, and as such its <see cref="Diagnostic.Location"/> and <see 35/// cref="Diagnostic.AdditionalLocations"/> will not be correct. 44protected sealed override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 56ImmutableArray<Diagnostic> diagnostics, 62using var _ = ArrayBuilder<(TDiagnosticNode diagnosticNode, Diagnostic diagnostic)>.GetInstance(out var originalNodes); 63foreach (var diagnostic in diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\MultiProjectSafeFixAllProvider.cs (1)
110static IEnumerable<TextSpan> GetDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (9)
57protected void RegisterCodeFix(CodeFixContext context, string title, string equivalenceKey, Diagnostic? diagnostic = null) 60protected void RegisterCodeFix(CodeFixContext context, string title, string equivalenceKey, CodeActionPriority priority, Diagnostic? diagnostic = null) 63protected Func<CancellationToken, Task<Document>> GetDocumentUpdater(CodeFixContext context, Diagnostic? diagnostic = null) 70Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 98Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken); 105/// <para/> This overload differs from <see cref="IncludeDiagnosticDuringFixAll(Diagnostic)"/> in that it also 111protected virtual bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 122/// cref="IncludeDiagnosticDuringFixAll(Diagnostic, Document, string, CancellationToken)"/> should be overridden 127protected virtual bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
184public static async Task<ImmutableArray<Diagnostic>> GetErrorsAsync(this Document document, CancellationToken cancellationToken, IList<string>? ignoreErrorCode = null)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
32public static string? TryGetAnalyzerConfigPathForDiagnosticConfiguration(this Project project, Diagnostic diagnostic) 38private static string? TryGetAnalyzerConfigPathForProjectOrDiagnosticConfiguration(Project project, Diagnostic? diagnostic)
Workspace\Solution\Project.cs (1)
392internal ValueTask<ImmutableArray<Diagnostic>> GetSourceGeneratorDiagnosticsAsync(CancellationToken cancellationToken)
Workspace\Solution\SolutionCompilationState.cs (1)
1261public ValueTask<ImmutableArray<Diagnostic>> GetSourceGeneratorDiagnosticsAsync(
Workspace\Solution\SolutionCompilationState.ICompilationTracker.cs (1)
68ValueTask<ImmutableArray<Diagnostic>> GetSourceGeneratorDiagnosticsAsync(SolutionCompilationState compilationState, CancellationToken cancellationToken);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (2)
877public async ValueTask<ImmutableArray<Diagnostic>> GetSourceGeneratorDiagnosticsAsync( 892using var _ = ArrayBuilder<Diagnostic>.GetInstance(capacity: driverRunResult.Diagnostics.Length, out var builder);
Workspace\Solution\SolutionCompilationState.SkeletonReferenceCache.cs (1)
272foreach (var diagnostic in emitResult.Diagnostics)
Workspace\Solution\SolutionCompilationState.WithFrozenSourceGeneratedDocumentsCompilationTracker.cs (1)
215public ValueTask<ImmutableArray<Diagnostic>> GetSourceGeneratorDiagnosticsAsync(
Microsoft.DotNet.ApiSymbolExtensions (1)
AssemblySymbolLoader.cs (1)
492foreach (Diagnostic warning in diagnostics)
Microsoft.DotNet.CodeAnalysis (7)
Analyzers\AppContextDefaultsAnalyzer.cs (4)
76context.ReportDiagnostic(Diagnostic.Create(s_appContextDefaultNotInitializedToTrueDiagnostic, args.GetLocation(), call)); 83context.ReportDiagnostic(Diagnostic.Create(s_appContextDefaultValueDefinedOutsideIfConditionDiagnostic, args.GetLocation(), call)); 91context.ReportDiagnostic(Diagnostic.Create(s_appContextDefaultValueDefinedOutsideIfConditionDiagnostic, args.GetLocation(), call)); 98context.ReportDiagnostic(Diagnostic.Create(s_appContextDefaultUsedUnexpectedIfStatementDiagnostic, containingIfStatement.GetLocation()));
Analyzers\MembersMustExistAnalyzer.cs (1)
39context.ReportDiagnostic(Diagnostic.Create(s_memberMustExistDiagnostic, Location.None, missingAPI));
Analyzers\PinvokeAnalyzer.cs (1)
163context.ReportDiagnostic(Diagnostic.Create(InvalidPinvokeCall, synref.GetSyntax().GetLocation(), data.ModuleName + "!" + (data.EntryPointName ?? methodSymbol.Name), altMsg));
Analyzers\ResourceUsageAnalyzer.cs (1)
53context.ReportDiagnostic(Diagnostic.Create(InvalidSRFormatCall, invokeExpr.GetLocation(), invokeExpr.GetText()));
Microsoft.DotNet.HotReload.Utils.Generator (1)
DeltaProject.cs (1)
100foreach (var diag in updates.PersistentDiagnostics) {
Microsoft.DotNet.HotReload.Watch (4)
HotReload\CompilationHandler.cs (4)
569foreach (var diagnostic in updates.PersistentDiagnostics) 617foreach (var diagnostic in diagnostics) 632void ReportDiagnostic(Diagnostic diagnostic, string projectDisplayPrefix, string autoPrefix) 655static MessageDescriptor<string> GetMessageDescriptor(Diagnostic diagnostic)
Microsoft.Extensions.Logging.Generators (15)
LoggerMessageGenerator.Parser.cs (5)
39private readonly Action<Diagnostic>? _reportDiagnostic; 41public List<Diagnostic> Diagnostics { get; } = new(); 50Action<Diagnostic>? reportDiagnostic, 814Diagnostic diagnostic = Diagnostic.Create(desc, location, messageArgs);
LoggerMessageGenerator.Roslyn4.0.cs (10)
28IncrementalValuesProvider<(LoggerClassSpec? LoggerClassSpec, ImmutableArray<Diagnostic> Diagnostics, bool HasStringCreate)> loggerClasses = context.SyntaxProvider 69var diagnostics = ImmutableArray.Create(Diagnostic.Create(DiagnosticDescriptors.MissingRequiredType, null, new object?[] { "System.Exception" })); 106IncrementalValueProvider<(ImmutableEquatableArray<(LoggerClassSpec LoggerClassSpec, bool HasStringCreate)> Specs, ImmutableArray<Diagnostic> Diagnostics)> collected = 110ImmutableArray<Diagnostic>.Builder? diagnostics = null; 119foreach (Diagnostic diagnostic in item.Diagnostics) 123(diagnostics ??= ImmutableArray.CreateBuilder<Diagnostic>()).Add(diagnostic); 130diagnostics?.ToImmutable() ?? ImmutableArray<Diagnostic>.Empty); 147IncrementalValueProvider<ImmutableArray<Diagnostic>> diagnosticResults = 153private static void EmitDiagnostics(SourceProductionContext context, ImmutableArray<Diagnostic> diagnostics) 155foreach (Diagnostic diagnostic in diagnostics)
Microsoft.Extensions.Options.SourceGeneration (4)
Parser.cs (4)
26private readonly Action<Diagnostic> _reportDiagnostic; 34Action<Diagnostic> reportDiagnostic, 866_reportDiagnostic(Diagnostic.Create(desc, location, Array.Empty<object?>())); 869_reportDiagnostic(Diagnostic.Create(desc, location, messageArgs));
Microsoft.Gen.BuildMetadata.Unit.Tests (22)
GeneratorTests.cs (2)
79private static async Task<(IReadOnlyList<Diagnostic> diagnostics, IReadOnlyList<GeneratedSourceResult> sources)> RunGenerator( 118private static bool IsExpectedCompilationError(Diagnostic diagnostic)
test\Generators\Shared\RoslynTestUtils.cs (20)
134public static void AssertDiagnostic(this string text, int spanNum, DiagnosticDescriptor expected, Diagnostic actual) 151public static void AssertDiagnostics(this string text, DiagnosticDescriptor expected, IEnumerable<Diagnostic> actual) 154foreach (var d in actual) 184public static IReadOnlyList<Diagnostic> FilterDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 186var filtered = new List<Diagnostic>(); 187foreach (Diagnostic diagnostic in diagnostics) 202public static IReadOnlyList<Diagnostic> FilterOutDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 204var filtered = new List<Diagnostic>(); 205foreach (Diagnostic diagnostic in diagnostics) 229public static (IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources) RunGenerator( 244public static Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 258public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 288public static Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 301public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 392public static async Task<IReadOnlyList<Diagnostic>> RunAnalyzer( 414private static IReadOnlyList<Diagnostic> Sort(ImmutableArray<Diagnostic> diags) 482foreach (var d in diags)
Microsoft.Gen.ComplianceReports (1)
ComplianceReportsGenerator.cs (1)
101context.ReportDiagnostic(Diagnostic.Create(diagnostic, location: null));
Microsoft.Gen.ComplianceReports.Unit.Tests (22)
GeneratorTests.cs (2)
132var diag = Assert.Single(diags); 164private static async Task<IReadOnlyList<Diagnostic>> RunGenerator(string code, string? outputFile = null, Dictionary<string, string>? options = null)
test\Generators\Shared\RoslynTestUtils.cs (20)
134public static void AssertDiagnostic(this string text, int spanNum, DiagnosticDescriptor expected, Diagnostic actual) 151public static void AssertDiagnostics(this string text, DiagnosticDescriptor expected, IEnumerable<Diagnostic> actual) 154foreach (var d in actual) 184public static IReadOnlyList<Diagnostic> FilterDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 186var filtered = new List<Diagnostic>(); 187foreach (Diagnostic diagnostic in diagnostics) 202public static IReadOnlyList<Diagnostic> FilterOutDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 204var filtered = new List<Diagnostic>(); 205foreach (Diagnostic diagnostic in diagnostics) 229public static (IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources) RunGenerator( 244public static Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 258public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 288public static Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 301public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 392public static async Task<IReadOnlyList<Diagnostic>> RunAnalyzer( 414private static IReadOnlyList<Diagnostic> Sort(ImmutableArray<Diagnostic> diags) 482foreach (var d in diags)
Microsoft.Gen.ContextualOptions (5)
Model\OptionsContextType.cs (1)
13public readonly List<Diagnostic> Diagnostics = [];
Parser.cs (4)
32.Select(modifier => Diagnostic.Create(DiagDescriptors.ContextCannotBeStatic, modifier.GetLocation(), type.Name))); 46.Select(modifier => Diagnostic.Create(DiagDescriptors.ContextCannotBeRefLike, modifier.GetLocation(), type.Name))); 57type.Definitions.Select(def => Diagnostic.Create(DiagDescriptors.ContextMustBePartial, def.Identifier.GetLocation(), type.Name))); 68type.Definitions.Select(def => Diagnostic.Create(DiagDescriptors.ContextDoesNotHaveValidProperties, def.Identifier.GetLocation(), type.Name)));
Microsoft.Gen.ContextualOptions.Unit.Tests (20)
test\Generators\Shared\RoslynTestUtils.cs (20)
134public static void AssertDiagnostic(this string text, int spanNum, DiagnosticDescriptor expected, Diagnostic actual) 151public static void AssertDiagnostics(this string text, DiagnosticDescriptor expected, IEnumerable<Diagnostic> actual) 154foreach (var d in actual) 184public static IReadOnlyList<Diagnostic> FilterDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 186var filtered = new List<Diagnostic>(); 187foreach (Diagnostic diagnostic in diagnostics) 202public static IReadOnlyList<Diagnostic> FilterOutDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 204var filtered = new List<Diagnostic>(); 205foreach (Diagnostic diagnostic in diagnostics) 229public static (IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources) RunGenerator( 244public static Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 258public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 288public static Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 301public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 392public static async Task<IReadOnlyList<Diagnostic>> RunAnalyzer( 414private static IReadOnlyList<Diagnostic> Sort(ImmutableArray<Diagnostic> diags) 482foreach (var d in diags)
Microsoft.Gen.Logging (4)
Parsing\Parser.cs (4)
21private readonly Action<Diagnostic> _reportDiagnostic; 24public Parser(Compilation compilation, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken) 746var d = Diagnostic.Create(desc, location, messageArgs);
Microsoft.Gen.Logging.Unit.Tests (26)
AttributeParserTests.cs (1)
225private static async Task<IReadOnlyList<Diagnostic>> RunGenerator(string code)
LogParserUtilitiesTests.cs (4)
71var diagMock = new Mock<Action<Diagnostic>>(); 119var diagMock = new Mock<Action<Diagnostic>>(); 186var diagMock = new Mock<Action<Diagnostic>>(); 197diagMock.Verify(x => x.Invoke(It.Is<Diagnostic>(d => d.Id == DiagDescriptors.LogPropertiesParameterSkipped.Id)), Times.Once);
ParserTests.cs (1)
675(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources) =
test\Generators\Shared\RoslynTestUtils.cs (20)
134public static void AssertDiagnostic(this string text, int spanNum, DiagnosticDescriptor expected, Diagnostic actual) 151public static void AssertDiagnostics(this string text, DiagnosticDescriptor expected, IEnumerable<Diagnostic> actual) 154foreach (var d in actual) 184public static IReadOnlyList<Diagnostic> FilterDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 186var filtered = new List<Diagnostic>(); 187foreach (Diagnostic diagnostic in diagnostics) 202public static IReadOnlyList<Diagnostic> FilterOutDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 204var filtered = new List<Diagnostic>(); 205foreach (Diagnostic diagnostic in diagnostics) 229public static (IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources) RunGenerator( 244public static Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 258public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 288public static Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 301public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 392public static async Task<IReadOnlyList<Diagnostic>> RunAnalyzer( 414private static IReadOnlyList<Diagnostic> Sort(ImmutableArray<Diagnostic> diags) 482foreach (var d in diags)
Microsoft.Gen.MetadataExtractor (7)
MetadataReportsGenerator.cs (1)
90context.ReportDiagnostic(Diagnostic.Create(diagnostic, location: null));
src\Generators\Microsoft.Gen.ComplianceReports\ComplianceReportsGenerator.cs (1)
101context.ReportDiagnostic(Diagnostic.Create(diagnostic, location: null));
src\Generators\Microsoft.Gen.Metrics\Parser.cs (4)
48private readonly Action<Diagnostic> _reportDiagnostic; 51public Parser(Compilation compilation, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken) 603_reportDiagnostic(Diagnostic.Create(desc, location, Array.Empty<object?>())); 608_reportDiagnostic(Diagnostic.Create(desc, location, messageArgs));
src\Generators\Microsoft.Gen.MetricsReports\MetricsReportsGenerator.cs (1)
64context.ReportDiagnostic(Diagnostic.Create(diagnostic, location: null));
Microsoft.Gen.MetadataExtractor.Unit.Tests (22)
GeneratorTests.cs (2)
157var diag = Assert.Single(diags); 199private static async Task<IReadOnlyList<Diagnostic>> RunGenerator(
test\Generators\Shared\RoslynTestUtils.cs (20)
134public static void AssertDiagnostic(this string text, int spanNum, DiagnosticDescriptor expected, Diagnostic actual) 151public static void AssertDiagnostics(this string text, DiagnosticDescriptor expected, IEnumerable<Diagnostic> actual) 154foreach (var d in actual) 184public static IReadOnlyList<Diagnostic> FilterDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 186var filtered = new List<Diagnostic>(); 187foreach (Diagnostic diagnostic in diagnostics) 202public static IReadOnlyList<Diagnostic> FilterOutDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 204var filtered = new List<Diagnostic>(); 205foreach (Diagnostic diagnostic in diagnostics) 229public static (IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources) RunGenerator( 244public static Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 258public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 288public static Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 301public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 392public static async Task<IReadOnlyList<Diagnostic>> RunAnalyzer( 414private static IReadOnlyList<Diagnostic> Sort(ImmutableArray<Diagnostic> diags) 482foreach (var d in diags)
Microsoft.Gen.Metrics (4)
Parser.cs (4)
48private readonly Action<Diagnostic> _reportDiagnostic; 51public Parser(Compilation compilation, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken) 603_reportDiagnostic(Diagnostic.Create(desc, location, Array.Empty<object?>())); 608_reportDiagnostic(Diagnostic.Create(desc, location, messageArgs));
Microsoft.Gen.Metrics.Unit.Tests (42)
ParserTests.cs (7)
405var diag = Assert.Single(d); 419var diag = Assert.Single(d); 748private static async Task<IReadOnlyList<Diagnostic>> RunGenerator( 832var diag = Assert.Single(d); 858var diag = Assert.Single(d); 890var diag = Assert.Single(d); 921var diag = Assert.Single(d);
ParserTests.Diagnostics.cs (15)
33var diag = Assert.Single(d); 63var diag = Assert.Single(d); 94var diag = Assert.Single(d); 401var diag = Assert.Single(d); 425var diag = Assert.Single(d); 442var diag = Assert.Single(d); 459var diag = Assert.Single(d); 482var diag = Assert.Single(d); 496var diag = Assert.Single(d); 510var diag = Assert.Single(d); 524var diag = Assert.Single(d); 538var diag = Assert.Single(d); 564var diag = Assert.Single(d); 589var diag = Assert.Single(d); 612var diag = Assert.Single(d);
test\Generators\Shared\RoslynTestUtils.cs (20)
134public static void AssertDiagnostic(this string text, int spanNum, DiagnosticDescriptor expected, Diagnostic actual) 151public static void AssertDiagnostics(this string text, DiagnosticDescriptor expected, IEnumerable<Diagnostic> actual) 154foreach (var d in actual) 184public static IReadOnlyList<Diagnostic> FilterDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 186var filtered = new List<Diagnostic>(); 187foreach (Diagnostic diagnostic in diagnostics) 202public static IReadOnlyList<Diagnostic> FilterOutDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 204var filtered = new List<Diagnostic>(); 205foreach (Diagnostic diagnostic in diagnostics) 229public static (IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources) RunGenerator( 244public static Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 258public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 288public static Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 301public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 392public static async Task<IReadOnlyList<Diagnostic>> RunAnalyzer( 414private static IReadOnlyList<Diagnostic> Sort(ImmutableArray<Diagnostic> diags) 482foreach (var d in diags)
Microsoft.Gen.MetricsReports (5)
MetricsReportsGenerator.cs (1)
64context.ReportDiagnostic(Diagnostic.Create(diagnostic, location: null));
src\Generators\Microsoft.Gen.Metrics\Parser.cs (4)
48private readonly Action<Diagnostic> _reportDiagnostic; 51public Parser(Compilation compilation, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken) 603_reportDiagnostic(Diagnostic.Create(desc, location, Array.Empty<object?>())); 608_reportDiagnostic(Diagnostic.Create(desc, location, messageArgs));
Microsoft.Gen.MetricsReports.Unit.Tests (22)
GeneratorTests.cs (2)
113var diag = Assert.Single(diags); 145private static async Task<IReadOnlyList<Diagnostic>> RunGenerator(
test\Generators\Shared\RoslynTestUtils.cs (20)
134public static void AssertDiagnostic(this string text, int spanNum, DiagnosticDescriptor expected, Diagnostic actual) 151public static void AssertDiagnostics(this string text, DiagnosticDescriptor expected, IEnumerable<Diagnostic> actual) 154foreach (var d in actual) 184public static IReadOnlyList<Diagnostic> FilterDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 186var filtered = new List<Diagnostic>(); 187foreach (Diagnostic diagnostic in diagnostics) 202public static IReadOnlyList<Diagnostic> FilterOutDiagnostics(this IEnumerable<Diagnostic> diagnostics, params DiagnosticDescriptor[] filter) 204var filtered = new List<Diagnostic>(); 205foreach (Diagnostic diagnostic in diagnostics) 229public static (IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources) RunGenerator( 244public static Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 258public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 288public static Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 301public static async Task<(IReadOnlyList<Diagnostic> diagnostics, ImmutableArray<GeneratedSourceResult> generatedSources)> RunGenerator( 392public static async Task<IReadOnlyList<Diagnostic>> RunAnalyzer( 414private static IReadOnlyList<Diagnostic> Sort(ImmutableArray<Diagnostic> diags) 482foreach (var d in diags)
Microsoft.Interop.ComInterfaceGenerator (20)
Analyzers\AddGeneratedComClassFixer.cs (1)
86protected override ImmutableDictionary<string, Option> ParseOptionsFromDiagnostic(Diagnostic diagnostic)
Analyzers\AddMarshalAsToElementFixer.cs (1)
32foreach (var diagnostic in context.Diagnostics)
Analyzers\ComClassGeneratorDiagnosticsAnalyzer.cs (5)
57foreach (Diagnostic diagnostic in GetDiagnosticsForAnnotatedClass(classToAnalyze, unsafeCodeIsEnabled, generatedComInterfaceAttributeType)) 63public static IEnumerable<Diagnostic> GetDiagnosticsForAnnotatedClass(INamedTypeSymbol annotatedClass, bool unsafeCodeIsEnabled, INamedTypeSymbol? generatedComInterfaceAttributeType) 70yield return Diagnostic.Create(GeneratorDiagnostics.RequiresAllowUnsafeBlocks, location); 78yield return Diagnostic.Create( 101yield return Diagnostic.Create(
Analyzers\ConvertComImportToGeneratedComInterfaceFixer.cs (1)
47protected override ImmutableDictionary<string, Option> ParseOptionsFromDiagnostic(Diagnostic diagnostic)
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (4)
120Diagnostic.Create( 161Diagnostic.Create( 181Diagnostic.Create( 191Diagnostic.Create(
src\runtime\src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (5)
97protected abstract ImmutableDictionary<string, Option> ParseOptionsFromDiagnostic(Diagnostic diagnostic); 101private ImmutableDictionary<string, Option> GetOptionsForIndividualFix(ImmutableDictionary<string, Option> fixAllOptions, Diagnostic diagnostic) 127foreach (Diagnostic diagnostic in context.Diagnostics) 174ImmutableArray<Diagnostic> diagnosticsInScope = await fixAllContext.GetDiagnosticsInScopeAsync().ConfigureAwait(false); 183foreach (var diagnostic in diagnosticsInScope)
src\runtime\src\libraries\System.Runtime.InteropServices\gen\Common\FixAllContextExtensions.cs (3)
15public static async Task<ImmutableArray<Diagnostic>> GetDiagnosticsInScopeAsync(this FixAllContext context) 44return ImmutableArray<Diagnostic>.Empty; 61ImmutableArray<Diagnostic> diagnostics = await context.GetAllDiagnosticsAsync(project).ConfigureAwait(false);
Microsoft.Interop.LibraryImportGenerator (21)
Analyzers\AddDisableRuntimeMarshallingAttributeFixer.cs (2)
32List<Diagnostic> fixedDiagnostics = new(context.Diagnostics.Where(IsRequiresDiableRuntimeMarshallingDiagnostic)); 46static bool IsRequiresDiableRuntimeMarshallingDiagnostic(Diagnostic diagnostic)
Analyzers\ConvertToLibraryImportFixer.cs (1)
56protected override ImmutableDictionary<string, Option> ParseOptionsFromDiagnostic(Diagnostic diagnostic)
Analyzers\CustomMarshallerAttributeFixer.cs (7)
31ImmutableArray<Diagnostic> diagnostics = await GetAllDiagnosticsInScope(fixAllContext).ConfigureAwait(false); 34foreach (Diagnostic diagnostic in diagnostics) 87private static async Task<ImmutableArray<Diagnostic>> GetAllDiagnosticsInScope(FixAllContext context) 130private static (HashSet<string> missingMembers, List<Diagnostic> fixedDiagnostics) GetRequiredShapeMissingMemberNames(IEnumerable<Diagnostic> diagnostics) 133List<Diagnostic> requiredShapeDiagnostics = new(); 134foreach (var diagnostic in diagnostics)
Analyzers\DiagnosticReporter.cs (1)
19public static DiagnosticReporter CreateForLocation(Location location, Action<Diagnostic> reportDiagnostic) => new((descriptor, properties, args) => reportDiagnostic(location.CreateDiagnosticInfo(descriptor, properties, args).ToDiagnostic()));
Analyzers\ShapeBreakingDiagnosticSuppressor.cs (2)
24foreach (var diagnostic in context.ReportedDiagnostics) 33private static void SuppressMarkMethodsAsStaticDiagnosticIfNeeded(SuppressionAnalysisContext context, Diagnostic diagnostic)
src\runtime\src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (5)
97protected abstract ImmutableDictionary<string, Option> ParseOptionsFromDiagnostic(Diagnostic diagnostic); 101private ImmutableDictionary<string, Option> GetOptionsForIndividualFix(ImmutableDictionary<string, Option> fixAllOptions, Diagnostic diagnostic) 127foreach (Diagnostic diagnostic in context.Diagnostics) 174ImmutableArray<Diagnostic> diagnosticsInScope = await fixAllContext.GetDiagnosticsInScopeAsync().ConfigureAwait(false); 183foreach (var diagnostic in diagnosticsInScope)
src\runtime\src\libraries\System.Runtime.InteropServices\gen\Common\FixAllContextExtensions.cs (3)
15public static async Task<ImmutableArray<Diagnostic>> GetDiagnosticsInScopeAsync(this FixAllContext context) 44return ImmutableArray<Diagnostic>.Empty; 61ImmutableArray<Diagnostic> diagnostics = await context.GetAllDiagnosticsAsync(project).ConfigureAwait(false);
Microsoft.Interop.SourceGeneration (14)
DiagnosticExtensions.cs (12)
12public static Diagnostic CreateDiagnostic( 20public static Diagnostic CreateDiagnostic( 29public static Diagnostic CreateDiagnostic( 42public static Diagnostic CreateDiagnostic( 56public static Diagnostic CreateDiagnostic( 64public static Diagnostic CreateDiagnostic( 88Diagnostic.Create(descriptor, Location.None, properties: properties, args) : 89Diagnostic.Create(descriptor, firstLocation, additionalLocations: additionalLocations, properties: properties, messageArgs: args); 92public static Diagnostic CreateDiagnostic( 97return Diagnostic.Create( 103public static Diagnostic CreateDiagnostic( 109return Diagnostic.Create(
DiagnosticInfo.cs (2)
19public Diagnostic ToDiagnostic() => Diagnostic.Create(
Microsoft.Maui.Controls.BindingSourceGen (1)
BindingSourceGenerator.cs (1)
28 spc.ReportDiagnostic(Diagnostic.Create(diagnostic.Descriptor, diagnostic.Location?.ToLocation()));
Microsoft.Maui.Controls.SourceGen (1)
CodeBehindGenerator.cs (1)
272 context.ReportDiagnostic(Diagnostic.Create(Descriptors.XamlParserError, location, xamlItem.Exception.Message));
Microsoft.ML.CodeAnalyzer.Tests (1)
Code\RelaxTestNamingTest.cs (1)
133context.ReportDiagnostic(Diagnostic.Create(Rule, method.Locations[0]));
Microsoft.ML.InternalCodeAnalyzer (23)
BaseTestClassAnalyzer.cs (1)
78context.ReportDiagnostic(Diagnostic.Create(Rule, namedType.Locations[0], namedType));
BestFriendAnalyzer.cs (2)
110var diagnostic = Diagnostic.Create(Rule, node.GetLocation(), symbol.Name);
BestFriendOnPublicDeclarationsAnalyzer.cs (2)
66var diagnostic = Diagnostic.Create(Rule, attribute.ApplicationSyntaxReference.GetSyntax().GetLocation(), context.Symbol.Name);
ContractsCheckAnalyzer.cs (4)
211context.ReportDiagnostic(Diagnostic.Create( 231context.ReportDiagnostic(Diagnostic.Create( 238context.ReportDiagnostic(Diagnostic.Create( 243context.ReportDiagnostic(Diagnostic.Create(
ContractsCheckNameofFixProvider.cs (1)
36var diagnostic = context.Diagnostics.FirstOrDefault(d => d.Id == Id);
InstanceInitializerAnalyzer.cs (4)
59var diagnostic = Diagnostic.Create(Rule, symbol.Locations[0], symbol.Name, "field"); 75var diagnostic = Diagnostic.Create(Rule, symbol.Locations[0], symbol.Name, "property");
NameAnalyzer.cs (5)
32internal static Diagnostic CreateDiagnostic(DiagnosticDescriptor rule, SyntaxToken identifier, NameType desired, params object[] args) 38return Diagnostic.Create(rule, identifier.GetLocation(), props, text); 42return Diagnostic.Create(rule, identifier.GetLocation(), props, newArgs); 172var diagnostic = Diagnostic.Create(PrivateFieldName.Rule, identifier.GetLocation(), name);
NameFixProvider.cs (1)
51var diagnostic = context.Diagnostics[0];
RelaxTestNamingSuppressor.cs (1)
33foreach (var diagnostic in context.ReportedDiagnostics)
SingleVariableDeclarationAnalyzer.cs (2)
47var diagnostic = Diagnostic.Create(Rule, context.Node.GetLocation(), jointVariableNames);
PlatformDocAnalyzer (4)
PlatformDocAnalyzer.cs (4)
203context.ReportDiagnostic(Diagnostic.Create( 294context.ReportDiagnostic(Diagnostic.Create( 314context.ReportDiagnostic(Diagnostic.Create( 344context.ReportDiagnostic(Diagnostic.Create(
Roslyn.Diagnostics.Analyzers (71)
DiagnosticExtensions.cs (3)
16public static Diagnostic CreateDiagnostic( 23public static Diagnostic CreateDiagnostic( 31public static Diagnostic CreateDiagnostic(
DoNotMixAttributesFromDifferentVersionsOfMEF.cs (1)
128var diagnostic = problematicAttribute.ApplicationSyntaxReference.CreateDiagnostic(
ExportedPartsShouldHaveImportingConstructorCodeFixProvider.cs (1)
37foreach (var diagnostic in context.Diagnostics)
ImportingConstructorShouldBeObsoleteCodeFixProvider.cs (1)
34foreach (var diagnostic in context.Diagnostics)
IRemoteJsonServiceParameterAnalyzer.cs (2)
80var diagnostic = Diagnostic.Create(
NamedTypeFullNameNotNullSuppressor.cs (2)
39foreach (var diagnostic in context.ReportedDiagnostics) 57private static SuppressionDescriptor GetDescriptor(Diagnostic diagnostic)
PartsExportedWithMEFv2MustBeMarkedAsShared.Fixer.cs (1)
36foreach (var diagnostic in context.Diagnostics)
RelaxTestNamingSuppressor.cs (1)
41foreach (var diagnostic in context.ReportedDiagnostics)
SpecializedEnumerableCreationAnalyzer.cs (2)
142protected void AnalyzeMemberAccessName(SyntaxNode name, SemanticModel semanticModel, Action<Diagnostic> addDiagnostic, CancellationToken cancellationToken) 151protected static void AnalyzeArrayLength(int length, SyntaxNode arrayCreationExpression, Action<Diagnostic> addDiagnostic)
src\roslyn\src\Compilers\Core\Portable\Diagnostic\DiagnosticArrayExtensions.cs (1)
11internal static bool HasAnyErrors<T>(this ImmutableArray<T> diagnostics) where T : Diagnostic
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\DoNotCatchGeneralUnlessRethrown.cs (1)
34protected abstract Diagnostic CreateDiagnostic(IMethodSymbol containingMethod, SyntaxToken catchKeyword);
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\DiagnosticExtensions.cs (20)
18public static Diagnostic CreateDiagnostic( 24public static Diagnostic CreateDiagnostic( 31public static Diagnostic CreateDiagnostic( 45public static Diagnostic CreateDiagnostic( 51public static Diagnostic CreateDiagnostic( 60public static Diagnostic CreateDiagnostic( 70public static Diagnostic CreateDiagnostic( 78public static Diagnostic CreateDiagnostic( 86public static Diagnostic CreateDiagnostic( 95public static Diagnostic CreateDiagnostic( 105public static Diagnostic CreateDiagnostic( 112public static Diagnostic CreateDiagnostic( 124return Diagnostic.Create( 132public static Diagnostic CreateDiagnostic( 140public static Diagnostic CreateDiagnostic( 149return Diagnostic.Create(rule, null, args); 152return Diagnostic.Create(rule, 168Action<Diagnostic> addDiagnostic, 187var diagnostic = Diagnostic.Create(rule, Location.None, properties, args);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Diagnostics\IPragmaSuppressionsAnalyzer.cs (1)
27Action<Diagnostic> reportDiagnostic,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\CodeFixContextExtensions.cs (2)
16internal static void RegisterFixes(this CodeFixContext context, IEnumerable<CodeAction> actions, Diagnostic diagnostic) 27internal static void RegisterFixes(this CodeFixContext context, IEnumerable<CodeAction> actions, ImmutableArray<Diagnostic> diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (9)
22public static async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync( 27var allDiagnostics = ImmutableArray<Diagnostic>.Empty; 41return ImmutableDictionary<Document, ImmutableArray<Diagnostic>>.Empty.SetItem(document, documentDiagnostics); 80allDiagnostics = await ProducerConsumer<ImmutableArray<Diagnostic>>.RunParallelAsync( 90using var _2 = ArrayBuilder<Diagnostic>.GetInstance(out var builder); 106return ImmutableDictionary<Document, ImmutableArray<Diagnostic>>.Empty; 132private static async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync( 134ImmutableArray<Diagnostic> diagnostics, 137var builder = ImmutableDictionary.CreateBuilder<Document, ImmutableArray<Diagnostic>>();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\ForkingSyntaxEditorBasedCodeFixProvider.cs (7)
33/// cref="Diagnostic.Properties"/> for that diagnostic. The diagnostic itself is not passed along as it was 34/// computed with respect to the original user document, and as such its <see cref="Diagnostic.Location"/> and <see 35/// cref="Diagnostic.AdditionalLocations"/> will not be correct. 44protected sealed override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) 56ImmutableArray<Diagnostic> diagnostics, 62using var _ = ArrayBuilder<(TDiagnosticNode diagnosticNode, Diagnostic diagnostic)>.GetInstance(out var originalNodes); 63foreach (var diagnostic in diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\MultiProjectSafeFixAllProvider.cs (1)
110static IEnumerable<TextSpan> GetDiagnosticSpans(ImmutableArray<Diagnostic> diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\SyntaxEditorBasedCodeFixProvider.cs (9)
57protected void RegisterCodeFix(CodeFixContext context, string title, string equivalenceKey, Diagnostic? diagnostic = null) 60protected void RegisterCodeFix(CodeFixContext context, string title, string equivalenceKey, CodeActionPriority priority, Diagnostic? diagnostic = null) 63protected Func<CancellationToken, Task<Document>> GetDocumentUpdater(CodeFixContext context, Diagnostic? diagnostic = null) 70Document document, ImmutableArray<Diagnostic> diagnostics, CancellationToken cancellationToken) 98Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor, CancellationToken cancellationToken); 105/// <para/> This overload differs from <see cref="IncludeDiagnosticDuringFixAll(Diagnostic)"/> in that it also 111protected virtual bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) 122/// cref="IncludeDiagnosticDuringFixAll(Diagnostic, Document, string, CancellationToken)"/> should be overridden 127protected virtual bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
184public static async Task<ImmutableArray<Diagnostic>> GetErrorsAsync(this Document document, CancellationToken cancellationToken, IList<string>? ignoreErrorCode = null)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (2)
32public static string? TryGetAnalyzerConfigPathForDiagnosticConfiguration(this Project project, Diagnostic diagnostic) 38private static string? TryGetAnalyzerConfigPathForProjectOrDiagnosticConfiguration(Project project, Diagnostic? diagnostic)
SymbolDeclaredEventMustBeGeneratedForSourceSymbols.cs (2)
186Diagnostic diagnostic = Diagnostic.Create(SymbolDeclaredEventRule, sourceSymbol.Locations[0], sourceSymbol.Name, _compilationType.Name, SymbolDeclaredEventName);
TestExportsShouldNotBeDiscoverableCodeFixProvider.cs (1)
37foreach (var diagnostic in context.Diagnostics)
Roslyn.Diagnostics.CSharp.Analyzers (8)
CSharpAvoidOptSuffixForNullableEnableCode.cs (1)
67private static void ReportOnInvalidIdentifier(SyntaxToken identifier, SemanticModel semanticModel, Action<Diagnostic> reportAction, CancellationToken cancellationToken)
CSharpAvoidOptSuffixForNullableEnableCodeCodeFixProvider.cs (1)
35foreach (var diagnostic in context.Diagnostics)
CSharpDoNotCapturePrimaryContructorParameters.cs (1)
60context.ReportDiagnostic(Diagnostic.Create(Rule, operation.Syntax.GetLocation(), operation.Parameter.Name));
CSharpDoNotUseDebugAssertForInterpolatedStringsFixer.cs (1)
45foreach (var diagnostic in context.Diagnostics)
CSharpSpecializedEnumerableCreationAnalyzer.cs (2)
78private static void AnalyzeArrayCreationExpression(ArrayCreationExpressionSyntax arrayCreationExpression, Action<Diagnostic> addDiagnostic) 96private static void AnalyzeInitializerExpression(InitializerExpressionSyntax initializer, Action<Diagnostic> addDiagnostic)
PreferNullLiteralCodeFixProvider.cs (1)
35foreach (var diagnostic in context.Diagnostics)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Helpers\RemoveUnnecessaryImports\CSharpUnnecessaryImportsProvider.cs (1)
33foreach (var diagnostic in diagnostics)
Roslyn.Diagnostics.VisualBasic.Analyzers (2)
BasicSpecializedEnumerableCreationAnalyzer.vb (2)
82Private Shared Sub AnalyzeArrayCreationExpression(arrayCreationExpression As ArrayCreationExpressionSyntax, addDiagnostic As Action(Of Diagnostic)) 100Private Shared Sub AnalyzeCollectionInitializerExpression(initializer As CollectionInitializerSyntax, arrayCreationExpression As SyntaxNode, addDiagnostic As Action(Of Diagnostic))
System.Private.CoreLib.Generators (9)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (9)
332context.ReportDiagnostic(Diagnostic.Create(RuleCantParse, expressionToDecompose.GetLocation())); 343context.ReportDiagnostic(Diagnostic.Create(RuleCantParse, expressionToDecompose.GetLocation())); 356context.ReportDiagnostic(Diagnostic.Create(RuleCantParse, expressionToDecompose.GetLocation())); 365context.ReportDiagnostic(Diagnostic.Create(RuleCantParse, expressionToDecompose.GetLocation())); 373context.ReportDiagnostic(Diagnostic.Create(RuleCantParse, expressionToDecompose.GetLocation())); 546context.ReportDiagnostic(Diagnostic.Create(RuleAttributeNotSpecificEnough, operation.Syntax.GetLocation(), attributeExplicitlyAllowsRelatedSymbol.ToDisplayString())); 613context.ReportDiagnostic(Diagnostic.Create(RuleCantParse, operation.Syntax.GetLocation())); 686context.ReportDiagnostic(Diagnostic.Create(Rule, operation.Syntax.GetLocation(), symbol.ContainingSymbol.ToDisplayString())); 688context.ReportDiagnostic(Diagnostic.Create(RuleHelper, operation.Syntax.GetLocation(), symbol.ToDisplayString()));
System.Text.Json.SourceGeneration (7)
JsonSourceGenerator.Parser.cs (2)
61public List<Diagnostic> Diagnostics { get; } = new(); 74Diagnostics.Add(Diagnostic.Create(descriptor, location, messageArgs));
JsonSourceGenerator.Roslyn4.0.cs (5)
34IncrementalValuesProvider<(ContextGenerationSpec?, ImmutableArray<Diagnostic>)> contextGenerationSpecs = context.SyntaxProvider 56ImmutableArray<Diagnostic> diagnostics = parser.Diagnostics.ToImmutableArray(); 87IncrementalValuesProvider<ImmutableArray<Diagnostic>> diagnostics = 120private static void EmitDiagnostics(SourceProductionContext context, ImmutableArray<Diagnostic> diagnostics) 122foreach (Diagnostic diagnostic in diagnostics)
System.Text.RegularExpressions.Generator (27)
RegexGenerator.cs (13)
54IncrementalValueProvider<(ImmutableArray<object> Results, ImmutableArray<Diagnostic> Diagnostics)> collected = 91return (object)(regexMethod, reason, Diagnostic.Create(DiagnosticDescriptors.LimitedSourceGeneration, method.DiagnosticLocation), regexMethod.CompilationData); 98return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexArguments, method.DiagnosticLocation, e.Message); 110Debug.Assert(state is Diagnostic or ValueTuple<RegexMethod, string, Diagnostic, CompilationData>); 130ImmutableArray<Diagnostic>.Builder? diagnostics = null; 135if (result is Diagnostic d) 137(diagnostics ??= ImmutableArray.CreateBuilder<Diagnostic>()).Add(d); 139else if (result is ValueTuple<RegexMethod, string, Diagnostic, CompilationData> limitedSupportResult) 141(diagnostics ??= ImmutableArray.CreateBuilder<Diagnostic>()).Add(limitedSupportResult.Item3); 153Diagnostics: diagnostics?.ToImmutable() ?? ImmutableArray<Diagnostic>.Empty); 322IncrementalValueProvider<ImmutableArray<Diagnostic>> diagnosticResults = 327foreach (Diagnostic diagnostic in diagnostics)
RegexGenerator.Parser.cs (13)
23/// Returns null if nothing to do, a <see cref="Diagnostic"/> if there's an error to report, 35return Diagnostic.Create(DiagnosticDescriptors.RegexMemberMustHaveValidSignature, context.TargetNode.GetLocation()); 65return Diagnostic.Create(DiagnosticDescriptors.MultipleGeneratedRegexAttributes, memberSyntax.GetLocation()); 71return Diagnostic.Create(DiagnosticDescriptors.InvalidGeneratedRegexAttribute, memberSyntax.GetLocation()); 77return Diagnostic.Create(DiagnosticDescriptors.InvalidGeneratedRegexAttribute, memberSyntax.GetLocation()); 109return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexArguments, memberSyntax.GetLocation(), "(null)"); 121return Diagnostic.Create(DiagnosticDescriptors.RegexMemberMustHaveValidSignature, memberSyntax.GetLocation()); 135return Diagnostic.Create(DiagnosticDescriptors.RegexMemberMustHaveValidSignature, memberSyntax.GetLocation()); 157return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexArguments, memberSyntax.GetLocation(), e.Message); 165return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexArguments, memberSyntax.GetLocation(), "cultureName"); 174return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexArguments, memberSyntax.GetLocation(), "cultureName"); 193return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexArguments, memberSyntax.GetLocation(), "options"); 199return Diagnostic.Create(DiagnosticDescriptors.InvalidRegexArguments, memberSyntax.GetLocation(), "matchTimeout");
UpgradeToGeneratedRegexAnalyzer.cs (1)
80context.ReportDiagnostic(Diagnostic.Create(DiagnosticDescriptors.UseRegexSourceGeneration, location));
System.Windows.Forms.Analyzers (2)
System\Windows\Forms\Analyzers\AppManifestAnalyzer.cs (2)
66context.ReportDiagnostic(Diagnostic.Create(SharedDiagnosticDescriptors.s_cSharpMigrateHighDpiSettings, 73context.ReportDiagnostic(Diagnostic.Create(SharedDiagnosticDescriptors.s_visualBasicMigrateHighDpiSettings,
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.CSharp (18)
System\Windows\Forms\CSharp\Analyzers\AvoidPassingTaskWithoutCancellationToken\AvoidPassingTaskWithoutCancellationTokenAnalyzer.cs (2)
89Diagnostic diagnostic = Diagnostic.Create(
System\Windows\Forms\CSharp\Analyzers\ImplementITypedDataObject\ImplementITypedDataObjectAnalyzer.cs (2)
68var diagnostic = Diagnostic.Create(
System\Windows\Forms\CSharp\Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationAnalyzer.cs (2)
98var diagnostic = Diagnostic.Create(
System\Windows\Forms\CSharp\Generators\ApplicationConfiguration\ApplicationConfigurationGenerator.cs (4)
20Diagnostic? applicationConfigDiagnostics) 43context.ReportDiagnostic(Diagnostic.Create( 81IncrementalValueProvider<(ApplicationConfig? ApplicationConfig, Diagnostic? Diagnostic)> globalConfig 84IncrementalValueProvider<(OutputKind OutputKind, Collections.Immutable.ImmutableArray<string?> ProjectNamespaces, ApplicationConfig? ApplicationConfig, Diagnostic? ApplicationConfigDiagnostics)> inputs
System\Windows\Forms\CSharp\Generators\ApplicationConfiguration\ProjectFileReader.cs (8)
14public static IncrementalValueProvider<(ApplicationConfig? ApplicationConfig, Diagnostic? Diagnostic)> ReadApplicationConfig(IncrementalValueProvider<AnalyzerConfigOptionsProvider> configOptionsProvider) => 20out bool enableVisualStyles, out Diagnostic? diagnostic) 39private static bool TryReadBool(AnalyzerConfigOptionsProvider configOptions, string propertyName, bool defaultValue, out bool value, out Diagnostic? diagnostic) 53diagnostic = Diagnostic.Create(CSharpDiagnosticDescriptors.s_propertyCantBeSetToValue, 65private static bool TryReadFont(AnalyzerConfigOptionsProvider configOptions, out FontDescriptor? font, out Diagnostic? diagnostic) 89diagnostic = Diagnostic.Create(CSharpDiagnosticDescriptors.s_propertyCantBeSetToValueWithReason, 99private static bool TryReadHighDpiMode(AnalyzerConfigOptionsProvider configOptions, out HighDpiMode highDpiMode, out Diagnostic? diagnostic) 114diagnostic = Diagnostic.Create(CSharpDiagnosticDescriptors.s_propertyCantBeSetToValue,
System.Windows.Forms.Analyzers.VisualBasic (4)
Analyzers\AvoidPassingTaskWithoutCancellationToken\AvoidPassingTaskWithoutCancellationTokenAnalyzer.vb (1)
94Dim diagnostic As Diagnostic = Diagnostic.Create(
Analyzers\ImplementITypedDataObject\ImplementITypedDataObjectInAdditionToIDataObjectAnalyzer.vb (2)
67Dim diagnostic As Diagnostic = Diagnostic.Create(
Analyzers\MissingPropertySerializationConfiguration\MissingPropertySerializationConfigurationDiagnosticAnalyzer.vb (1)
96Dim diagnostic As Diagnostic = Diagnostic.Create(
System.Windows.Forms.PrivateSourceGenerators (1)
System\Windows\Forms\SourceGenerators\EnumValidationGenerator.cs (1)
191context.ReportDiagnostic(Diagnostic.Create("EV1", nameof(EnumValidationGenerator), $"Can't validate an enum that has no elements", DiagnosticSeverity.Error, DiagnosticSeverity.Error, true, 4));