2264 references to DiagnosticSeverity
AnalyzerRunner (1)
Aspire.Hosting.Analyzers (1)
CodeStyleConfigFileGenerator (16)
ConfigurationSchemaGenerator (6)
ConfigurationSchemaGenerator.Tests (1)
ILLink.RoslynAnalyzer (4)
Microsoft.Analyzers.Extra (15)
Microsoft.Analyzers.Local (10)
Microsoft.AspNetCore.Analyzer.Testing (2)
Microsoft.AspNetCore.Analyzers (3)
Microsoft.AspNetCore.App.Analyzers (27)
DiagnosticDescriptors.cs (26)
16DiagnosticSeverity.Warning,
25DiagnosticSeverity.Warning,
34DiagnosticSeverity.Warning,
43DiagnosticSeverity.Warning,
52DiagnosticSeverity.Warning,
61DiagnosticSeverity.Error,
70DiagnosticSeverity.Error,
79DiagnosticSeverity.Error,
88DiagnosticSeverity.Warning,
97DiagnosticSeverity.Warning,
106DiagnosticSeverity.Warning,
115DiagnosticSeverity.Warning,
124DiagnosticSeverity.Info,
133DiagnosticSeverity.Warning,
142DiagnosticSeverity.Warning,
151DiagnosticSeverity.Info,
160DiagnosticSeverity.Warning,
169DiagnosticSeverity.Error,
178DiagnosticSeverity.Error,
187DiagnosticSeverity.Warning,
196DiagnosticSeverity.Warning,
205DiagnosticSeverity.Error,
214DiagnosticSeverity.Info,
223DiagnosticSeverity.Warning,
232DiagnosticSeverity.Info,
242DiagnosticSeverity.Info,
Microsoft.AspNetCore.App.Analyzers.Test (1)
Microsoft.AspNetCore.Components.Analyzers (7)
Microsoft.AspNetCore.Components.Analyzers.Tests (21)
Microsoft.AspNetCore.Components.SdkAnalyzers (6)
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (19)
Microsoft.AspNetCore.Http.Extensions.Tests (11)
Microsoft.AspNetCore.Http.Microbenchmarks (2)
Microsoft.AspNetCore.Http.RequestDelegateGenerator (13)
DiagnosticDescriptors.cs (13)
17DiagnosticSeverity.Warning,
26DiagnosticSeverity.Warning,
35DiagnosticSeverity.Warning,
44DiagnosticSeverity.Warning,
53DiagnosticSeverity.Warning,
62DiagnosticSeverity.Warning,
71DiagnosticSeverity.Warning,
80DiagnosticSeverity.Warning,
89DiagnosticSeverity.Warning,
98DiagnosticSeverity.Warning,
107DiagnosticSeverity.Warning,
116DiagnosticSeverity.Warning,
125DiagnosticSeverity.Warning,
Microsoft.AspNetCore.Mvc.Analyzers (6)
Microsoft.AspNetCore.Mvc.Api.Analyzers (4)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (1)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (1)
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (20)
DiagnosticDescriptors.cs (20)
19defaultSeverity: DiagnosticSeverity.Error,
27defaultSeverity: DiagnosticSeverity.Warning,
35defaultSeverity: DiagnosticSeverity.Error,
43defaultSeverity: DiagnosticSeverity.Error,
51defaultSeverity: DiagnosticSeverity.Error,
59defaultSeverity: DiagnosticSeverity.Error,
67defaultSeverity: DiagnosticSeverity.Error,
75defaultSeverity: DiagnosticSeverity.Error,
83defaultSeverity: DiagnosticSeverity.Error,
91defaultSeverity: DiagnosticSeverity.Error,
101defaultSeverity: DiagnosticSeverity.Warning,
109defaultSeverity: DiagnosticSeverity.Error,
117defaultSeverity: DiagnosticSeverity.Error,
125defaultSeverity: DiagnosticSeverity.Error,
133defaultSeverity: DiagnosticSeverity.Error,
141defaultSeverity: DiagnosticSeverity.Error,
149defaultSeverity: DiagnosticSeverity.Error,
157defaultSeverity: DiagnosticSeverity.Error,
165defaultSeverity: DiagnosticSeverity.Error,
173defaultSeverity: DiagnosticSeverity.Error,
Microsoft.CodeAnalysis (147)
Diagnostic\DiagnosticDescriptor.cs (15)
57public DiagnosticSeverity DefaultSeverity { get; }
81/// use constructor overload <see cref="DiagnosticDescriptor(string, LocalizableString, LocalizableString, string, DiagnosticSeverity, bool, LocalizableString, string, string[])"/>.
101DiagnosticSeverity defaultSeverity,
142DiagnosticSeverity defaultSeverity,
156DiagnosticSeverity defaultSeverity,
249internal static ReportDiagnostic MapSeverityToReport(DiagnosticSeverity severity)
253case DiagnosticSeverity.Hidden:
255case DiagnosticSeverity.Info:
257case DiagnosticSeverity.Warning:
259case DiagnosticSeverity.Error:
266internal static DiagnosticSeverity? MapReportToSeverity(ReportDiagnostic severity)
271return DiagnosticSeverity.Error;
273return DiagnosticSeverity.Warning;
275return DiagnosticSeverity.Info;
277return DiagnosticSeverity.Hidden;
Microsoft.CodeAnalysis.CodeStyle (65)
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
39DiagnosticSeverity.Info,
Microsoft.CodeAnalysis.CodeStyle.Fixes (2)
Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities (3)
Microsoft.CodeAnalysis.CSharp (69)
Microsoft.CodeAnalysis.CSharp.CodeStyle (17)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests (69)
src\Analyzers\CSharp\Tests\UseObjectInitializer\UseObjectInitializerTests.cs (25)
74VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
181VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
246VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
310VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
355VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
402VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3).WithLocation(4).WithLocation(5),
449VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
495VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
544VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
595VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
674VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
676VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(4).WithLocation(5).WithLocation(6).WithLocation(7),
730VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
732VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(4).WithLocation(5).WithLocation(6).WithLocation(7),
787VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3).WithLocation(4).WithLocation(5),
789VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(6).WithLocation(7).WithLocation(8).WithLocation(9).WithLocation(10).WithLocation(11),
834VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3).WithLocation(4).WithLocation(5),
886VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3).WithLocation(4).WithLocation(5),
987VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
1040VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
1152VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
1217VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
1254VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
1346VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3));
1404VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Warning).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
src\Analyzers\CSharp\Tests\ValidateFormatString\ValidateFormatStringTests.cs (24)
642diagnosticSeverity: DiagnosticSeverity.Info,
677diagnosticSeverity: DiagnosticSeverity.Info,
695diagnosticSeverity: DiagnosticSeverity.Info,
713diagnosticSeverity: DiagnosticSeverity.Info,
732diagnosticSeverity: DiagnosticSeverity.Info,
751diagnosticSeverity: DiagnosticSeverity.Info,
770diagnosticSeverity: DiagnosticSeverity.Info,
790diagnosticSeverity: DiagnosticSeverity.Info,
810diagnosticSeverity: DiagnosticSeverity.Info,
828diagnosticSeverity: DiagnosticSeverity.Info,
846diagnosticSeverity: DiagnosticSeverity.Info,
864diagnosticSeverity: DiagnosticSeverity.Info,
882diagnosticSeverity: DiagnosticSeverity.Info,
901diagnosticSeverity: DiagnosticSeverity.Info,
920diagnosticSeverity: DiagnosticSeverity.Info,
939diagnosticSeverity: DiagnosticSeverity.Info,
966diagnosticSeverity: DiagnosticSeverity.Info,
985diagnosticSeverity: DiagnosticSeverity.Info,
1004diagnosticSeverity: DiagnosticSeverity.Info,
1023diagnosticSeverity: DiagnosticSeverity.Info,
1042diagnosticSeverity: DiagnosticSeverity.Info,
1061diagnosticSeverity: DiagnosticSeverity.Info,
1080diagnosticSeverity: DiagnosticSeverity.Info,
1099diagnosticSeverity: DiagnosticSeverity.Info,
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (134)
CommandLineTests.cs (134)
216var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true);
13062var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true);
13107analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: false);
13129var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Error, configurable: true);
13147[InlineData(DiagnosticSeverity.Warning, false)]
13148[InlineData(DiagnosticSeverity.Info, true)]
13149[InlineData(DiagnosticSeverity.Info, false)]
13150[InlineData(DiagnosticSeverity.Hidden, false)]
13152public void TestCategoryBasedBulkAnalyzerDiagnosticConfiguration(DiagnosticSeverity defaultSeverity, bool errorlog)
13225if (defaultSeverity == DiagnosticSeverity.Hidden ||
13226defaultSeverity == DiagnosticSeverity.Info && !errorlog)
13247[InlineData(DiagnosticSeverity.Warning, false, false)]
13248[InlineData(DiagnosticSeverity.Warning, false, true)]
13249[InlineData(DiagnosticSeverity.Info, true, false)]
13250[InlineData(DiagnosticSeverity.Info, false, false)]
13251[InlineData(DiagnosticSeverity.Info, true, true)]
13252[InlineData(DiagnosticSeverity.Info, false, true)]
13253[InlineData(DiagnosticSeverity.Hidden, false, false)]
13254[InlineData(DiagnosticSeverity.Hidden, false, true)]
13256public void TestBulkAnalyzerDiagnosticConfiguration(DiagnosticSeverity defaultSeverity, bool errorlog, bool customConfigurable)
13317if (defaultSeverity == DiagnosticSeverity.Hidden ||
13318defaultSeverity == DiagnosticSeverity.Info && !errorlog)
13337[InlineData(DiagnosticSeverity.Warning, false)]
13338[InlineData(DiagnosticSeverity.Info, true)]
13339[InlineData(DiagnosticSeverity.Info, false)]
13340[InlineData(DiagnosticSeverity.Hidden, false)]
13342public void TestMixedCategoryBasedAndBulkAnalyzerDiagnosticConfiguration(DiagnosticSeverity defaultSeverity, bool errorlog)
13633var analyzer = new NamedTypeAnalyzerWithConfigurableEnabledByDefault(isEnabledByDefault, defaultSeverity: DiagnosticSeverity.Warning, customConfigurable, throwOnAllNamedTypes: false);
13743public void TestAnalyzerFilteringBasedOnSeverity(DiagnosticSeverity defaultSeverity, bool errorlog, bool customConfigurable)
13749var analyzerShouldBeSkipped = (defaultSeverity == DiagnosticSeverity.Hidden ||
13750defaultSeverity == DiagnosticSeverity.Info && !errorlog) && !customConfigurable;
13780public void TestWarnAsErrorMinusDoesNotEnableDisabledByDefaultAnalyzers(DiagnosticSeverity defaultSeverity, bool isEnabledByDefault, bool customConfigurable)
13788defaultSeverity is DiagnosticSeverity.Hidden or DiagnosticSeverity.Info) && !customConfigurable;
13802var expectedExitCode = !analyzerShouldBeSkipped && defaultSeverity == DiagnosticSeverity.Error ? 1 : 0;
13806if (analyzerShouldBeSkipped || customConfigurable && defaultSeverity is DiagnosticSeverity.Hidden or DiagnosticSeverity.Info)
13812var prefix = defaultSeverity == DiagnosticSeverity.Warning ? "warning" : "error";
13820[InlineData(false, false, DiagnosticSeverity.Info, DiagnosticSeverity.Warning, null, DiagnosticSeverity.Error)]
13821[InlineData(true, false, DiagnosticSeverity.Info, DiagnosticSeverity.Warning, null, DiagnosticSeverity.Warning)]
13822[InlineData(false, true, DiagnosticSeverity.Info, DiagnosticSeverity.Warning, null, DiagnosticSeverity.Error)]
13823[InlineData(true, true, DiagnosticSeverity.Info, DiagnosticSeverity.Warning, null, DiagnosticSeverity.Warning)]
13825[InlineData(false, false, DiagnosticSeverity.Info, null, DiagnosticSeverity.Warning, DiagnosticSeverity.Error)]
13826[InlineData(true, false, DiagnosticSeverity.Info, null, DiagnosticSeverity.Warning, DiagnosticSeverity.Warning)]
13827[InlineData(false, true, DiagnosticSeverity.Info, null, DiagnosticSeverity.Warning, DiagnosticSeverity.Error)]
13828[InlineData(true, true, DiagnosticSeverity.Info, null, DiagnosticSeverity.Warning, DiagnosticSeverity.Warning)]
13830[InlineData(false, false, DiagnosticSeverity.Warning, null, null, DiagnosticSeverity.Error)]
13831[InlineData(true, false, DiagnosticSeverity.Warning, null, null, DiagnosticSeverity.Warning)]
13832[InlineData(false, true, DiagnosticSeverity.Warning, null, null, DiagnosticSeverity.Error)]
13833[InlineData(true, true, DiagnosticSeverity.Warning, null, null, DiagnosticSeverity.Warning)]
13835[InlineData(false, false, DiagnosticSeverity.Warning, DiagnosticSeverity.Error, null, DiagnosticSeverity.Error)]
13836[InlineData(true, false, DiagnosticSeverity.Warning, DiagnosticSeverity.Error, null, DiagnosticSeverity.Warning)]
13837[InlineData(false, true, DiagnosticSeverity.Warning, DiagnosticSeverity.Error, null, DiagnosticSeverity.Error)]
13838[InlineData(true, true, DiagnosticSeverity.Warning, DiagnosticSeverity.Error, null, DiagnosticSeverity.Warning)]
13840[InlineData(false, false, DiagnosticSeverity.Info, DiagnosticSeverity.Error, null, DiagnosticSeverity.Error)]
13841[InlineData(true, false, DiagnosticSeverity.Info, DiagnosticSeverity.Error, null, DiagnosticSeverity.Error)]
13842[InlineData(false, true, DiagnosticSeverity.Info, DiagnosticSeverity.Error, null, DiagnosticSeverity.Error)]
13843[InlineData(true, true, DiagnosticSeverity.Info, DiagnosticSeverity.Error, null, DiagnosticSeverity.Error)]
13845[InlineData(false, false, DiagnosticSeverity.Info, null, DiagnosticSeverity.Error, DiagnosticSeverity.Error)]
13846[InlineData(true, false, DiagnosticSeverity.Info, null, DiagnosticSeverity.Error, DiagnosticSeverity.Error)]
13847[InlineData(false, true, DiagnosticSeverity.Info, null, DiagnosticSeverity.Error, DiagnosticSeverity.Error)]
13848[InlineData(true, true, DiagnosticSeverity.Info, null, DiagnosticSeverity.Error, DiagnosticSeverity.Error)]
13849[InlineData(false, false, DiagnosticSeverity.Warning, null, DiagnosticSeverity.Error, DiagnosticSeverity.Error)]
13850[InlineData(true, false, DiagnosticSeverity.Warning, null, DiagnosticSeverity.Error, DiagnosticSeverity.Error)]
13851[InlineData(false, true, DiagnosticSeverity.Warning, null, DiagnosticSeverity.Error, DiagnosticSeverity.Error)]
13852[InlineData(true, true, DiagnosticSeverity.Warning, null, DiagnosticSeverity.Error, DiagnosticSeverity.Error)]
13856DiagnosticSeverity defaultSeverity,
13857DiagnosticSeverity? severityInConfigFile,
13858DiagnosticSeverity? customConfiguredSeverityByAnalyzer,
13859DiagnosticSeverity expectedEffectiveSeverity)
13862var reportedSeverity = customConfiguredSeverityByAnalyzer ?? defaultSeverity;
13899case DiagnosticSeverity.Warning:
13903case DiagnosticSeverity.Error:
14896private static readonly DiagnosticDescriptor _rule = new DiagnosticDescriptor("Id", "Title", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
15302var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true);
15936internal static readonly DiagnosticDescriptor Hidden01 = new DiagnosticDescriptor("Hidden01", "", "Throwing a diagnostic for #region", "", DiagnosticSeverity.Hidden, isEnabledByDefault: true);
15937internal static readonly DiagnosticDescriptor Hidden02 = new DiagnosticDescriptor("Hidden02", "", "Throwing a diagnostic for something else", "", DiagnosticSeverity.Hidden, isEnabledByDefault: true);
15961internal static readonly DiagnosticDescriptor Info01 = new DiagnosticDescriptor("Info01", "", "Throwing a diagnostic for #pragma restore", "", DiagnosticSeverity.Info, isEnabledByDefault: true);
15988internal static readonly DiagnosticDescriptor Warning01 = new DiagnosticDescriptor("Warning01", "", "Throwing a diagnostic for types declared", "", DiagnosticSeverity.Warning, isEnabledByDefault: true);
16011internal static readonly DiagnosticDescriptor Warning02 = new DiagnosticDescriptor("Warning02", "", "Throwing a diagnostic for types declared", "", DiagnosticSeverity.Warning, isEnabledByDefault: true, helpLinkUri: "https://example.org/analyzer");
16029internal static readonly DiagnosticDescriptor Error01 = new DiagnosticDescriptor("Error01", "", "Throwing a diagnostic for #pragma disable", "", DiagnosticSeverity.Error, isEnabledByDefault: true);
16030internal static readonly DiagnosticDescriptor Error02 = new DiagnosticDescriptor("Error02", "", "Throwing a diagnostic for something else", "", DiagnosticSeverity.Error, isEnabledByDefault: true);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (3)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (25)
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (2)
217new DiagnosticDescriptor(ID, title: "Syntax", messageFormat: "Syntax", category: "Test", defaultSeverity: DiagnosticSeverity.Warning, isEnabledByDefault: true);
845var descriptor = new DiagnosticDescriptor(id, "Title", messageFormat: analyzerName, "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
EditorConfigSettings\Updater\SettingsUpdaterTests.cs (2)
133var descriptor = new DiagnosticDescriptor(id: id, title: "", messageFormat: "", category: "Naming", defaultSeverity: DiagnosticSeverity.Warning, isEnabledByDefault: false);
332var descriptor = new DiagnosticDescriptor(id: id, title: "", messageFormat: "", category: "Naming", defaultSeverity: DiagnosticSeverity.Warning, isEnabledByDefault: false);
Formatting\CodeCleanupTests.cs (18)
572[CombinatorialValues(DiagnosticSeverity.Warning, DiagnosticSeverity.Info)] DiagnosticSeverity severity)
594expectedCleanup = severity >= DiagnosticSeverity.Warning;
741[InlineData(DiagnosticSeverity.Warning)]
742[InlineData(DiagnosticSeverity.Error)]
743public async Task RunThirdPartyFixerWithSeverityOfWarningOrHigher(DiagnosticSeverity severity)
749[InlineData(DiagnosticSeverity.Hidden)]
750[InlineData(DiagnosticSeverity.Info)]
751public async Task DoNotRunThirdPartyFixerWithSeverityLessThanWarning(DiagnosticSeverity severity)
768private static Task TestThirdPartyCodeFixerNoChanges<TCodefix, TAnalyzer>(string code, DiagnosticSeverity severity = DiagnosticSeverity.Warning)
775private static Task TestThirdPartyCodeFixerApplied<TCodefix, TAnalyzer>(string code, string expected, DiagnosticSeverity severity = DiagnosticSeverity.Warning)
782private static async Task TestThirdPartyCodeFixer<TCodefix, TAnalyzer>(string code = null, string expected = null, DiagnosticSeverity severity = DiagnosticSeverity.Warning)
860private protected static Task AssertCodeCleanupResult(string expected, string code, bool systemUsingsFirst = true, bool separateUsingGroups = false, Func<string, bool> enabledFixIdsFilter = null, (string, DiagnosticSeverity)[] diagnosticIdsWithSeverity = null)
874private protected static async Task AssertCodeCleanupResult(string expected, string code, CodeStyleOption2<AddImportPlacement> preferredImportPlacement, bool systemUsingsFirst = true, bool separateUsingGroups = false, Func<string, bool> enabledFixIdsFilter = null, (string, DiagnosticSeverity)[] diagnosticIdsWithSeverity = null)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (4)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (132)
Diagnostics\DiagnosticAnalyzerTests.cs (51)
38new DiagnosticDescriptor(id: "CA9999_UseOfVariableThatStartsWithX", title: "CA9999_UseOfVariableThatStartsWithX", messageFormat: "Use of variable whose name starts with 'x': '{0}'", category: "Test", defaultSeverity: DiagnosticSeverity.Warning, isEnabledByDefault: true);
234private static readonly DiagnosticDescriptor s_descriptor = new DiagnosticDescriptor("XX0001", "My Syntax/Symbol Diagnostic", "My Syntax/Symbol Diagnostic for '{0}'", "Compiler", DiagnosticSeverity.Warning, isEnabledByDefault: true);
303var noneDiagDescriptor = new DiagnosticDescriptor("XX0001", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Hidden, isEnabledByDefault: true);
304var infoDiagDescriptor = new DiagnosticDescriptor("XX0002", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Info, isEnabledByDefault: true);
305var warningDiagDescriptor = new DiagnosticDescriptor("XX0003", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault: true);
306var errorDiagDescriptor = new DiagnosticDescriptor("XX0004", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Error, isEnabledByDefault: true);
327Assert.True(effectiveDiag.Severity == DiagnosticSeverity.Error);
360case DiagnosticSeverity.Hidden:
364case DiagnosticSeverity.Info:
368case DiagnosticSeverity.Warning:
372case DiagnosticSeverity.Error:
387var noneDiagDescriptor = new DiagnosticDescriptor("XX0001", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Hidden, isEnabledByDefault: true);
388var infoDiagDescriptor = new DiagnosticDescriptor("XX0002", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Info, isEnabledByDefault: true);
389var warningDiagDescriptor = new DiagnosticDescriptor("XX0003", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault: true);
390var errorDiagDescriptor = new DiagnosticDescriptor("XX0004", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Error, isEnabledByDefault: true);
414Assert.Equal(1, effectiveDiags.Count(d => d.Severity == DiagnosticSeverity.Error));
415Assert.Equal(1, effectiveDiags.Count(d => d.Severity == DiagnosticSeverity.Warning));
421Assert.Equal(1, effectiveDiags.Count(d => d.Severity == DiagnosticSeverity.Error));
422Assert.Equal(1, effectiveDiags.Count(d => d.Severity == DiagnosticSeverity.Info));
428Assert.Equal(1, effectiveDiags.Count(d => d.Severity == DiagnosticSeverity.Error));
429Assert.Equal(1, effectiveDiags.Count(d => d.Severity == DiagnosticSeverity.Hidden));
435Assert.Equal(1, effectiveDiags.Count(d => d.Severity == DiagnosticSeverity.Error));
436Assert.Equal(1, effectiveDiags.Count(d => d.Severity == DiagnosticSeverity.Hidden));
442var disabledDiagDescriptor = new DiagnosticDescriptor("XX001", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault: false);
443var enabledDiagDescriptor = new DiagnosticDescriptor("XX002", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault: true);
471public static DiagnosticDescriptor desc1 = new DiagnosticDescriptor("XX001", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault: false);
472public static DiagnosticDescriptor desc2 = new DiagnosticDescriptor("XX002", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault: false);
473public static DiagnosticDescriptor desc3 = new DiagnosticDescriptor("XX003", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault: false, customTags: WellKnownDiagnosticTags.NotConfigurable);
487public static DiagnosticDescriptor desc1 = new DiagnosticDescriptor("XX003", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault: false);
488public static DiagnosticDescriptor desc2 = new DiagnosticDescriptor("XX004", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault: true);
502public static DiagnosticDescriptor desc1 = new DiagnosticDescriptor("DummyId", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault: false);
656internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true);
829public static DiagnosticDescriptor Descriptor1 = new DiagnosticDescriptor("MethodSymbolDiagnostic", "MethodSymbolDiagnostic", "{0}", "MethodSymbolDiagnostic", DiagnosticSeverity.Warning, isEnabledByDefault: true);
873new DiagnosticDescriptor("ID_1", "DummyTitle", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault: true);
876new DiagnosticDescriptor("ID_2", "DummyTitle", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault: true);
1276DiagnosticSeverity defaultSeverity,
1294TestEffectiveSeverity(DiagnosticSeverity.Warning, ReportDiagnostic.Warn);
1305TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity: ReportDiagnostic.Warn, specificOptions: specificOptions, generalOption: generalOption);
1314TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity: generalOption, generalOption: generalOption);
1326TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity: specificOption, specificOptions: specificOptions, generalOption: generalOption);
1337TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity: ReportDiagnostic.Suppress, generalOption: generalOption, isEnabledByDefault: enabledByDefault);
1350TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity: specificOption, specificOptions: specificOptions, generalOption: generalOption, isEnabledByDefault: enabledByDefault);
1640DiagnosticSeverity.Warning,
2288DiagnosticSeverity.Warning,
2296DiagnosticSeverity.Warning,
3841internal static DiagnosticDescriptor Rule = new(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true);
4075internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true);
4114internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true);
4388[InlineData(SeverityFilter.None, DiagnosticSeverity.Hidden)]
4390[InlineData(SeverityFilter.Hidden | SeverityFilter.Info, DiagnosticSeverity.Warning)]
4391internal async Task TestMinimumReportedSeverity(SeverityFilter severityFilter, DiagnosticSeverity expectedMinimumReportedSeverity)
Diagnostics\DiagnosticSuppressorTests.cs (17)
233var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true);
256var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true);
282var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true);
304var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true);
327var severities = Enum.GetValues(typeof(DiagnosticSeverity));
332foreach (DiagnosticSeverity defaultSeverity in severities)
334foreach (DiagnosticSeverity effectiveSeverity in severities)
346if (defaultSeverity == DiagnosticSeverity.Warning &&
347effectiveSeverity == DiagnosticSeverity.Error &&
369if (defaultSeverity == DiagnosticSeverity.Error || !configurable)
391var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true);
433var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true);
479var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true);
532var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true);
585var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true);
634var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true);
674var analyzer = new CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable: true);
Diagnostics\GetDiagnosticsTests.cs (18)
120Assert.Equal(DiagnosticSeverity.Warning, diag.Severity);
123var error = diag.WithSeverity(DiagnosticSeverity.Error);
124Assert.Equal(DiagnosticSeverity.Error, error.Severity);
125Assert.Equal(DiagnosticSeverity.Warning, error.DefaultSeverity);
128var warning = error.WithSeverity(DiagnosticSeverity.Warning);
129Assert.Equal(DiagnosticSeverity.Warning, warning.Severity);
130Assert.Equal(DiagnosticSeverity.Warning, warning.DefaultSeverity);
133var hidden = diag.WithSeverity(DiagnosticSeverity.Hidden);
134Assert.Equal(DiagnosticSeverity.Hidden, hidden.Severity);
135Assert.Equal(DiagnosticSeverity.Warning, hidden.DefaultSeverity);
138var info = diag.WithSeverity(DiagnosticSeverity.Info);
139Assert.Equal(DiagnosticSeverity.Info, info.Severity);
140Assert.Equal(DiagnosticSeverity.Warning, info.DefaultSeverity);
573Assert.Equal(DiagnosticSeverity.Warning, diagnostic.Severity);
621Assert.Equal(DiagnosticSeverity.Warning, diagnostic.Severity);
936defaultSeverity: DiagnosticSeverity.Warning,
944defaultSeverity: DiagnosticSeverity.Warning,
1712public static readonly DiagnosticDescriptor Descriptor = new DiagnosticDescriptor("ID0001", "Title", "Message", "Category", defaultSeverity: DiagnosticSeverity.Warning, isEnabledByDefault: true);
FlowAnalysis\FlowDiagnosticTests.cs (19)
158Assert.Equal(0, count[(int)DiagnosticSeverity.Error]);
159Assert.Equal(1, count[(int)DiagnosticSeverity.Warning]);
160Assert.Equal(0, count[(int)DiagnosticSeverity.Info]);
186Assert.Equal(0, count[(int)DiagnosticSeverity.Error]);
187Assert.Equal(2, count[(int)DiagnosticSeverity.Warning]);
188Assert.Equal(0, count[(int)DiagnosticSeverity.Info]);
355Assert.Equal(0, count[(int)DiagnosticSeverity.Error]);
356Assert.Equal(1, count[(int)DiagnosticSeverity.Warning]);
357Assert.Equal(0, count[(int)DiagnosticSeverity.Info]);
391Assert.Equal(0, count[(int)DiagnosticSeverity.Error]);
392Assert.Equal(0, count[(int)DiagnosticSeverity.Info]);
397Assert.Equal(2, count[(int)DiagnosticSeverity.Warning]);
496Assert.NotEmpty(this.FlowDiagnostics(comp).Where(e => e.Severity >= DiagnosticSeverity.Error));
514Assert.Empty(this.FlowDiagnostics(comp).Where(e => e.Severity >= DiagnosticSeverity.Error));
535Assert.NotEmpty(this.FlowDiagnostics(comp).Where(e => e.Severity >= DiagnosticSeverity.Error));
552Assert.Empty(this.FlowDiagnostics(comp).Where(e => e.Severity >= DiagnosticSeverity.Error));
573Assert.NotEmpty(this.FlowDiagnostics(comp).Where(e => e.Severity >= DiagnosticSeverity.Error));
591Assert.NotEmpty(this.FlowDiagnostics(comp).Where(e => e.Severity >= DiagnosticSeverity.Error));
636Assert.NotEmpty(this.FlowDiagnostics(comp).Where(e => e.Severity >= DiagnosticSeverity.Error));
Semantics\PrimaryConstructorTests.cs (16)
3748new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
4073new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
4159new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
4308new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
4498new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
4632new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
4812new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
4957new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
5136new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
5249new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
5476new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
5563new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
5676new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
5773new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
5831new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
5924new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
Semantics\RecordTests.cs (9)
26302new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
26625new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
26720new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
26885new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
27075new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
27209new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
27389new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
27534new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
27717new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
Microsoft.CodeAnalysis.CSharp.Features (22)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (103)
Diagnostics\Suppression\RemoveUnnecessaryPragmaSuppressionsTests.cs (4)
57new DiagnosticDescriptor("Analyzer0168", "Variable is declared but never used", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
59new DiagnosticDescriptor("Analyzer0219", "Variable is assigned but its value is never used", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
114new DiagnosticDescriptor("CompilationEndId", "Title", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true,
1299new(DiagnosticId, "NonLocalDiagnosticTitle", "NonLocalDiagnosticMessage", "NonLocalDiagnosticCategory", DiagnosticSeverity.Warning, isEnabledByDefault: true);
Diagnostics\Suppression\SuppressionTest_FixMultipleTests.cs (2)
39new DiagnosticDescriptor("InfoDiagnostic", "InfoDiagnostic Title", "InfoDiagnostic", "InfoDiagnostic", DiagnosticSeverity.Info, isEnabledByDefault: true);
41new DiagnosticDescriptor("InfoDiagnostic2", "InfoDiagnostic2 Title", "InfoDiagnostic2", "InfoDiagnostic2", DiagnosticSeverity.Info, isEnabledByDefault: true);
Diagnostics\Suppression\SuppressionTests.cs (7)
694new DiagnosticDescriptor("InfoDiagnostic", "InfoDiagnostic Title", "InfoDiagnostic", "InfoDiagnostic", DiagnosticSeverity.Info, isEnabledByDefault: true);
804new DiagnosticDescriptor("ErrorDiagnostic", "ErrorDiagnostic", "ErrorDiagnostic", "ErrorDiagnostic", DiagnosticSeverity.Error, isEnabledByDefault: true);
867new DiagnosticDescriptor("@~DiagnosticWithBadId", "DiagnosticWithBadId", "DiagnosticWithBadId", "DiagnosticWithBadId", DiagnosticSeverity.Info, isEnabledByDefault: true);
917new DiagnosticDescriptor("InfoDiagnostic", "InfoDiagnostic Title", "InfoDiagnostic", "InfoDiagnostic", DiagnosticSeverity.Info, isEnabledByDefault: true);
1058new("InfoDiagnostic", "InfoDiagnostic", "InfoDiagnostic", "InfoDiagnostic", DiagnosticSeverity.Info, isEnabledByDefault: true);
2058new("InfoDiagnostic", "InfoDiagnostic", "InfoDiagnostic", "InfoDiagnostic", DiagnosticSeverity.Info, isEnabledByDefault: true);
2453new("NoLocationDiagnostic", "NoLocationDiagnostic", "NoLocationDiagnostic", "NoLocationDiagnostic", DiagnosticSeverity.Info, isEnabledByDefault: true);
src\Analyzers\CSharp\Tests\UseObjectInitializer\UseObjectInitializerTests.cs (25)
74VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
181VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
246VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
310VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
355VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
402VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3).WithLocation(4).WithLocation(5),
449VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
495VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
544VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
595VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
674VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
676VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(4).WithLocation(5).WithLocation(6).WithLocation(7),
730VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
732VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(4).WithLocation(5).WithLocation(6).WithLocation(7),
787VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3).WithLocation(4).WithLocation(5),
789VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(6).WithLocation(7).WithLocation(8).WithLocation(9).WithLocation(10).WithLocation(11),
834VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3).WithLocation(4).WithLocation(5),
886VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3).WithLocation(4).WithLocation(5),
987VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
1040VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
1152VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
1217VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
1254VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
1346VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Info).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3));
1404VerifyCS.Diagnostic().WithSeverity(DiagnosticSeverity.Warning).WithLocation(0).WithLocation(1).WithLocation(2).WithLocation(3),
src\Analyzers\CSharp\Tests\ValidateFormatString\ValidateFormatStringTests.cs (24)
642diagnosticSeverity: DiagnosticSeverity.Info,
677diagnosticSeverity: DiagnosticSeverity.Info,
695diagnosticSeverity: DiagnosticSeverity.Info,
713diagnosticSeverity: DiagnosticSeverity.Info,
732diagnosticSeverity: DiagnosticSeverity.Info,
751diagnosticSeverity: DiagnosticSeverity.Info,
770diagnosticSeverity: DiagnosticSeverity.Info,
790diagnosticSeverity: DiagnosticSeverity.Info,
810diagnosticSeverity: DiagnosticSeverity.Info,
828diagnosticSeverity: DiagnosticSeverity.Info,
846diagnosticSeverity: DiagnosticSeverity.Info,
864diagnosticSeverity: DiagnosticSeverity.Info,
882diagnosticSeverity: DiagnosticSeverity.Info,
901diagnosticSeverity: DiagnosticSeverity.Info,
920diagnosticSeverity: DiagnosticSeverity.Info,
939diagnosticSeverity: DiagnosticSeverity.Info,
966diagnosticSeverity: DiagnosticSeverity.Info,
985diagnosticSeverity: DiagnosticSeverity.Info,
1004diagnosticSeverity: DiagnosticSeverity.Info,
1023diagnosticSeverity: DiagnosticSeverity.Info,
1042diagnosticSeverity: DiagnosticSeverity.Info,
1061diagnosticSeverity: DiagnosticSeverity.Info,
1080diagnosticSeverity: DiagnosticSeverity.Info,
1099diagnosticSeverity: DiagnosticSeverity.Info,
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (120)
Semantics\NullableReferenceTypesTests.cs (22)
125133Assert.Equal(DiagnosticSeverity.Warning, diagnostics.Single().Severity);
125142Assert.Equal(DiagnosticSeverity.Warning, diagnostics.Single().Severity);
125151Assert.Equal(DiagnosticSeverity.Warning, diagnostics.Single().Severity);
125162Assert.Equal(DiagnosticSeverity.Warning, diagnostics.Single().Severity);
125171Assert.Equal(DiagnosticSeverity.Error, diagnostics.Single().Severity);
125182Assert.Equal(DiagnosticSeverity.Error, diagnostics.Single().Severity);
125192Assert.Equal(DiagnosticSeverity.Error, diagnostics.Single().Severity);
125217Assert.Equal(DiagnosticSeverity.Hidden, diagnostics.Single().Severity);
125228Assert.Equal(DiagnosticSeverity.Hidden, diagnostics.Single().Severity);
125238Assert.Equal(DiagnosticSeverity.Warning, diagnostics.Single().Severity);
125249Assert.Equal(DiagnosticSeverity.Warning, diagnostics.Single().Severity);
125468Assert.Equal(DiagnosticSeverity.Warning, diagnostics.Single().Severity);
125477Assert.Equal(DiagnosticSeverity.Warning, diagnostics.Single().Severity);
125486Assert.Equal(DiagnosticSeverity.Warning, diagnostics.Single().Severity);
125497Assert.Equal(DiagnosticSeverity.Warning, diagnostics.Single().Severity);
125506Assert.Equal(DiagnosticSeverity.Error, diagnostics.Single().Severity);
125517Assert.Equal(DiagnosticSeverity.Error, diagnostics.Single().Severity);
125527Assert.Equal(DiagnosticSeverity.Error, diagnostics.Single().Severity);
125552Assert.Equal(DiagnosticSeverity.Hidden, diagnostics.Single().Severity);
125563Assert.Equal(DiagnosticSeverity.Hidden, diagnostics.Single().Severity);
125573Assert.Equal(DiagnosticSeverity.Warning, diagnostics.Single().Severity);
125584Assert.Equal(DiagnosticSeverity.Warning, diagnostics.Single().Severity);
Semantics\RecordStructTests.cs (8)
6019new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
6248new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
6344new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
6473new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
6570new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
6628new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
6721new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
6882new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
Semantics\TopLevelStatementsTests.cs (13)
6424new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
6523new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
6598new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
6707new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
6788new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
6846new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
6904new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
6972new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
7052new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
7168new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
7262new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
7334new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
7401new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
SourceGeneration\GeneratorDriverTests.cs (36)
178new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
433DiagnosticDescriptor generatorDiagnostic = new DiagnosticDescriptor("TG001", "Test Diagnostic", description, "Generators", DiagnosticSeverity.Warning, isEnabledByDefault: true, description: description);
662DiagnosticDescriptor generatorDiagnostic1 = new DiagnosticDescriptor("TG001", "Test Diagnostic", description, "Generators", DiagnosticSeverity.Warning, isEnabledByDefault: true, description: description);
663DiagnosticDescriptor generatorDiagnostic2 = new DiagnosticDescriptor("TG002", "Test Diagnostic", description, "Generators", DiagnosticSeverity.Warning, isEnabledByDefault: true, description: description);
664DiagnosticDescriptor generatorDiagnostic3 = new DiagnosticDescriptor("TG003", "Test Diagnostic", description, "Generators", DiagnosticSeverity.Warning, isEnabledByDefault: true, description: description);
709DiagnosticDescriptor generatorDiagnostic1 = new DiagnosticDescriptor("TG001", "Test Diagnostic", description, "Generators", DiagnosticSeverity.Warning, isEnabledByDefault: true, description: description);
710DiagnosticDescriptor generatorDiagnostic2 = new DiagnosticDescriptor("TG002", "Test Diagnostic", description, "Generators", DiagnosticSeverity.Warning, isEnabledByDefault: true, description: description);
711DiagnosticDescriptor generatorDiagnostic3 = new DiagnosticDescriptor("TG003", "Test Diagnostic", description, "Generators", DiagnosticSeverity.Warning, isEnabledByDefault: true, description: description);
1164c.ReportDiagnostic(CSDiagnostic.Create("GEN001", "generators", "message", DiagnosticSeverity.Warning, DiagnosticSeverity.Warning, true, 2));
1165c.ReportDiagnostic(CSDiagnostic.Create("GEN002", "generators", "message", DiagnosticSeverity.Warning, DiagnosticSeverity.Warning, true, 3));
1215var gen001 = CSDiagnostic.Create("GEN001", "generators", "message", DiagnosticSeverity.Warning, DiagnosticSeverity.Warning, true, 2);
1286var gen001 = CSDiagnostic.Create("GEN001", "generators", "message", DiagnosticSeverity.Warning, DiagnosticSeverity.Warning, isEnabledByDefault: true, warningLevel: 2);
3752DiagnosticSeverity.Warning,
3753DiagnosticSeverity.Warning,
3785DiagnosticSeverity.Warning,
3786DiagnosticSeverity.Warning,
3816DiagnosticSeverity.Warning,
3817DiagnosticSeverity.Warning,
3846DiagnosticSeverity.Warning,
3847DiagnosticSeverity.Warning,
3878DiagnosticSeverity.Warning,
3879DiagnosticSeverity.Warning,
3910DiagnosticSeverity.Warning,
3911DiagnosticSeverity.Warning,
3941DiagnosticSeverity.Warning,
3942DiagnosticSeverity.Warning,
3970DiagnosticSeverity.Warning,
3971DiagnosticSeverity.Warning,
4002DiagnosticSeverity.Warning,
4003DiagnosticSeverity.Warning,
4032DiagnosticSeverity.Warning,
4033DiagnosticSeverity.Warning,
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (8)
Symbols\Source\NullablePublicAPITests.cs (4)
1157private static readonly DiagnosticDescriptor s_descriptor1 = new DiagnosticDescriptor(id: "CA9999_NullabilityPrinter", title: "CA9999_NullabilityPrinter", messageFormat: "Nullability of '{0}' is '{1}':'{2}'. Speculative flow state is '{3}'", category: "Test", defaultSeverity: DiagnosticSeverity.Warning, isEnabledByDefault: true);
1158private static readonly DiagnosticDescriptor s_descriptor2 = new DiagnosticDescriptor(id: "CA9998_NullabilityPrinter", title: "CA9998_NullabilityPrinter", messageFormat: "Declared nullability of '{0}' is '{1}'", category: "Test", defaultSeverity: DiagnosticSeverity.Warning, isEnabledByDefault: true);
1779new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
4832new DiagnosticDescriptor("XY0000", "Test", "Test", "Test", DiagnosticSeverity.Warning, true, "Test", "Test");
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (19)
Diagnostics\LocationsTests.cs (6)
505var diagnostic = CodeAnalysis.Diagnostic.Create("CS0000", "", "msg", DiagnosticSeverity.Warning, DiagnosticSeverity.Warning, true, 1, location: location);
523var diagnosticWithoutMapping = CodeAnalysis.Diagnostic.Create("CS0000", "", "msg", DiagnosticSeverity.Warning, DiagnosticSeverity.Warning, true, 1, location: locationWithoutMapping);
526var diagnosticWithMapping = CodeAnalysis.Diagnostic.Create("CS0000", "", "msg", DiagnosticSeverity.Warning, DiagnosticSeverity.Warning, true, 1, location: locationWithMapping);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (4)
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (3)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (29)
CodeFixes\CodeFixServiceTests.cs (4)
523var descriptor = new DiagnosticDescriptor(diagnosticId, "MockDiagnostic", "MockDiagnostic", category, DiagnosticSeverity.Warning, isEnabledByDefault: true);
604private readonly DiagnosticDescriptor s_descriptor = new(MockFixer.Id, "Title", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
910private readonly DiagnosticDescriptor _descriptor = new(DiagnosticId, "AdditionalFileAnalyzer", "AdditionalFileAnalyzer", "AdditionalFileAnalyzer", DiagnosticSeverity.Warning, isEnabledByDefault: true);
1172public static readonly DiagnosticDescriptor Descriptor = new("ID0001", "Title", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
Diagnostics\DiagnosticAnalyzerServiceTests.cs (15)
328using var workspace = CreateWorkspaceWithProjectAndAnalyzer(new NamedTypeAnalyzer(DiagnosticSeverity.Hidden));
339using var workspace = CreateWorkspaceWithProjectAndAnalyzer(new NamedTypeAnalyzer(DiagnosticSeverity.Hidden));
350using var workspace = CreateWorkspaceWithProjectAndAnalyzer(new NamedTypeAnalyzer(DiagnosticSeverity.Hidden));
697var analyzer1 = new NamedTypeAnalyzerWithConfigurableEnabledByDefault(isEnabledByDefault: true, DiagnosticSeverity.Warning, throwOnAllNamedTypes: false);
915internal static readonly DiagnosticDescriptor s_syntaxRule = new DiagnosticDescriptor("syntax", "test", "test", "test", DiagnosticSeverity.Error, isEnabledByDefault: true);
916internal static readonly DiagnosticDescriptor s_semanticRule = new DiagnosticDescriptor("semantic", "test", "test", "test", DiagnosticSeverity.Error, isEnabledByDefault: true);
917internal static readonly DiagnosticDescriptor s_compilationRule = new DiagnosticDescriptor("compilation", "test", "test", "test", DiagnosticSeverity.Error, isEnabledByDefault: true);
931internal static readonly DiagnosticDescriptor s_syntaxRule = new DiagnosticDescriptor("syntax", "test", "test", "test", DiagnosticSeverity.Error, isEnabledByDefault: false);
932internal static readonly DiagnosticDescriptor s_semanticRule = new DiagnosticDescriptor("semantic", "test", "test", "test", DiagnosticSeverity.Error, isEnabledByDefault: false);
933internal static readonly DiagnosticDescriptor s_compilationRule = new DiagnosticDescriptor("compilation", "test", "test", "test", DiagnosticSeverity.Error, isEnabledByDefault: false);
947internal static readonly DiagnosticDescriptor s_syntaxRule = new DiagnosticDescriptor("syntax", "test", "test", "test", DiagnosticSeverity.Error, isEnabledByDefault: true);
1009internal static readonly DiagnosticDescriptor s_syntaxRule = new DiagnosticDescriptor("leak", "test", "test", "test", DiagnosticSeverity.Error, isEnabledByDefault: true);
1025private static readonly DiagnosticDescriptor s_rule = new DiagnosticDescriptor("project", "test", "test", "test", DiagnosticSeverity.Error, isEnabledByDefault: true);
1036public NamedTypeAnalyzer(DiagnosticSeverity defaultSeverity = DiagnosticSeverity.Warning)
Diagnostics\DiagnosticDataTests.cs (10)
118severity: DiagnosticSeverity.Info,
119defaultSeverity: DiagnosticSeverity.Info,
151severity: DiagnosticSeverity.Info,
152defaultSeverity: DiagnosticSeverity.Info,
186severity: DiagnosticSeverity.Info,
187defaultSeverity: DiagnosticSeverity.Info,
234severity: DiagnosticSeverity.Info,
235defaultSeverity: DiagnosticSeverity.Info,
282severity: DiagnosticSeverity.Info,
283defaultSeverity: DiagnosticSeverity.Info,
Microsoft.CodeAnalysis.EditorFeatures.Wpf (9)
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (16)
Diagnostics\DiagnosticProviderTests.vb (3)
336Return CreateDiagnostic(id, message, DiagnosticSeverity.Error, docId, projId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile)
341Return CreateDiagnostic(id, message, DiagnosticSeverity.Warning, docId, projId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile)
344Private Shared Function CreateDiagnostic(id As String, message As String, severity As DiagnosticSeverity, docId As DocumentId, projId As ProjectId, mappedLine As Integer, originalLine As Integer, mappedColumn As Integer,
Diagnostics\DiagnosticServiceTests.vb (11)
309Assert.Equal(DiagnosticSeverity.Error, diagnostics(0).Severity)
1244Public Shared Descriptor1 As New DiagnosticDescriptor("MustOverrideMethodDiagnostic", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
1363Public Shared Descriptor1 As New DiagnosticDescriptor("FieldDeclarationDiagnostic", "DummyDescription", "{0}", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
1443DiagnosticSeverity.Warning,
1472DiagnosticSeverity.Warning,
1517DiagnosticSeverity.Warning,
1758DiagnosticSeverity.Warning,
1871DiagnosticSeverity.Warning,
2118Dim analyzer = New CompilationAnalyzerWithSeverity(DiagnosticSeverity.Hidden, configurable:=False)
2377Public Property Descriptor As New DiagnosticDescriptor("ID0001", "Title", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
2492Public Shared s_descriptor As DiagnosticDescriptor = New DiagnosticDescriptor("ID0001", "Title", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (6)
Microsoft.CodeAnalysis.ExternalAccess.FSharp (4)
Microsoft.CodeAnalysis.Features (57)
EditAndContinue\EditAndContinueDiagnosticDescriptors.cs (9)
40void add(int index, int id, string resourceName, LocalizableResourceString title, DiagnosticSeverity severity)
57void AddRudeEdit(RudeEditKind kind, string resourceName, DiagnosticSeverity severity = DiagnosticSeverity.Error)
60void AddGeneralDiagnostic(EditAndContinueErrorCode code, string resourceName, DiagnosticSeverity severity = DiagnosticSeverity.Error)
150AddRudeEdit(RudeEditKind.UpdateMightNotHaveAnyEffect, nameof(FeaturesResources.Changing_0_might_not_have_any_effect_until_the_application_is_restarted), DiagnosticSeverity.Warning);
169AddGeneralDiagnostic(EditAndContinueErrorCode.DocumentIsOutOfSyncWithDebuggee, nameof(FeaturesResources.DocumentIsOutOfSyncWithDebuggee), DiagnosticSeverity.Warning);
170AddGeneralDiagnostic(EditAndContinueErrorCode.UnableToReadSourceFileOrPdb, nameof(FeaturesResources.UnableToReadSourceFileOrPdb), DiagnosticSeverity.Warning);
198DiagnosticSeverity.Error,
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
39DiagnosticSeverity.Info,
Microsoft.CodeAnalysis.Features.UnitTests (10)
Microsoft.CodeAnalysis.InteractiveHost (2)
Microsoft.CodeAnalysis.LanguageServer.Protocol (31)
Features\CodeFixes\CodeFixService.cs (5)
136var preferredMap = diagnostic.Severity == DiagnosticSeverity.Error
288=> GetDocumentFixAllForIdInSpanAsync(document, range, diagnosticId, DiagnosticSeverity.Hidden, cancellationToken);
291TextDocument document, TextSpan range, string diagnosticId, DiagnosticSeverity minimumSeverity, CancellationToken cancellationToken)
336=> ApplyCodeFixesForSpecificDiagnosticIdAsync(document, diagnosticId, DiagnosticSeverity.Hidden, progressTracker, cancellationToken);
341DiagnosticSeverity severity,
Features\CodeFixes\ICodeFixService.cs (3)
27Task<CodeFixCollection?> GetDocumentFixAllForIdInSpanAsync(TextDocument document, TextSpan textSpan, string diagnosticId, DiagnosticSeverity severity, CancellationToken cancellationToken);
28Task<TDocument> ApplyCodeFixesForSpecificDiagnosticIdAsync<TDocument>(TDocument document, string diagnosticId, DiagnosticSeverity severity, IProgress<CodeAnalysisProgress> progressTracker, CancellationToken cancellationToken)
45=> service.ApplyCodeFixesForSpecificDiagnosticIdAsync(document, diagnosticId, DiagnosticSeverity.Hidden, progressTracker, cancellationToken);
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (13)
Diagnostics\BuildOnlyDiagnosticIdsHandlerTests.cs (2)
86private static readonly DiagnosticDescriptor s_descriptor = new(Id, "Title", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true, customTags: [WellKnownDiagnosticTags.CompilationEnd]);
98private static readonly DiagnosticDescriptor s_descriptor = new(Id, "Title", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
Diagnostics\NonLocalDiagnosticTests.cs (2)
76public static readonly DiagnosticDescriptor NonLocalDescriptor = new("NonLocal0001", "Title1", "NonLocal0001", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
77public static readonly DiagnosticDescriptor CompilationEndDescriptor = new("NonLocal0002", "Title2", "NonLocal0002", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true, customTags: [WellKnownDiagnosticTags.CompilationEnd]);
Diagnostics\PullDiagnosticTests.cs (4)
130private readonly DiagnosticDescriptor _descriptor = new(RuleId, "Title", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
144private readonly DiagnosticDescriptor _descriptor = new(RuleId, "Title", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
1283severity: DiagnosticSeverity.Error,
1284defaultSeverity: DiagnosticSeverity.Error,
Microsoft.CodeAnalysis.Scripting (5)
Microsoft.CodeAnalysis.Scripting.TestUtilities (1)
Microsoft.CodeAnalysis.Test.Utilities (182)
Diagnostics\CommonDiagnosticAnalyzers.cs (82)
36defaultSeverity: DiagnosticSeverity.Warning,
47defaultSeverity: DiagnosticSeverity.Error,
109var effectiveSeverity1 = warnAsError || Descriptor1.DefaultSeverity == DiagnosticSeverity.Error ? "error" : "warning";
110var effectiveSeverity2 = warnAsError || Descriptor2.DefaultSeverity == DiagnosticSeverity.Error ? "error" : "warning";
151""defaultLevel"": """ + (Descriptor1.DefaultSeverity == DiagnosticSeverity.Error ? "error" : "warning") + @""",
165""defaultLevel"": """ + (Descriptor2.DefaultSeverity == DiagnosticSeverity.Error ? "error" : "warning") + @""",
192""level"": """ + (Descriptor1.DefaultSeverity == DiagnosticSeverity.Error ? "error" : "warning") + @""",
216""level"": """ + (Descriptor2.DefaultSeverity == DiagnosticSeverity.Error ? "error" : "warning") + @""",
228""defaultLevel"": """ + (Descriptor1.DefaultSeverity == DiagnosticSeverity.Error ? "error" : "warning") + @""",
242""defaultLevel"": """ + (Descriptor2.DefaultSeverity == DiagnosticSeverity.Error ? "error" : "warning") + @""",
264var effectiveSeverity1 = warnAsError || Descriptor1.DefaultSeverity == DiagnosticSeverity.Error ? "error" : "warning";
265var effectiveSeverity2 = warnAsError || Descriptor2.DefaultSeverity == DiagnosticSeverity.Error ? "error" : "warning";
326""level"": """ + (Descriptor1.DefaultSeverity == DiagnosticSeverity.Error ? "error" : "warning") + @""",
358""level"": """ + (Descriptor2.DefaultSeverity == DiagnosticSeverity.Error ? "error" : "warning") + @""",
487""level"": """ + (Descriptor2.DefaultSeverity == DiagnosticSeverity.Error ? "error" : "warning") + @"""
538defaultSeverity: DiagnosticSeverity.Warning,
547defaultSeverity: DiagnosticSeverity.Warning,
587defaultSeverity: DiagnosticSeverity.Warning,
595defaultSeverity: DiagnosticSeverity.Warning,
646defaultSeverity: DiagnosticSeverity.Warning,
672public const DiagnosticSeverity Severity = DiagnosticSeverity.Warning;
711public const DiagnosticSeverity Severity = DiagnosticSeverity.Warning;
740defaultSeverity: DiagnosticSeverity.Warning,
755defaultSeverity: DiagnosticSeverity.Warning,
778public const DiagnosticSeverity Severity = DiagnosticSeverity.Warning;
818defaultSeverity: DiagnosticSeverity.Warning,
849defaultSeverity: DiagnosticSeverity.Warning,
870defaultSeverity: DiagnosticSeverity.Warning,
891defaultSeverity: DiagnosticSeverity.Warning,
927defaultSeverity: DiagnosticSeverity.Warning,
995defaultSeverity: DiagnosticSeverity.Warning,
1034defaultSeverity: DiagnosticSeverity.Warning,
1053DiagnosticSeverity severity,
1096DiagnosticSeverity.Warning,
1126DiagnosticSeverity.Warning,
1195DiagnosticSeverity.Warning,
1237defaultSeverity: DiagnosticSeverity.Warning,
1382defaultSeverity: DiagnosticSeverity.Warning,
1408defaultSeverity: DiagnosticSeverity.Warning,
1458defaultSeverity: DiagnosticSeverity.Warning,
1483DiagnosticSeverity.Warning,
1491DiagnosticSeverity.Error,
1499DiagnosticSeverity.Warning,
1507DiagnosticSeverity.Warning,
1688DiagnosticSeverity.Warning,
1728DiagnosticSeverity.Warning,
1736DiagnosticSeverity.Warning,
1744DiagnosticSeverity.Warning,
1752DiagnosticSeverity.Warning,
1852defaultSeverity: DiagnosticSeverity.Warning,
1892defaultSeverity: DiagnosticSeverity.Warning,
1900defaultSeverity: DiagnosticSeverity.Warning,
1908defaultSeverity: DiagnosticSeverity.Warning,
1916defaultSeverity: DiagnosticSeverity.Warning,
1924defaultSeverity: DiagnosticSeverity.Warning,
1932defaultSeverity: DiagnosticSeverity.Warning,
1940defaultSeverity: DiagnosticSeverity.Warning,
1948defaultSeverity: DiagnosticSeverity.Warning,
1956defaultSeverity: DiagnosticSeverity.Warning,
2374severity: DiagnosticSeverity.Warning,
2375defaultSeverity: DiagnosticSeverity.Warning,
2411defaultSeverity: DiagnosticSeverity.Warning,
2476defaultSeverity: DiagnosticSeverity.Warning,
2494private readonly DiagnosticSeverity _reportedSeverity;
2496public NamedTypeAnalyzerWithConfigurableEnabledByDefault(bool isEnabledByDefault, DiagnosticSeverity defaultSeverity, bool throwOnAllNamedTypes = false)
2501public NamedTypeAnalyzerWithConfigurableEnabledByDefault(bool isEnabledByDefault, DiagnosticSeverity defaultSeverity, bool customConfigurable, bool throwOnAllNamedTypes)
2508DiagnosticSeverity defaultSeverity,
2509DiagnosticSeverity reportedSeverity,
2557defaultSeverity: DiagnosticSeverity.Warning,
2586defaultSeverity: DiagnosticSeverity.Warning,
2632defaultSeverity: DiagnosticSeverity.Warning,
2674defaultSeverity: DiagnosticSeverity.Warning,
2705private static readonly DiagnosticDescriptor s_descriptor = new("ID0001", "Title", "{0}", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
2869defaultSeverity: DiagnosticSeverity.Warning,
2908new DiagnosticDescriptor(DiagnosticId, "test", "test", "test", DiagnosticSeverity.Warning, isEnabledByDefault: true);
2975private static readonly DiagnosticDescriptor s_descriptor = new("ID0001", "Title", "Message", "Category", DiagnosticSeverity.Warning, isEnabledByDefault: true);
3082defaultSeverity: DiagnosticSeverity.Warning,
3231defaultSeverity: DiagnosticSeverity.Warning,
3234public DiagnosticSeverity MinimumReportedSeverity { get; private set; }
Diagnostics\OperationTestAnalyzer.cs (68)
27DiagnosticSeverity.Warning,
35DiagnosticSeverity.Warning,
43DiagnosticSeverity.Warning,
89DiagnosticSeverity.Warning,
130DiagnosticSeverity.Warning,
303DiagnosticSeverity.Warning,
311DiagnosticSeverity.Warning,
319DiagnosticSeverity.Warning,
499DiagnosticSeverity.Warning,
507DiagnosticSeverity.Warning,
515DiagnosticSeverity.Warning,
523DiagnosticSeverity.Warning,
616DiagnosticSeverity.Warning,
653DiagnosticSeverity.Warning,
693DiagnosticSeverity.Warning,
701DiagnosticSeverity.Warning,
739DiagnosticSeverity.Warning,
780DiagnosticSeverity.Warning,
820DiagnosticSeverity.Warning,
828DiagnosticSeverity.Warning,
877DiagnosticSeverity.Warning,
885DiagnosticSeverity.Warning,
935DiagnosticSeverity.Warning,
943DiagnosticSeverity.Warning,
969DiagnosticSeverity.Warning,
977DiagnosticSeverity.Warning,
985DiagnosticSeverity.Warning,
993DiagnosticSeverity.Warning,
1001DiagnosticSeverity.Warning,
1009DiagnosticSeverity.Warning,
1017DiagnosticSeverity.Warning,
1082DiagnosticSeverity.Warning,
1090DiagnosticSeverity.Warning,
1171DiagnosticSeverity.Warning,
1213DiagnosticSeverity.Warning,
1242DiagnosticSeverity.Warning,
1250DiagnosticSeverity.Warning,
1283DiagnosticSeverity.Warning,
1291DiagnosticSeverity.Warning,
1300DiagnosticSeverity.Warning,
1352DiagnosticSeverity.Warning,
1361DiagnosticSeverity.Warning,
1431DiagnosticSeverity.Warning,
1439DiagnosticSeverity.Warning,
1481DiagnosticSeverity.Warning,
1489DiagnosticSeverity.Warning,
1497DiagnosticSeverity.Warning,
1505DiagnosticSeverity.Warning,
1558DiagnosticSeverity.Warning,
1589DiagnosticSeverity.Warning,
1597DiagnosticSeverity.Warning,
1671DiagnosticSeverity.Warning,
1681DiagnosticSeverity.Warning,
1757DiagnosticSeverity.Warning,
1765DiagnosticSeverity.Warning,
1773DiagnosticSeverity.Warning,
1824DiagnosticSeverity.Warning,
1832DiagnosticSeverity.Warning,
1881DiagnosticSeverity.Warning,
1913DiagnosticSeverity.Warning,
1952DiagnosticSeverity.Warning,
1960DiagnosticSeverity.Warning,
1994DiagnosticSeverity.Warning,
2002DiagnosticSeverity.Warning,
2038DiagnosticSeverity.Warning,
2068DiagnosticSeverity.Warning,
2096DiagnosticSeverity.Warning,
2128DiagnosticSeverity.Warning,
Microsoft.CodeAnalysis.UnitTests (24)
Diagnostics\SarifErrorLoggerTests.cs (15)
38var descriptor = new DiagnosticDescriptor("TST", "_TST_", "", "", DiagnosticSeverity.Error, false);
55new DiagnosticDescriptor("TST001-001", "_TST001-001_", "", "", DiagnosticSeverity.Warning, true),
56new DiagnosticDescriptor("TST001", "_TST001_", "", "", DiagnosticSeverity.Warning, true),
57new DiagnosticDescriptor("TST001", "_TST001-002_", "", "", DiagnosticSeverity.Warning, true),
58new DiagnosticDescriptor("TST001", "_TST001-003_", "", "", DiagnosticSeverity.Warning, true),
61new DiagnosticDescriptor("TST002", "", "", "", DiagnosticSeverity.Warning, true),
62new DiagnosticDescriptor("TST002", "", "", "", DiagnosticSeverity.Warning, true),
65new DiagnosticDescriptor("TST002", "", "messageFormat", "", DiagnosticSeverity.Warning, true),
68new DiagnosticDescriptor("TST002", "title_001", "", "", DiagnosticSeverity.Warning, true),
69new DiagnosticDescriptor("TST002", "", "", "category_002", DiagnosticSeverity.Warning, true),
70new DiagnosticDescriptor("TST002", "", "", "", DiagnosticSeverity.Error /*003*/, true),
71new DiagnosticDescriptor("TST002", "", "", "", DiagnosticSeverity.Warning, isEnabledByDefault: false /*004*/),
72new DiagnosticDescriptor("TST002", "", "", "", DiagnosticSeverity.Warning, true, "description_005"),
119DiagnosticSeverity.Warning,
120DiagnosticSeverity.Warning,
Microsoft.CodeAnalysis.VisualBasic (36)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests (25)
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (109)
CommandLineTests.vb (109)
9896Dim analyzer = New CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable:=True)
9940analyzer = New CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable:=False)
9962Dim analyzer = New CompilationAnalyzerWithSeverity(DiagnosticSeverity.Error, configurable:=True)
10168Public Sub TestAnalyzerFilteringBasedOnSeverity(defaultSeverity As DiagnosticSeverity, errorlog As Boolean, customConfigurable As Boolean)
10173Dim analyzerShouldBeSkipped = (defaultSeverity = DiagnosticSeverity.Hidden OrElse
10174defaultSeverity = DiagnosticSeverity.Info AndAlso Not errorlog) AndAlso Not customConfigurable
10204Public Sub TestWarnAsErrorMinusDoesNotEnableDisabledByDefaultAnalyzers(defaultSeverity As DiagnosticSeverity, isEnabledByDefault As Boolean, customConfigurable As Boolean)
10211defaultSeverity = DiagnosticSeverity.Hidden OrElse
10212defaultSeverity = DiagnosticSeverity.Info) AndAlso
10229Dim expectedExitCode = If(Not analyzerShouldBeSkipped AndAlso defaultSeverity = DiagnosticSeverity.[Error], 1, 0)
10234(customConfigurable AndAlso (defaultSeverity = DiagnosticSeverity.Hidden OrElse defaultSeverity = DiagnosticSeverity.Info)) Then
10237Dim prefix = If(defaultSeverity = DiagnosticSeverity.Warning, "warning", "error")
10244<InlineData(False, False, DiagnosticSeverity.Info, DiagnosticSeverity.Warning, Nothing, DiagnosticSeverity.Error)>
10245<InlineData(True, False, DiagnosticSeverity.Info, DiagnosticSeverity.Warning, Nothing, DiagnosticSeverity.Warning)>
10246<InlineData(False, True, DiagnosticSeverity.Info, DiagnosticSeverity.Warning, Nothing, DiagnosticSeverity.Error)>
10247<InlineData(True, True, DiagnosticSeverity.Info, DiagnosticSeverity.Warning, Nothing, DiagnosticSeverity.Warning)>
10248<InlineData(False, False, DiagnosticSeverity.Info, Nothing, DiagnosticSeverity.Warning, DiagnosticSeverity.Error)>
10249<InlineData(True, False, DiagnosticSeverity.Info, Nothing, DiagnosticSeverity.Warning, DiagnosticSeverity.Warning)>
10250<InlineData(False, True, DiagnosticSeverity.Info, Nothing, DiagnosticSeverity.Warning, DiagnosticSeverity.Error)>
10251<InlineData(True, True, DiagnosticSeverity.Info, Nothing, DiagnosticSeverity.Warning, DiagnosticSeverity.Warning)>
10252<InlineData(False, False, DiagnosticSeverity.Warning, Nothing, Nothing, DiagnosticSeverity.Error)>
10253<InlineData(True, False, DiagnosticSeverity.Warning, Nothing, Nothing, DiagnosticSeverity.Warning)>
10254<InlineData(False, True, DiagnosticSeverity.Warning, Nothing, Nothing, DiagnosticSeverity.Error)>
10255<InlineData(True, True, DiagnosticSeverity.Warning, Nothing, Nothing, DiagnosticSeverity.Warning)>
10256<InlineData(False, False, DiagnosticSeverity.Warning, DiagnosticSeverity.Error, Nothing, DiagnosticSeverity.Error)>
10257<InlineData(True, False, DiagnosticSeverity.Warning, DiagnosticSeverity.Error, Nothing, DiagnosticSeverity.Warning)>
10258<InlineData(False, True, DiagnosticSeverity.Warning, DiagnosticSeverity.Error, Nothing, DiagnosticSeverity.Error)>
10259<InlineData(True, True, DiagnosticSeverity.Warning, DiagnosticSeverity.Error, Nothing, DiagnosticSeverity.Warning)>
10260<InlineData(False, False, DiagnosticSeverity.Info, DiagnosticSeverity.Error, Nothing, DiagnosticSeverity.Error)>
10261<InlineData(True, False, DiagnosticSeverity.Info, DiagnosticSeverity.Error, Nothing, DiagnosticSeverity.Error)>
10262<InlineData(False, True, DiagnosticSeverity.Info, DiagnosticSeverity.Error, Nothing, DiagnosticSeverity.Error)>
10263<InlineData(True, True, DiagnosticSeverity.Info, DiagnosticSeverity.Error, Nothing, DiagnosticSeverity.Error)>
10264<InlineData(False, False, DiagnosticSeverity.Info, Nothing, DiagnosticSeverity.Error, DiagnosticSeverity.Error)>
10265<InlineData(True, False, DiagnosticSeverity.Info, Nothing, DiagnosticSeverity.Error, DiagnosticSeverity.Error)>
10266<InlineData(False, True, DiagnosticSeverity.Info, Nothing, DiagnosticSeverity.Error, DiagnosticSeverity.Error)>
10267<InlineData(True, True, DiagnosticSeverity.Info, Nothing, DiagnosticSeverity.Error, DiagnosticSeverity.Error)>
10268<InlineData(False, False, DiagnosticSeverity.Warning, Nothing, DiagnosticSeverity.Error, DiagnosticSeverity.Error)>
10269<InlineData(True, False, DiagnosticSeverity.Warning, Nothing, DiagnosticSeverity.Error, DiagnosticSeverity.Error)>
10270<InlineData(False, True, DiagnosticSeverity.Warning, Nothing, DiagnosticSeverity.Error, DiagnosticSeverity.Error)>
10271<InlineData(True, True, DiagnosticSeverity.Warning, Nothing, DiagnosticSeverity.Error, DiagnosticSeverity.Error)>
10274defaultSeverity As DiagnosticSeverity,
10275severityInConfigFile As DiagnosticSeverity?,
10276customConfiguredSeverityByAnalyzer As DiagnosticSeverity?,
10277expectedEffectiveSeverity As DiagnosticSeverity)
10312Case DiagnosticSeverity.Warning
10314Case DiagnosticSeverity.[Error]
10481Dim analyzer = New CompilationAnalyzerWithSeverity(DiagnosticSeverity.Warning, configurable:=True)
10975Friend Shared ReadOnly Hidden01 As DiagnosticDescriptor = New DiagnosticDescriptor("Hidden01", "", "Throwing a diagnostic for #ExternalSource", "", DiagnosticSeverity.Hidden, isEnabledByDefault:=True)
10999Friend Shared ReadOnly Info01 As DiagnosticDescriptor = New DiagnosticDescriptor("Info01", "", "Throwing a diagnostic for #Enable", "", DiagnosticSeverity.Info, isEnabledByDefault:=True)
11000Friend Shared ReadOnly Info02 As DiagnosticDescriptor = New DiagnosticDescriptor("Info02", "", "Throwing a diagnostic for something else", "", DiagnosticSeverity.Info, isEnabledByDefault:=True)
11024Friend Shared ReadOnly Warning01 As DiagnosticDescriptor = New DiagnosticDescriptor("Warning01", "", "Throwing a diagnostic for types declared", "", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
11025Friend Shared ReadOnly Warning02 As DiagnosticDescriptor = New DiagnosticDescriptor("Warning02", "", "Throwing a diagnostic for something else", "", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
11026Friend Shared ReadOnly Warning03 As DiagnosticDescriptor = New DiagnosticDescriptor("Warning03", "", "Throwing a diagnostic for types declared", "", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
11050Friend Shared ReadOnly Warning04 As DiagnosticDescriptor = New DiagnosticDescriptor("Warning04", "", "Throwing a diagnostic for types declared", "", DiagnosticSeverity.Warning, isEnabledByDefault:=True, helpLinkUri:="https://example.org/analyzer")
11074Friend Shared ReadOnly Error01 As DiagnosticDescriptor = New DiagnosticDescriptor("Error01", "", "Throwing a diagnostic for #Disable", "", DiagnosticSeverity.Error, isEnabledByDefault:=True)
11097Friend Shared ReadOnly Rule As DiagnosticDescriptor = New DiagnosticDescriptor("AdditionalFileDiagnostic", "", "Additional File Diagnostic: {0}", "", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (4)
Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler (1)
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (16)
Diagnostics\Suppression\SuppressionTests.vb (6)
697Private ReadOnly _descriptor As New DiagnosticDescriptor("InfoDiagnostic", "InfoDiagnostic", "InfoDiagnostic", "InfoDiagnostic", DiagnosticSeverity.Info, isEnabledByDefault:=True)
772Private ReadOnly _descriptor As New DiagnosticDescriptor("#$DiagnosticWithBadId", "DiagnosticWithBadId", "DiagnosticWithBadId", "DiagnosticWithBadId", DiagnosticSeverity.Info, isEnabledByDefault:=True)
816Private ReadOnly _descriptor As New DiagnosticDescriptor("REm", "REm Title", "REm", "REm", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
882Private ReadOnly _descriptor As New DiagnosticDescriptor("ErrorDiagnostic", "ErrorDiagnostic", "ErrorDiagnostic", "ErrorDiagnostic", DiagnosticSeverity.[Error], isEnabledByDefault:=True)
1002Private ReadOnly _descriptor As New DiagnosticDescriptor("InfoDiagnostic", "InfoDiagnostic", "InfoDiagnostic", "InfoDiagnostic", DiagnosticSeverity.Info, isEnabledByDefault:=True)
1718Private ReadOnly _descriptor As New DiagnosticDescriptor("InfoDiagnostic", "InfoDiagnostic", "InfoDiagnostic", "InfoDiagnostic", DiagnosticSeverity.Info, isEnabledByDefault:=True)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (86)
Diagnostics\DiagnosticAnalyzerTests.vb (41)
27Private Shared ReadOnly s_CA9999_UseOfVariableThatStartsWithX As DiagnosticDescriptor = New DiagnosticDescriptor(id:="CA9999_UseOfVariableThatStartsWithX", title:="CA9999_UseOfVariableThatStartsWithX", messageFormat:="Use of variable whose name starts with 'x': '{0}'", category:="Test", defaultSeverity:=DiagnosticSeverity.Warning, isEnabledByDefault:=True)
49Dim noneDiagDescriptor = New DiagnosticDescriptor("XX0001", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Hidden, isEnabledByDefault:=True)
50Dim infoDiagDescriptor = New DiagnosticDescriptor("XX0002", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Info, isEnabledByDefault:=True)
51Dim warningDiagDescriptor = New DiagnosticDescriptor("XX0003", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
52Dim errorDiagDescriptor = New DiagnosticDescriptor("XX0004", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Error, isEnabledByDefault:=True)
72Assert.True(effectiveDiag.Severity = DiagnosticSeverity.Error)
104Case DiagnosticSeverity.Hidden
107Case DiagnosticSeverity.Info
111Case DiagnosticSeverity.Warning
115Case DiagnosticSeverity.Error
130Dim noneDiagDescriptor = New DiagnosticDescriptor("XX0001", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Hidden, isEnabledByDefault:=True)
131Dim infoDiagDescriptor = New DiagnosticDescriptor("XX0002", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Info, isEnabledByDefault:=True)
132Dim warningDiagDescriptor = New DiagnosticDescriptor("XX0003", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
133Dim errorDiagDescriptor = New DiagnosticDescriptor("XX0004", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.[Error], isEnabledByDefault:=True)
157Assert.Equal(1, effectiveDiags.Count(Function(d) d.Severity = DiagnosticSeverity.Error))
158Assert.Equal(1, effectiveDiags.Count(Function(d) d.Severity = DiagnosticSeverity.Warning))
164Assert.Equal(1, effectiveDiags.Count(Function(d) d.Severity = DiagnosticSeverity.Error))
165Assert.Equal(1, effectiveDiags.Count(Function(d) d.Severity = DiagnosticSeverity.Info))
171Assert.Equal(1, effectiveDiags.Count(Function(d) d.Severity = DiagnosticSeverity.Error))
172Assert.Equal(1, effectiveDiags.Count(Function(d) d.Severity = DiagnosticSeverity.Hidden))
178Assert.Equal(1, effectiveDiags.Count(Function(d) d.Severity = DiagnosticSeverity.Error))
179Assert.Equal(1, effectiveDiags.Count(Function(d) d.Severity = DiagnosticSeverity.Hidden))
185Dim disabledDiagDescriptor = New DiagnosticDescriptor("XX001", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=False)
186Dim enabledDiagDescriptor = New DiagnosticDescriptor("XX002", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
215Public Shared desc1 As New DiagnosticDescriptor("XX001", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=False)
216Public Shared desc2 As New DiagnosticDescriptor("XX002", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=False)
231Public Shared desc1 As New DiagnosticDescriptor("XX003", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=False)
232Public Shared desc2 As New DiagnosticDescriptor("XX004", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
265Public Shared desc1 As New DiagnosticDescriptor("XX001", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
303Public Shared desc1 As New DiagnosticDescriptor("XX001", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
348Public Shared desc1 As New DiagnosticDescriptor("XX001", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
497Public Shared desc1 As New DiagnosticDescriptor("FieldSymbolDiagnostic", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
562Public Shared desc1 As New DiagnosticDescriptor("FieldDeclarationDiagnostic", "DummyDescription", "DummyMessage", "DummyCategory", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
752Private Shared Sub TestEffectiveSeverity(defaultSeverity As DiagnosticSeverity, expectedEffectiveSeverity As ReportDiagnostic, Optional specificOptions As Dictionary(Of String, ReportDiagnostic) = Nothing, Optional generalOption As ReportDiagnostic = ReportDiagnostic.Default, Optional isEnabledByDefault As Boolean = True)
766TestEffectiveSeverity(DiagnosticSeverity.Warning, ReportDiagnostic.Warn)
776TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity:=ReportDiagnostic.Warn, specificOptions:=specificOptions, generalOption:=generalOption)
784TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity:=generalOption, generalOption:=generalOption)
795TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity:=specificOption, specificOptions:=specificOptions, generalOption:=generalOption)
805TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity:=ReportDiagnostic.Suppress, generalOption:=generalOption, isEnabledByDefault:=enabledByDefault)
817TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity:=specificOption, specificOptions:=specificOptions, generalOption:=generalOption, isEnabledByDefault:=enabledByDefault)
950Public Shared ReadOnly ExpressionDescriptor As New DiagnosticDescriptor("Expression", "Expression", "Expression found.", "Testing", DiagnosticSeverity.Warning, isEnabledByDefault:=True)
Diagnostics\GetDiagnosticsTests.vb (16)
104Assert.Equal(DiagnosticSeverity.Warning, diag.Severity)
107Dim [error] = diag.WithSeverity(DiagnosticSeverity.Error)
108Assert.Equal(DiagnosticSeverity.Error, [error].Severity)
109Assert.Equal(DiagnosticSeverity.Warning, [error].DefaultSeverity)
112Dim warning = [error].WithSeverity(DiagnosticSeverity.Warning)
113Assert.Equal(DiagnosticSeverity.Warning, warning.Severity)
114Assert.Equal(DiagnosticSeverity.Warning, warning.DefaultSeverity)
117Dim hidden = warning.WithSeverity(DiagnosticSeverity.Hidden)
118Assert.Equal(DiagnosticSeverity.Hidden, hidden.Severity)
119Assert.Equal(DiagnosticSeverity.Warning, hidden.DefaultSeverity)
122Dim info = warning.WithSeverity(DiagnosticSeverity.Info)
123Assert.Equal(DiagnosticSeverity.Info, info.Severity)
124Assert.Equal(DiagnosticSeverity.Warning, info.DefaultSeverity)
587Public Shared ReadOnly Descriptor As DiagnosticDescriptor = New DiagnosticDescriptor("ID0001", "Title", "{0}", "Category", defaultSeverity:=DiagnosticSeverity.Warning, isEnabledByDefault:=True)
588Public Shared ReadOnly DescriptorForBlockEnd As DiagnosticDescriptor = New DiagnosticDescriptor("ID0002", "Title", "Message", "Category", defaultSeverity:=DiagnosticSeverity.Warning, isEnabledByDefault:=True)
711Public Shared ReadOnly Descriptor As New DiagnosticDescriptor("ID0001", "Title", "Message", "Category", defaultSeverity:=DiagnosticSeverity.Warning, isEnabledByDefault:=True)
SourceGeneration\GeneratorDriverTests.vb (28)
187c.ReportDiagnostic(VBDiagnostic.Create("GEN001", "generators", "message", DiagnosticSeverity.Warning, DiagnosticSeverity.Warning, True, 2))
188c.ReportDiagnostic(VBDiagnostic.Create("GEN002", "generators", "message", DiagnosticSeverity.Warning, DiagnosticSeverity.Warning, True, 3))
221Dim gen001 = VBDiagnostic.Create("GEN001", "generators", "message", DiagnosticSeverity.Warning, DiagnosticSeverity.Warning, True, 2)
253Dim gen001 = VBDiagnostic.Create("GEN001", "generators", "message", DiagnosticSeverity.Warning, DiagnosticSeverity.Warning, True, 2)
308DiagnosticSeverity.Warning,
309DiagnosticSeverity.Warning,
339DiagnosticSeverity.Warning,
340DiagnosticSeverity.Warning,
370DiagnosticSeverity.Warning,
371DiagnosticSeverity.Warning,
400DiagnosticSeverity.Warning,
401DiagnosticSeverity.Warning,
430DiagnosticSeverity.Warning,
431DiagnosticSeverity.Warning,
460DiagnosticSeverity.Warning,
461DiagnosticSeverity.Warning,
491DiagnosticSeverity.Warning,
492DiagnosticSeverity.Warning,
520DiagnosticSeverity.Warning,
521DiagnosticSeverity.Warning,
550DiagnosticSeverity.Warning,
551DiagnosticSeverity.Warning,
580DiagnosticSeverity.Warning,
581DiagnosticSeverity.Warning,
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (2)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (8)
Parser\ParseDirectives.vb (4)
3183New DiagnosticDescriptor("sOMEID", "something1", "something2", "something3", DiagnosticSeverity.Warning, isEnabledByDefault:=True),
3290"something1", "something2", "something3", DiagnosticSeverity.Warning, isEnabledByDefault:=True),
3621New DiagnosticDescriptor("TestId", "something1", "something2", "something3", DiagnosticSeverity.Warning, isEnabledByDefault:=True),
3648New DiagnosticDescriptor("TestId", "something1", "something2", "something3", DiagnosticSeverity.Warning, isEnabledByDefault:=True),
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (4)
Microsoft.CodeAnalysis.Workspaces (64)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (7)
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
Microsoft.DotNet.CodeAnalysis (6)
Analyzers\AppContextDefaultsAnalyzer.cs (3)
27new DiagnosticDescriptor(DiagnosticIds.BCL0010.ToString(), s_title, CreateDiagnosticMessage(s_defaultValueNotInitializedToTrue, DiagnosticIds.BCL0010.ToString()), s_analyzerName, DiagnosticSeverity.Error, isEnabledByDefault: true, description: s_description);
30new DiagnosticDescriptor(DiagnosticIds.BCL0011.ToString(), s_title, CreateDiagnosticMessage(s_defaultValueInsideUnexpectedIfCondition, DiagnosticIds.BCL0011.ToString()), s_analyzerName, DiagnosticSeverity.Error, isEnabledByDefault: true, description: s_description);
33new DiagnosticDescriptor(DiagnosticIds.BCL0012.ToString(), s_title, CreateDiagnosticMessage(s_defaultValueDefinedOutsideIfCondition, DiagnosticIds.BCL0012.ToString()), s_analyzerName, DiagnosticSeverity.Error, isEnabledByDefault: true, description: s_description);
Microsoft.Extensions.Logging.Generators (27)
DiagnosticDescriptors.cs (26)
17DiagnosticSeverity.Error,
25DiagnosticSeverity.Warning,
33DiagnosticSeverity.Error,
41DiagnosticSeverity.Error,
49DiagnosticSeverity.Info,
57DiagnosticSeverity.Error,
65DiagnosticSeverity.Error,
73DiagnosticSeverity.Warning,
81DiagnosticSeverity.Error,
89DiagnosticSeverity.Error,
97DiagnosticSeverity.Warning,
105DiagnosticSeverity.Warning,
113DiagnosticSeverity.Error,
121DiagnosticSeverity.Warning,
129DiagnosticSeverity.Error,
137DiagnosticSeverity.Error,
145DiagnosticSeverity.Warning,
153DiagnosticSeverity.Error,
161DiagnosticSeverity.Error,
169DiagnosticSeverity.Error,
177DiagnosticSeverity.Error,
185DiagnosticSeverity.Error,
193DiagnosticSeverity.Error,
201DiagnosticSeverity.Warning,
209defaultSeverity: DiagnosticSeverity.Error,
217DiagnosticSeverity.Info,
Microsoft.Extensions.Options.SourceGeneration (10)
Microsoft.Gen.ComplianceReports (1)
Microsoft.Gen.ComplianceReports.Unit.Tests (1)
Microsoft.Gen.ContextualOptions (4)
Microsoft.Gen.Logging (17)
Microsoft.Gen.MetadataExtractor (5)
Microsoft.Gen.MetadataExtractor.Unit.Tests (1)
Microsoft.Gen.Metrics (2)
Microsoft.Gen.MetricsReports (3)
Microsoft.Gen.MetricsReports.Unit.Tests (1)
Microsoft.Interop.ComInterfaceGenerator (51)
GeneratorDiagnostics.cs (43)
42DiagnosticSeverity.Error,
53DiagnosticSeverity.Error,
64DiagnosticSeverity.Error,
75DiagnosticSeverity.Error,
86DiagnosticSeverity.Error,
97DiagnosticSeverity.Error,
108DiagnosticSeverity.Error,
119DiagnosticSeverity.Error,
130DiagnosticSeverity.Error,
141DiagnosticSeverity.Error,
151DiagnosticSeverity.Error,
162DiagnosticSeverity.Error,
173DiagnosticSeverity.Error,
184DiagnosticSeverity.Error,
195DiagnosticSeverity.Error,
206DiagnosticSeverity.Error,
217DiagnosticSeverity.Error,
228DiagnosticSeverity.Error,
239DiagnosticSeverity.Error,
250DiagnosticSeverity.Error,
261DiagnosticSeverity.Error,
272DiagnosticSeverity.Error,
283DiagnosticSeverity.Error,
294DiagnosticSeverity.Error,
305DiagnosticSeverity.Error,
316DiagnosticSeverity.Error,
327DiagnosticSeverity.Error,
338DiagnosticSeverity.Error,
349DiagnosticSeverity.Error,
360DiagnosticSeverity.Error,
371DiagnosticSeverity.Error,
382DiagnosticSeverity.Error,
393DiagnosticSeverity.Error,
404DiagnosticSeverity.Error,
415DiagnosticSeverity.Warning,
426DiagnosticSeverity.Info,
441DiagnosticSeverity.Info,
456DiagnosticSeverity.Warning,
466DiagnosticSeverity.Warning,
476DiagnosticSeverity.Info,
486DiagnosticSeverity.Info,
496DiagnosticSeverity.Info,
507DiagnosticSeverity.Warning,
Microsoft.Interop.JavaScript.JSImportGenerator (16)
GeneratorDiagnostics.cs (15)
39DiagnosticSeverity.Error,
49DiagnosticSeverity.Error,
59DiagnosticSeverity.Error,
69DiagnosticSeverity.Error,
79DiagnosticSeverity.Error,
89DiagnosticSeverity.Error,
99DiagnosticSeverity.Error,
109DiagnosticSeverity.Error,
119DiagnosticSeverity.Error,
129DiagnosticSeverity.Error,
139DiagnosticSeverity.Error,
149DiagnosticSeverity.Error,
159DiagnosticSeverity.Error,
169DiagnosticSeverity.Error,
179DiagnosticSeverity.Error,
Microsoft.Interop.LibraryImportGenerator (69)
Analyzers\CustomMarshallerAttributeAnalyzer.cs (43)
49DiagnosticSeverity.Error,
60DiagnosticSeverity.Error,
71DiagnosticSeverity.Error,
82DiagnosticSeverity.Error,
93DiagnosticSeverity.Error,
104DiagnosticSeverity.Error,
115DiagnosticSeverity.Error,
126DiagnosticSeverity.Error,
137DiagnosticSeverity.Error,
148DiagnosticSeverity.Error,
159DiagnosticSeverity.Error,
170DiagnosticSeverity.Error,
181DiagnosticSeverity.Error,
192DiagnosticSeverity.Error,
203DiagnosticSeverity.Error,
214DiagnosticSeverity.Error,
225DiagnosticSeverity.Error,
236DiagnosticSeverity.Error,
247DiagnosticSeverity.Error,
258DiagnosticSeverity.Error,
269DiagnosticSeverity.Error,
280DiagnosticSeverity.Error,
291DiagnosticSeverity.Error,
302DiagnosticSeverity.Error,
313DiagnosticSeverity.Error,
324DiagnosticSeverity.Warning,
335DiagnosticSeverity.Warning,
346DiagnosticSeverity.Warning,
357DiagnosticSeverity.Warning,
368DiagnosticSeverity.Warning,
379DiagnosticSeverity.Error,
390DiagnosticSeverity.Error,
401DiagnosticSeverity.Error,
419DiagnosticSeverity.Info,
430DiagnosticSeverity.Info,
441DiagnosticSeverity.Info,
452DiagnosticSeverity.Info,
463DiagnosticSeverity.Info,
474DiagnosticSeverity.Info,
485DiagnosticSeverity.Info,
496DiagnosticSeverity.Info,
507DiagnosticSeverity.Info,
518DiagnosticSeverity.Info,
GeneratorDiagnostics.cs (21)
38DiagnosticSeverity.Error,
49DiagnosticSeverity.Error,
60DiagnosticSeverity.Error,
71DiagnosticSeverity.Error,
82DiagnosticSeverity.Error,
93DiagnosticSeverity.Error,
104DiagnosticSeverity.Error,
115DiagnosticSeverity.Error,
126DiagnosticSeverity.Error,
137DiagnosticSeverity.Error,
148DiagnosticSeverity.Error,
159DiagnosticSeverity.Error,
170DiagnosticSeverity.Error,
181DiagnosticSeverity.Error,
192DiagnosticSeverity.Error,
203DiagnosticSeverity.Error,
214DiagnosticSeverity.Info,
229DiagnosticSeverity.Info,
244DiagnosticSeverity.Warning,
254DiagnosticSeverity.Warning,
264DiagnosticSeverity.Info,
Microsoft.Interop.LibraryImportGenerator.Downlevel (22)
GeneratorDiagnostics.cs (21)
38DiagnosticSeverity.Error,
49DiagnosticSeverity.Error,
60DiagnosticSeverity.Error,
71DiagnosticSeverity.Error,
82DiagnosticSeverity.Error,
93DiagnosticSeverity.Error,
104DiagnosticSeverity.Error,
115DiagnosticSeverity.Error,
126DiagnosticSeverity.Error,
137DiagnosticSeverity.Error,
148DiagnosticSeverity.Error,
159DiagnosticSeverity.Error,
170DiagnosticSeverity.Error,
181DiagnosticSeverity.Error,
192DiagnosticSeverity.Error,
203DiagnosticSeverity.Error,
214DiagnosticSeverity.Info,
229DiagnosticSeverity.Info,
244DiagnosticSeverity.Warning,
254DiagnosticSeverity.Warning,
264DiagnosticSeverity.Info,
Microsoft.Maui.Controls.BindingSourceGen (10)
DiagnosticsFactory.cs (10)
26 defaultSeverity: DiagnosticSeverity.Error,
37 defaultSeverity: DiagnosticSeverity.Error,
48 defaultSeverity: DiagnosticSeverity.Error,
59 defaultSeverity: DiagnosticSeverity.Hidden,
70 defaultSeverity: DiagnosticSeverity.Error,
81 defaultSeverity: DiagnosticSeverity.Error,
92 defaultSeverity: DiagnosticSeverity.Error,
103 defaultSeverity: DiagnosticSeverity.Error,
114 defaultSeverity: DiagnosticSeverity.Error,
125 defaultSeverity: DiagnosticSeverity.Error,
Microsoft.Maui.Controls.SourceGen (1)
Microsoft.ML.CodeAnalyzer.Tests (11)
Code\ContractsCheckTest.cs (9)
29new DiagnosticResult("CS0051", DiagnosticSeverity.Error).WithLocation(15, 16).WithMessage("Inconsistent accessibility: parameter type 'IHostEnvironment' is less accessible than method 'TypeName.TypeName(IHostEnvironment, float, int)'"),
42new DiagnosticResult("CS0122", DiagnosticSeverity.Error).WithSpan("/0/Test1.cs", 752, 24, 752, 35).WithMessage("'ICancelable' is inaccessible due to its protection level"),
43new DiagnosticResult("CS0122", DiagnosticSeverity.Error).WithSpan("/0/Test1.cs", 752, 67, 752, 77).WithMessage("'ICancelable.IsCanceled' is inaccessible due to its protection level"),
129new DiagnosticResult("CS0122", DiagnosticSeverity.Error).WithSpan("/0/Test1.cs", 752, 24, 752, 35).WithMessage("'ICancelable' is inaccessible due to its protection level"),
130new DiagnosticResult("CS0122", DiagnosticSeverity.Error).WithSpan("/0/Test1.cs", 752, 67, 752, 77).WithMessage("'ICancelable.IsCanceled' is inaccessible due to its protection level"),
131new DiagnosticResult("CS1503", DiagnosticSeverity.Error).WithSpan("/0/Test1.cs", 753, 90, 753, 93).WithMessage("Argument 2: cannot convert from 'Microsoft.ML.Runtime.IHostEnvironment' to 'Microsoft.ML.Runtime.IExceptionContext'"),
149new DiagnosticResult("CS0122", DiagnosticSeverity.Error).WithSpan("/0/Test1.cs", 752, 24, 752, 35).WithMessage("'ICancelable' is inaccessible due to its protection level"),
150new DiagnosticResult("CS0122", DiagnosticSeverity.Error).WithSpan("/0/Test1.cs", 752, 67, 752, 77).WithMessage("'ICancelable.IsCanceled' is inaccessible due to its protection level"),
151new DiagnosticResult("CS1503", DiagnosticSeverity.Error).WithSpan("/0/Test1.cs", 753, 90, 753, 93).WithMessage("Argument 2: cannot convert from 'Microsoft.ML.Runtime.IHostEnvironment' to 'Microsoft.ML.Runtime.IExceptionContext'"),
Microsoft.ML.InternalCodeAnalyzer (13)
Microsoft.VisualStudio.LanguageServices (22)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
Microsoft.VisualStudio.LanguageServices.UnitTests (8)
Microsoft.VisualStudio.LanguageServices.VisualBasic (1)
Mvc.Analyzers.Test (2)
Roslyn.Test.PdbUtilities (2)
Roslyn.VisualStudio.Next.UnitTests (8)
Services\VisualStudioDiagnosticAnalyzerExecutorTests.cs (8)
54Assert.Equal(DiagnosticSeverity.Hidden, diagnostics[0].Severity);
62Assert.Equal(isHostAnalyzer ? DiagnosticSeverity.Info : DiagnosticSeverity.Hidden, diagnostics[0].Severity);
92Assert.Equal(DiagnosticSeverity.Info, diagnostics[0].Severity);
101Assert.Equal(isHostAnalyzer ? DiagnosticSeverity.Error : DiagnosticSeverity.Info, diagnostics[0].Severity);
266[new DiagnosticDescriptor("test", "test", "test", "test", DiagnosticSeverity.Error, isEnabledByDefault: true)];
286[new DiagnosticDescriptor("test", "test", "test", "test", DiagnosticSeverity.Error, isEnabledByDefault: true)];
SemanticSearch.BuildTask.UnitTests (3)
System.Private.CoreLib.Generators (4)
IntrinsicsInSystemPrivateCoreLibAnalyzer.cs (4)
34private static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Error, isEnabledByDefault: true, description: Description);
38private static readonly DiagnosticDescriptor RuleHelper = new DiagnosticDescriptor(DiagnosticIdHelper, Title, MessageHelperFormat, Category, DiagnosticSeverity.Error, isEnabledByDefault: true, description: Description);
42private static readonly DiagnosticDescriptor RuleCantParse = new DiagnosticDescriptor(DiagnosticIdConditionParsing, Title, MessageNonParseableConditionFormat, Category, DiagnosticSeverity.Error, isEnabledByDefault: true, description: Description);
46private static readonly DiagnosticDescriptor RuleAttributeNotSpecificEnough = new DiagnosticDescriptor(DiagnosticIdAttributeNotSpecificEnough, Title, MessageAttributeNotSpecificEnoughFormat, Category, DiagnosticSeverity.Error, isEnabledByDefault: true, description: Description);
System.Text.Json.SourceGeneration (16)
JsonSourceGenerator.DiagnosticDescriptors.cs (15)
20defaultSeverity: DiagnosticSeverity.Warning,
28defaultSeverity: DiagnosticSeverity.Warning,
36defaultSeverity: DiagnosticSeverity.Warning,
44defaultSeverity: DiagnosticSeverity.Error,
52defaultSeverity: DiagnosticSeverity.Warning,
60defaultSeverity: DiagnosticSeverity.Error,
68defaultSeverity: DiagnosticSeverity.Error,
76defaultSeverity: DiagnosticSeverity.Warning,
84defaultSeverity: DiagnosticSeverity.Warning,
92defaultSeverity: DiagnosticSeverity.Warning,
100defaultSeverity: DiagnosticSeverity.Error,
108defaultSeverity: DiagnosticSeverity.Warning,
116defaultSeverity: DiagnosticSeverity.Warning,
124defaultSeverity: DiagnosticSeverity.Warning,
132defaultSeverity: DiagnosticSeverity.Warning,
System.Text.RegularExpressions.Generator (7)
System.Windows.Forms.Analyzers (2)
System.Windows.Forms.Analyzers.CSharp (5)
System.Windows.Forms.Analyzers.CSharp.Tests (2)
System.Windows.Forms.Analyzers.VisualBasic (2)
System.Windows.Forms.PrivateSourceGenerators (2)
System.Windows.Forms.PrivateSourceGenerators.Tests (1)
VBCSCompiler.UnitTests (1)