2137 references to ReportDiagnostic
AnalyzerRunner (2)
BuildActionTelemetryTable (27)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (21)
34public static ReportDiagnostic GetEffectiveSeverity(
38ImmutableDictionary<string, ReportDiagnostic>? treeOptions)
40var effectiveSeverity = descriptor.GetEffectiveSeverity(compilationOptions);
45(!compilationOptions.SpecificDiagnosticOptions.TryGetValue(descriptor.Id, out var reportDiagnostic) ||
46reportDiagnostic == ReportDiagnostic.Default))
48if (treeOptions.TryGetValue(descriptor.Id, out reportDiagnostic) && reportDiagnostic != ReportDiagnostic.Default ||
51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
64public static ReportDiagnostic GetEffectiveSeverity(this DiagnosticDescriptor descriptor, CompilationOptions compilationOptions, SyntaxTree tree, AnalyzerOptions analyzerOptions)
66var effectiveSeverity = descriptor.GetEffectiveSeverity(compilationOptions);
70if (!compilationOptions.SpecificDiagnosticOptions.TryGetValue(descriptor.Id, out var reportDiagnostic) ||
71reportDiagnostic == ReportDiagnostic.Default)
78var severityInEditorConfig = descriptor.GetEffectiveSeverity(analyzerConfigOptions, providerAndTree);
79if (severityInEditorConfig != ReportDiagnostic.Default)
86var severityInGlobalConfig = descriptor.GetEffectiveSeverity(analyzerOptions.AnalyzerConfigOptionsProvider.GlobalOptions, providerAndTree);
87if (severityInGlobalConfig != ReportDiagnostic.Default)
102EditorConfigSeverityStrings.TryParse(value, out var severity))
145public static ReportDiagnostic GetEffectiveSeverity(
150ReportDiagnostic severity;
182return ReportDiagnostic.Default;
203return ReportDiagnostic.Default;
217out ReportDiagnostic severity)
CodeStyleConfigFileGenerator (13)
Microsoft.AspNetCore.Analyzer.Testing (2)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (7)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (5)
Microsoft.CodeAnalysis (186)
Compilation\SyntaxTreeOptionsProvider.cs (7)
21public abstract bool TryGetDiagnosticValue(SyntaxTree tree, string diagnosticId, CancellationToken cancellationToken, out ReportDiagnostic severity);
26public abstract bool TryGetGlobalDiagnosticValue(string diagnosticId, CancellationToken cancellationToken, out ReportDiagnostic severity);
34public readonly ImmutableDictionary<string, ReportDiagnostic> DiagnosticOptions;
77public override bool TryGetDiagnosticValue(SyntaxTree tree, string diagnosticId, CancellationToken _, out ReportDiagnostic severity)
83severity = ReportDiagnostic.Default;
87public override bool TryGetGlobalDiagnosticValue(string diagnosticId, CancellationToken _, out ReportDiagnostic severity)
93severity = ReportDiagnostic.Default;
RuleSet\RuleSet.cs (53)
29private readonly ReportDiagnostic _generalDiagnosticOption;
33public ReportDiagnostic GeneralDiagnosticOption
38private readonly ImmutableDictionary<string, ReportDiagnostic> _specificDiagnosticOptions;
42public ImmutableDictionary<string, ReportDiagnostic> SpecificDiagnosticOptions
59public RuleSet(string filePath, ReportDiagnostic generalOption, ImmutableDictionary<string, ReportDiagnostic> specificOptions, ImmutableArray<RuleSetInclude> includes)
63_specificDiagnosticOptions = specificOptions == null ? ImmutableDictionary<string, ReportDiagnostic>.Empty : specificOptions;
70public RuleSet? WithEffectiveAction(ReportDiagnostic action)
79case ReportDiagnostic.Default:
81case ReportDiagnostic.Suppress:
83case ReportDiagnostic.Error:
84case ReportDiagnostic.Warn:
85case ReportDiagnostic.Info:
86case ReportDiagnostic.Hidden:
87var generalOption = _generalDiagnosticOption == ReportDiagnostic.Default ? ReportDiagnostic.Default : action;
91if (item.Value != ReportDiagnostic.Suppress && item.Value != ReportDiagnostic.Default)
107var effectiveGeneralOption = _generalDiagnosticOption;
108var effectiveSpecificOptions = new Dictionary<string, ReportDiagnostic>();
119if (ruleSetInclude.Action == ReportDiagnostic.Suppress)
157if (effectiveSpecificOptions.TryGetValue(item.Key, out var value))
225private static bool IsStricterThan(ReportDiagnostic action1, ReportDiagnostic action2)
229case ReportDiagnostic.Suppress:
231case ReportDiagnostic.Default:
232return action1 == ReportDiagnostic.Warn || action1 == ReportDiagnostic.Error || action1 == ReportDiagnostic.Info || action1 == ReportDiagnostic.Hidden;
233case ReportDiagnostic.Hidden:
234return action1 == ReportDiagnostic.Warn || action1 == ReportDiagnostic.Error || action1 == ReportDiagnostic.Info;
235case ReportDiagnostic.Info:
236return action1 == ReportDiagnostic.Warn || action1 == ReportDiagnostic.Error;
237case ReportDiagnostic.Warn:
238return action1 == ReportDiagnostic.Error;
239case ReportDiagnostic.Error:
280/// 1) A map of <paramref name="specificDiagnosticOptions"/> from rule ID to <see cref="ReportDiagnostic"/> option.
281/// 2) A global <see cref="ReportDiagnostic"/> option for all rules in the ruleset file.
283public static ReportDiagnostic GetDiagnosticOptionsFromRulesetFile(string? rulesetFileFullPath, out Dictionary<string, ReportDiagnostic> specificDiagnosticOptions)
288internal static ReportDiagnostic GetDiagnosticOptionsFromRulesetFile(string? rulesetFileFullPath, out Dictionary<string, ReportDiagnostic> diagnosticOptions, IList<Diagnostic>? diagnosticsOpt, CommonMessageProvider? messageProviderOpt)
290diagnosticOptions = new Dictionary<string, ReportDiagnostic>();
293return ReportDiagnostic.Default;
299private static ReportDiagnostic GetDiagnosticOptionsFromRulesetFile(Dictionary<string, ReportDiagnostic> diagnosticOptions, string resolvedPath, IList<Diagnostic>? diagnosticsOpt, CommonMessageProvider? messageProviderOpt)
303var generalDiagnosticOption = ReportDiagnostic.Default;
Microsoft.CodeAnalysis.CodeStyle (127)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\NotificationOption2.cs (18)
17[property: DataMember(Order = 0)] ReportDiagnostic Severity, [property: DataMember(Order = 1)] bool IsExplicitlySpecified)
20/// Notification option to disable or suppress an option with <see cref="ReportDiagnostic.Suppress"/>.
22public static NotificationOption2 None => new(ReportDiagnostic.Suppress, false);
25/// Notification option for a silent or hidden option with <see cref="ReportDiagnostic.Hidden"/>.
27public static NotificationOption2 Silent => new(ReportDiagnostic.Hidden, false);
30/// Notification option for a suggestion or an info option with <see cref="ReportDiagnostic.Info"/>.
32public static NotificationOption2 Suggestion => new(ReportDiagnostic.Info, false);
35/// Notification option for a warning option with <see cref="ReportDiagnostic.Warn"/>.
37public static NotificationOption2 Warning => new(ReportDiagnostic.Warn, false);
40/// Notification option for an error option with <see cref="ReportDiagnostic.Error"/>.
42public static NotificationOption2 Error => new(ReportDiagnostic.Error, false);
47public static NotificationOption2 ForSeverity(ReportDiagnostic reportDiagnostic)
50ReportDiagnostic.Error => Error,
51ReportDiagnostic.Warn => Warning,
52ReportDiagnostic.Info => Suggestion,
53ReportDiagnostic.Hidden or ReportDiagnostic.Default => Silent,
54ReportDiagnostic.Suppress => None,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (21)
34public static ReportDiagnostic GetEffectiveSeverity(
38ImmutableDictionary<string, ReportDiagnostic>? treeOptions)
40var effectiveSeverity = descriptor.GetEffectiveSeverity(compilationOptions);
45(!compilationOptions.SpecificDiagnosticOptions.TryGetValue(descriptor.Id, out var reportDiagnostic) ||
46reportDiagnostic == ReportDiagnostic.Default))
48if (treeOptions.TryGetValue(descriptor.Id, out reportDiagnostic) && reportDiagnostic != ReportDiagnostic.Default ||
51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
64public static ReportDiagnostic GetEffectiveSeverity(this DiagnosticDescriptor descriptor, CompilationOptions compilationOptions, SyntaxTree tree, AnalyzerOptions analyzerOptions)
66var effectiveSeverity = descriptor.GetEffectiveSeverity(compilationOptions);
70if (!compilationOptions.SpecificDiagnosticOptions.TryGetValue(descriptor.Id, out var reportDiagnostic) ||
71reportDiagnostic == ReportDiagnostic.Default)
78var severityInEditorConfig = descriptor.GetEffectiveSeverity(analyzerConfigOptions, providerAndTree);
79if (severityInEditorConfig != ReportDiagnostic.Default)
86var severityInGlobalConfig = descriptor.GetEffectiveSeverity(analyzerOptions.AnalyzerConfigOptionsProvider.GlobalOptions, providerAndTree);
87if (severityInGlobalConfig != ReportDiagnostic.Default)
102EditorConfigSeverityStrings.TryParse(value, out var severity))
145public static ReportDiagnostic GetEffectiveSeverity(
150ReportDiagnostic severity;
182return ReportDiagnostic.Default;
203return ReportDiagnostic.Default;
217out ReportDiagnostic severity)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ReportDiagnosticExtensions.cs (29)
14/// Returns the equivalent <see cref="DiagnosticSeverity"/> for a <see cref="ReportDiagnostic"/> value.
16/// <param name="reportDiagnostic">The <see cref="ReportDiagnostic"/> value.</param>
18/// The equivalent <see cref="DiagnosticSeverity"/> for a <see cref="ReportDiagnostic"/> value; otherwise,
25public static DiagnosticSeverity? ToDiagnosticSeverity(this ReportDiagnostic reportDiagnostic)
29case ReportDiagnostic.Error:
32case ReportDiagnostic.Warn:
35case ReportDiagnostic.Info:
38case ReportDiagnostic.Hidden:
41case ReportDiagnostic.Suppress:
42case ReportDiagnostic.Default:
51/// Applies a default severity to a <see cref="ReportDiagnostic"/> value.
53/// <param name="reportDiagnostic">The <see cref="ReportDiagnostic"/> value.</param>
56/// <para>If <paramref name="reportDiagnostic"/> is <see cref="ReportDiagnostic.Default"/>, returns
61public static ReportDiagnostic WithDefaultSeverity(this ReportDiagnostic reportDiagnostic, DiagnosticSeverity defaultSeverity)
63if (reportDiagnostic != ReportDiagnostic.Default)
71public static string ToEditorConfigString(this ReportDiagnostic reportDiagnostic)
75ReportDiagnostic.Suppress => EditorConfigSeverityStrings.None,
76ReportDiagnostic.Hidden => EditorConfigSeverityStrings.Silent,
77ReportDiagnostic.Info => EditorConfigSeverityStrings.Suggestion,
78ReportDiagnostic.Warn => EditorConfigSeverityStrings.Warning,
79ReportDiagnostic.Error => EditorConfigSeverityStrings.Error,
84public static NotificationOption2 ToNotificationOption(this ReportDiagnostic reportDiagnostic, DiagnosticSeverity defaultSeverity)
86var isNonDefault = reportDiagnostic != ReportDiagnostic.Default;
89ReportDiagnostic.Error => NotificationOption2.Error,
90ReportDiagnostic.Warn => NotificationOption2.Warning,
91ReportDiagnostic.Info => NotificationOption2.Suggestion,
92ReportDiagnostic.Hidden => NotificationOption2.Silent,
93ReportDiagnostic.Suppress => NotificationOption2.None,
Microsoft.CodeAnalysis.CodeStyle.Fixes (7)
Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities (26)
Microsoft.CodeAnalysis.CSharp (104)
CommandLine\CSharpCommandLineParser.cs (20)
117var generalDiagnosticOption = ReportDiagnostic.Default;
118var diagnosticOptions = new Dictionary<string, ReportDiagnostic>();
119var noWarns = new Dictionary<string, ReportDiagnostic>();
120var warnAsErrors = new Dictionary<string, ReportDiagnostic>();
245AddWarnings(noWarns, ReportDiagnostic.Suppress, valueMemory.Value);
884generalDiagnosticOption = ReportDiagnostic.Error;
891if (diagnosticOptions[key] == ReportDiagnostic.Warn)
893warnAsErrors[key] = ReportDiagnostic.Error;
906AddWarnings(warnAsErrors, ReportDiagnostic.Error, valueMemory.Value);
913generalDiagnosticOption = ReportDiagnostic.Default;
931ReportDiagnostic ruleSetValue;
938warnAsErrors[id] = ReportDiagnostic.Default;
2131private static void AddWarnings(Dictionary<string, ReportDiagnostic> d, ReportDiagnostic kind, ReadOnlyMemory<char> warningArgument)
2137ReportDiagnostic existing;
2141if (existing != ReportDiagnostic.Suppress)
2176private static void AddDiagnostic(IList<Diagnostic> diagnostics, Dictionary<string, ReportDiagnostic> warningOptions, ErrorCode errorCode, params object[] arguments)
2179ReportDiagnostic value;
2181if (value != ReportDiagnostic.Suppress)
CSharpCompilationOptions.cs (22)
63ReportDiagnostic generalDiagnosticOption = ReportDiagnostic.Default,
65IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions = null,
113ReportDiagnostic generalDiagnosticOption,
115IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions,
158ReportDiagnostic generalDiagnosticOption,
160IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions,
200ReportDiagnostic generalDiagnosticOption,
202IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions,
443protected override CompilationOptions CommonWithGeneralDiagnosticOption(ReportDiagnostic value) => WithGeneralDiagnosticOption(value);
445protected override CompilationOptions CommonWithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>? specificDiagnosticOptions) =>
448protected override CompilationOptions CommonWithSpecificDiagnosticOptions(IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions) =>
454public new CSharpCompilationOptions WithGeneralDiagnosticOption(ReportDiagnostic value)
464public new CSharpCompilationOptions WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>? values)
468values = ImmutableDictionary<string, ReportDiagnostic>.Empty;
479public new CSharpCompilationOptions WithSpecificDiagnosticOptions(IEnumerable<KeyValuePair<string, ReportDiagnostic>>? values) =>
829ReportDiagnostic generalDiagnosticOption,
831IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions,
868ReportDiagnostic generalDiagnosticOption,
870IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions,
912ReportDiagnostic generalDiagnosticOption,
914IEnumerable<KeyValuePair<string, ReportDiagnostic>>? specificDiagnosticOptions,
Syntax\CSharpSyntaxTree.cs (6)
336ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions,
456ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions,
494ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions,
914ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions,
926ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions,
938ImmutableDictionary<string, ReportDiagnostic>? diagnosticOptions)
Microsoft.CodeAnalysis.CSharp.CodeStyle (20)
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (158)
CommandLineTests.cs (153)
306Assert.True(compilerTreeOptions.TryGetDiagnosticValue(tree, "cs0169", CancellationToken.None, out var severity));
307Assert.Equal(ReportDiagnostic.Suppress, severity);
309Assert.Equal(ReportDiagnostic.Suppress, severity);
2841Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions["CA1012"] == ReportDiagnostic.Error);
2843Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions["CA1013"] == ReportDiagnostic.Warn);
2845Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions["CA1014"] == ReportDiagnostic.Suppress);
2846Assert.True(parsedArgs.CompilationOptions.GeneralDiagnosticOption == ReportDiagnostic.Warn);
3045Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Error);
3077Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Error);
3078Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Error);
3110Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Error);
3111Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Info);
3143Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Default);
3144Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Error);
3177Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Default);
3178Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Warn);
3211Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Error);
3212Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Warn);
3245Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Default);
3246Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Warn);
3247Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test002"], expected: ReportDiagnostic.Default);
3279Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption);
3281Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"]);
3314Assert.Equal(expected: ReportDiagnostic.Error, actual: arguments.CompilationOptions.GeneralDiagnosticOption);
3316Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"]);
3349Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption);
3351Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"]);
3373Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption);
3378Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions[warning]);
3381Assert.Equal(expected: ReportDiagnostic.Suppress,
3383Assert.Equal(expected: ReportDiagnostic.Suppress,
3406Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption);
3411Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions[warning]);
3414Assert.Equal(expected: ReportDiagnostic.Suppress,
3416Assert.Equal(expected: ReportDiagnostic.Suppress,
3439Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption);
3444Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions[warning]);
3447Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"]);
3448Assert.Equal(expected: ReportDiagnostic.Suppress,
3450Assert.Equal(expected: ReportDiagnostic.Suppress,
3473Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption);
3478Assert.Equal(expected: ReportDiagnostic.Error, actual: arguments.CompilationOptions.SpecificDiagnosticOptions[warning]);
3481Assert.Equal(expected: ReportDiagnostic.Error,
3483Assert.Equal(expected: ReportDiagnostic.Error,
5416private static void AssertSpecificDiagnostics(int[] expectedCodes, ReportDiagnostic[] expectedOptions, CSharpCommandLineArguments args)
5432Assert.Equal(ReportDiagnostic.Error, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5438Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5440AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Error }, parsedArgs);
5444Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5446AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Error }, parsedArgs);
5450Assert.Equal(ReportDiagnostic.Error, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5452AssertSpecificDiagnostics(new int[0], new ReportDiagnostic[0], parsedArgs);
5456Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5458AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Error }, parsedArgs);
5462Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5464AssertSpecificDiagnostics(new int[0], new ReportDiagnostic[0], parsedArgs);
5468Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5470AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Default, ReportDiagnostic.Default, ReportDiagnostic.Default }, parsedArgs);
5474Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5478new[] { ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Default, ReportDiagnostic.Default },
5483Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5486AssertSpecificDiagnostics(new[] { 1062, 1066, 1734, 1974 }, new[] { ReportDiagnostic.Default, ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Default }, parsedArgs);
5490Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5492AssertSpecificDiagnostics(new[] { 1062, 1066, 1734, 1974 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Default, ReportDiagnostic.Default, ReportDiagnostic.Error }, parsedArgs);
5496Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5498AssertSpecificDiagnostics(new int[0], new ReportDiagnostic[0], parsedArgs);
5502Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5504AssertSpecificDiagnostics(new int[0], new ReportDiagnostic[0], parsedArgs);
5508Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5510AssertSpecificDiagnostics(new[] { 1062, 1974 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Error }, parsedArgs);
5514Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5516AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Suppress }, parsedArgs);
5520Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5522AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Suppress }, parsedArgs);
5526Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5528AssertSpecificDiagnostics(new[] { 1062, 1066, 1734, 1762 }, new[] { ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Error }, parsedArgs);
5532Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5534AssertSpecificDiagnostics(new[] { 1062, 1066, 1734, 1762 }, new[] { ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Error }, parsedArgs);
13133TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Error);
13136TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress, noWarn: true);
13145TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn, rulesetText: rulesetText);
13152TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn);
13159TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn);
13166TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn);
13173TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn);
13179TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, warnAsError: true, expectedDiagnosticSeverity: ReportDiagnostic.Error);
13186TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress);
13193TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress);
13200TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText: string.Empty, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress);
13206TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress);
13212TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress);
13234var defaultReportDiagnostic = DiagnosticDescriptor.MapSeverityToReport(defaultSeverity);
13235var expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Error;
13242TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress, noWarn: true);
13251TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn, rulesetText: rulesetText);
13255expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Warn;
13272expectedDiagnosticSeverity = customConfigurable && defaultReportDiagnostic != ReportDiagnostic.Warn ? defaultReportDiagnostic : ReportDiagnostic.Error;
13281expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Suppress;
13292expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Suppress;
13298expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Suppress;
13324TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Error);
13331TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Error);
13339TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn);
13352TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn, rulesetText);
13359ReportDiagnostic expectedDiagnosticSeverity,
13404var expectedErrorCode = expectedDiagnosticSeverity == ReportDiagnostic.Error ? 1 : 0;
13409ReportDiagnostic.Error => "error",
13410ReportDiagnostic.Warn => "warning",
13411ReportDiagnostic.Info => errorlog ? "info" : null,
13412ReportDiagnostic.Hidden => null,
13413ReportDiagnostic.Suppress => null,
13592public void AnalyzerConfigRespectedForNoLocationDiagnostic(ReportDiagnostic reportDiagnostic, bool isEnabledByDefault, bool noWarn, bool errorlog)
13601public void AnalyzerConfigRespectedForDisabledByDefaultDiagnostic(ReportDiagnostic analyzerConfigSeverity, bool isEnabledByDefault, bool noWarn, bool errorlog, bool customConfigurable)
13607private void TestAnalyzerConfigRespectedCore(DiagnosticAnalyzer analyzer, DiagnosticDescriptor descriptor, ReportDiagnostic analyzerConfigSeverity, bool noWarn, bool errorlog, bool customConfigurable)
13609if (analyzerConfigSeverity == ReportDiagnostic.Default)
13649var expectedErrorCode = !noWarn && analyzerConfigSeverity == ReportDiagnostic.Error ? 1 : 0;
13654(analyzerConfigSeverity == ReportDiagnostic.Error ||
13655analyzerConfigSeverity == ReportDiagnostic.Warn ||
13656(analyzerConfigSeverity == ReportDiagnostic.Info && errorlog)))
13658var prefix = analyzerConfigSeverity == ReportDiagnostic.Error ? "error" : analyzerConfigSeverity == ReportDiagnostic.Warn ? "warning" : "info";
15607var comp = CreateCompilation(src, options: TestOptions.DebugExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress));
SarifV2ErrorLoggerTests.cs (5)
377(AnalyzerForErrorLogTest.Descriptor1.Id, 0, ImmutableHashSet.Create(ReportDiagnostic.Error))));
498(AnalyzerForErrorLogTest.Descriptor1.Id, 0, ImmutableHashSet.Create(ReportDiagnostic.Suppress)),
499(AnalyzerForErrorLogTest.Descriptor2.Id, 1, ImmutableHashSet.Create(ReportDiagnostic.Suppress))));
580(AnalyzerForErrorLogTest.Descriptor1.Id, 0, ImmutableHashSet.Create(ReportDiagnostic.Suppress, ReportDiagnostic.Warn))));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (27)
EditorConfigSettings\Updater\SettingsUpdaterTests.cs (17)
72private static async Task TestAsync(string initialEditorConfig, string updatedEditorConfig, params (AnalyzerSetting, ReportDiagnostic)[] options)
113[CombinatorialValues(ReportDiagnostic.Warn, ReportDiagnostic.Error, ReportDiagnostic.Info, ReportDiagnostic.Hidden, ReportDiagnostic.Suppress)]
114ReportDiagnostic severity)
134var analyzerSetting = new AnalyzerSetting(descriptor, ReportDiagnostic.Suppress, null!, language, new SettingLocation(EditorConfigSettings.LocationKind.VisualStudio, null));
333var analyzerSetting = new AnalyzerSetting(descriptor, ReportDiagnostic.Suppress, updater, Language.CSharp, new SettingLocation(EditorConfigSettings.LocationKind.VisualStudio, null));
334analyzerSetting.ChangeSeverity(ReportDiagnostic.Error);
357setting.ChangeSeverity(ReportDiagnostic.Error);
411setting0.ChangeSeverity(ReportDiagnostic.Error);
416Assert.Equal(ReportDiagnostic.Error, setting0.Severity);
418setting1.ChangeSeverity(ReportDiagnostic.Error);
419setting2.ChangeSeverity(ReportDiagnostic.Error);
424Assert.Equal(ReportDiagnostic.Error, setting0.Severity);
425Assert.Equal(ReportDiagnostic.Error, setting0.Severity);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (9)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (110)
Attributes\AttributeTests_WellKnownAttributes.cs (16)
8787verify(TestOptions.DebugDll.WithGeneralDiagnosticOption(ReportDiagnostic.Warn),
8793verify(TestOptions.DebugDll.WithGeneralDiagnosticOption(ReportDiagnostic.Error),
8799verify(TestOptions.DebugDll.WithGeneralDiagnosticOption(ReportDiagnostic.Hidden),
8804verify(TestOptions.DebugDll.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress));
8807verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("TEST1", ReportDiagnostic.Warn)),
8813verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("TEST1", ReportDiagnostic.Error)),
8819verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("TEST1", ReportDiagnostic.Hidden)),
8825verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("TEST1", ReportDiagnostic.Suppress)));
8828verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("CS0618", ReportDiagnostic.Error)),
8834verify(TestOptions.DebugDll.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add("CS0618", ReportDiagnostic.Suppress)),
Diagnostics\DiagnosticAnalyzerTests.cs (79)
145new[] { KeyValuePairUtil.Create("CA9999_UseOfVariableThatStartsWithX", ReportDiagnostic.Suppress) });
168new[] { KeyValuePairUtil.Create("CA9999_UseOfVariableThatStartsWithX", ReportDiagnostic.Error) });
200var options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Error);
286var options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Error);
316var specificDiagOptions = new Dictionary<string, ReportDiagnostic>();
317specificDiagOptions.Add(noneDiagDescriptor.Id, ReportDiagnostic.Error);
318specificDiagOptions.Add(infoDiagDescriptor.Id, ReportDiagnostic.Error);
319specificDiagOptions.Add(warningDiagDescriptor.Id, ReportDiagnostic.Error);
331specificDiagOptions = new Dictionary<string, ReportDiagnostic>();
332specificDiagOptions.Add(noneDiagDescriptor.Id, ReportDiagnostic.Suppress);
333specificDiagOptions.Add(infoDiagDescriptor.Id, ReportDiagnostic.Suppress);
334specificDiagOptions.Add(warningDiagDescriptor.Id, ReportDiagnostic.Suppress);
335specificDiagOptions.Add(errorDiagDescriptor.Id, ReportDiagnostic.Suppress);
343specificDiagOptions = new Dictionary<string, ReportDiagnostic>();
344specificDiagOptions.Add(noneDiagDescriptor.Id, ReportDiagnostic.Info);
345specificDiagOptions.Add(infoDiagDescriptor.Id, ReportDiagnostic.Hidden);
346specificDiagOptions.Add(warningDiagDescriptor.Id, ReportDiagnostic.Error);
347specificDiagOptions.Add(errorDiagDescriptor.Id, ReportDiagnostic.Warn);
399var options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Default);
404options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Error);
410options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Warn);
417options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Info);
424options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Hidden);
431options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress);
458var specificDiagOptions = new Dictionary<string, ReportDiagnostic>();
459specificDiagOptions.Add(disabledDiagDescriptor.Id, ReportDiagnostic.Warn);
460specificDiagOptions.Add(enabledDiagDescriptor.Id, ReportDiagnostic.Suppress);
530var specificDiagOptions = new Dictionary<string, ReportDiagnostic>();
531specificDiagOptions.Add(FullyDisabledAnalyzer.desc1.Id, ReportDiagnostic.Warn);
532specificDiagOptions.Add(PartiallyDisabledAnalyzer.desc2.Id, ReportDiagnostic.Suppress);
539specificDiagOptions = new Dictionary<string, ReportDiagnostic>();
540specificDiagOptions.Add(FullyDisabledAnalyzer.desc3.Id, ReportDiagnostic.Warn);
1140var specificDiagOptions = new Dictionary<string, ReportDiagnostic>();
1141specificDiagOptions.Add(NotConfigurableDiagnosticAnalyzer.EnabledRule.Id, ReportDiagnostic.Suppress);
1150specificDiagOptions.Add(NotConfigurableDiagnosticAnalyzer.DisabledRule.Id, ReportDiagnostic.Warn);
1277ReportDiagnostic expectedEffectiveSeverity,
1278Dictionary<string, ReportDiagnostic> specificOptions = null,
1279ReportDiagnostic generalOption = ReportDiagnostic.Default,
1282specificOptions = specificOptions ?? new Dictionary<string, ReportDiagnostic>();
1285var effectiveSeverity = descriptor.GetEffectiveSeverity(options);
1294TestEffectiveSeverity(DiagnosticSeverity.Warning, ReportDiagnostic.Warn);
1302var specificOptions = new Dictionary<string, ReportDiagnostic>() { { "Test0001", ReportDiagnostic.Default } };
1303var generalOption = ReportDiagnostic.Error;
1305TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity: ReportDiagnostic.Warn, specificOptions: specificOptions, generalOption: generalOption);
1313var generalOption = ReportDiagnostic.Error;
1322var specificOption = ReportDiagnostic.Suppress;
1323var specificOptions = new Dictionary<string, ReportDiagnostic>() { { "Test0001", specificOption } };
1324var generalOption = ReportDiagnostic.Error;
1334var generalOption = ReportDiagnostic.Error;
1337TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity: ReportDiagnostic.Suppress, generalOption: generalOption, isEnabledByDefault: enabledByDefault);
1345var specificOption = ReportDiagnostic.Warn;
1346var specificOptions = new Dictionary<string, ReportDiagnostic>() { { "Test0001", specificOption } };
1347var generalOption = ReportDiagnostic.Error;
1552var options = compilation.Options.WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1830if (compilation.Options.GeneralDiagnosticOption == ReportDiagnostic.Error)
3386new TestSyntaxTreeOptionsProvider(tree2, (NamedTypeAnalyzer.RuleId, ReportDiagnostic.Suppress)));
3429new TestSyntaxTreeOptionsProvider(tree2, (NamedTypeAnalyzer.RuleId, ReportDiagnostic.Suppress))
3481new TestSyntaxTreeOptionsProvider(tree2, (NamedTypeAnalyzer.RuleId, ReportDiagnostic.Suppress))
3533new TestSyntaxTreeOptionsProvider((NamedTypeAnalyzer.RuleId, ReportDiagnostic.Suppress)));
3554new TestSyntaxTreeOptionsProvider((NamedTypeAnalyzer.RuleId, ReportDiagnostic.Suppress), (tree1, new[] { (NamedTypeAnalyzer.RuleId, ReportDiagnostic.Default) })));
4185new TestSyntaxTreeOptionsProvider(tree1, (AnalyzerWithDisabledRules.Rule.Id, ReportDiagnostic.Warn)));
4195.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add(AnalyzerWithDisabledRules.Rule.Id, ReportDiagnostic.Warn))
4197(tree2, new[] { (AnalyzerWithDisabledRules.Rule.Id, ReportDiagnostic.Suppress) }),
4198(tree3, new[] { (AnalyzerWithDisabledRules.Rule.Id, ReportDiagnostic.Suppress) })));
4271public override bool TryGetDiagnosticValue(SyntaxTree tree, string diagnosticId, CancellationToken cancellationToken, out ReportDiagnostic severity)
4274severity = ReportDiagnostic.Default;
4278public override bool TryGetGlobalDiagnosticValue(string diagnosticId, CancellationToken cancellationToken, out ReportDiagnostic severity)
4281severity = ReportDiagnostic.Default;
Microsoft.CodeAnalysis.CSharp.Features (29)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (8)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (117)
Semantics\NullableReferenceTypesTests.cs (102)
6364var comp2 = CreateCompilation(source, options: TestOptions.DebugDll.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress));
125110foreach (ReportDiagnostic option in Enum.GetValues(typeof(ReportDiagnostic)))
125135comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default));
125144comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithGeneralDiagnosticOption(ReportDiagnostic.Default));
125154WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default).
125155WithGeneralDiagnosticOption(ReportDiagnostic.Error));
125164comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error));
125174WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error).
125175WithGeneralDiagnosticOption(ReportDiagnostic.Default));
125185WithGeneralDiagnosticOption(ReportDiagnostic.Error));
125195WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress));
125200WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress).
125201WithGeneralDiagnosticOption(ReportDiagnostic.Error));
125206WithGeneralDiagnosticOption(ReportDiagnostic.Suppress));
125210comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden));
125220WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden).
125221WithGeneralDiagnosticOption(ReportDiagnostic.Error));
125231WithGeneralDiagnosticOption(ReportDiagnostic.Hidden));
125241WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default).
125242WithGeneralDiagnosticOption(ReportDiagnostic.Hidden));
125293foreach (ReportDiagnostic option in Enum.GetValues(typeof(ReportDiagnostic)))
125314comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Default));
125317comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithGeneralDiagnosticOption(ReportDiagnostic.Default));
125321WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Default).
125322WithGeneralDiagnosticOption(ReportDiagnostic.Error));
125325comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Error));
125329WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Error).
125330WithGeneralDiagnosticOption(ReportDiagnostic.Default));
125334WithGeneralDiagnosticOption(ReportDiagnostic.Error));
125338WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Suppress));
125342WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Suppress).
125343WithGeneralDiagnosticOption(ReportDiagnostic.Error));
125347WithGeneralDiagnosticOption(ReportDiagnostic.Suppress));
125350comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Hidden));
125354WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Hidden).
125355WithGeneralDiagnosticOption(ReportDiagnostic.Error));
125359WithGeneralDiagnosticOption(ReportDiagnostic.Hidden));
125363WithSpecificDiagnosticOptions(id1, id2, ReportDiagnostic.Default).
125364WithGeneralDiagnosticOption(ReportDiagnostic.Hidden));
125470comp = CreateCompilation(new[] { source, source2 }, options: options.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default));
125479comp = CreateCompilation(new[] { source, source2 }, options: options.WithGeneralDiagnosticOption(ReportDiagnostic.Default));
125489WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default).
125490WithGeneralDiagnosticOption(ReportDiagnostic.Error));
125499comp = CreateCompilation(new[] { source, source2 }, options: options.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error));
125509WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error).
125510WithGeneralDiagnosticOption(ReportDiagnostic.Default));
125520WithGeneralDiagnosticOption(ReportDiagnostic.Error));
125530WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress));
125535WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress).
125536WithGeneralDiagnosticOption(ReportDiagnostic.Error));
125541WithGeneralDiagnosticOption(ReportDiagnostic.Suppress));
125545comp = CreateCompilation(new[] { source, source2 }, options: options.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden));
125555WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden).
125556WithGeneralDiagnosticOption(ReportDiagnostic.Error));
125566WithGeneralDiagnosticOption(ReportDiagnostic.Hidden));
125576WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default).
125577WithGeneralDiagnosticOption(ReportDiagnostic.Hidden));
126004comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default));
126008comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithGeneralDiagnosticOption(ReportDiagnostic.Default));
126013WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default).
126014WithGeneralDiagnosticOption(ReportDiagnostic.Error));
126018comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error));
126023WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error).
126024WithGeneralDiagnosticOption(ReportDiagnostic.Default));
126029WithGeneralDiagnosticOption(ReportDiagnostic.Error));
126034WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress));
126039WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress).
126040WithGeneralDiagnosticOption(ReportDiagnostic.Error));
126045WithGeneralDiagnosticOption(ReportDiagnostic.Suppress));
126049comp = CreateCompilation(new[] { source, source2 }, options: compilationOptions.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden));
126054WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden).
126055WithGeneralDiagnosticOption(ReportDiagnostic.Error));
126060WithGeneralDiagnosticOption(ReportDiagnostic.Hidden));
126065WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default).
126066WithGeneralDiagnosticOption(ReportDiagnostic.Hidden));
126078foreach (ReportDiagnostic option in Enum.GetValues(typeof(ReportDiagnostic)))
126150comp = CreateCompilation(new[] { source, source2 }, options: options.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default));
126154comp = CreateCompilation(new[] { source, source2 }, options: options.WithGeneralDiagnosticOption(ReportDiagnostic.Default));
126159WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default).
126160WithGeneralDiagnosticOption(ReportDiagnostic.Error));
126164comp = CreateCompilation(new[] { source, source2 }, options: options.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error));
126169WithSpecificDiagnosticOptions(id, ReportDiagnostic.Error).
126170WithGeneralDiagnosticOption(ReportDiagnostic.Default));
126175WithGeneralDiagnosticOption(ReportDiagnostic.Error));
126180WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress));
126185WithSpecificDiagnosticOptions(id, ReportDiagnostic.Suppress).
126186WithGeneralDiagnosticOption(ReportDiagnostic.Error));
126191WithGeneralDiagnosticOption(ReportDiagnostic.Suppress));
126195comp = CreateCompilation(new[] { source, source2 }, options: options.WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden));
126200WithSpecificDiagnosticOptions(id, ReportDiagnostic.Hidden).
126201WithGeneralDiagnosticOption(ReportDiagnostic.Error));
126206WithGeneralDiagnosticOption(ReportDiagnostic.Hidden));
126211WithSpecificDiagnosticOptions(id, ReportDiagnostic.Default).
126212WithGeneralDiagnosticOption(ReportDiagnostic.Hidden));
144986options: WithNullableEnable().WithSpecificDiagnosticOptions("CS0436", ReportDiagnostic.Suppress));
144999options: WithNullableEnable().WithSpecificDiagnosticOptions("CS0436", ReportDiagnostic.Suppress));
145056", options: WithNullableEnable().WithSpecificDiagnosticOptions("CS0436", ReportDiagnostic.Suppress));
145074", options: WithNullableEnable().WithSpecificDiagnosticOptions("CS0436", ReportDiagnostic.Suppress));
145128", options: WithNullableEnable().WithSpecificDiagnosticOptions("CS0436", ReportDiagnostic.Suppress));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (39)
Compilation\CompilationAPITests.cs (12)
39params (string, ReportDiagnostic)[] options)
53diagnosticOptions: CreateImmutableDictionary(("CS1584", ReportDiagnostic.Suppress)),
72.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress);
77new TestSyntaxTreeOptionsProvider((tree, new[] { ("CS0078", ReportDiagnostic.Warn) })));
101var options = WithDiagnosticOptions(tree, ("CS0078", ReportDiagnostic.Suppress));
126var options = WithDiagnosticOptions(tree, ("CS0078", ReportDiagnostic.Error));
139var options = WithDiagnosticOptions(tree, ("CS0078", ReportDiagnostic.Suppress));
149CreateImmutableDictionary(("CS0078", ReportDiagnostic.Error)));
169(tree, new[] { ("CS0078", ReportDiagnostic.Suppress) }),
170(newTree, new[] { ("CS0078", ReportDiagnostic.Error) })
195new TestSyntaxTreeOptionsProvider((tree, new[] { ("cs0078", ReportDiagnostic.Suppress) }))
208(tree, new[] { ("cs0078", ReportDiagnostic.Suppress) }))
Compilation\CSharpCompilationOptionsTests.cs (17)
84TestHiddenProperty((old, value) => old.WithGeneralDiagnosticOption(value), opt => opt.GeneralDiagnosticOption, ReportDiagnostic.Suppress);
87new Dictionary<string, ReportDiagnostic> { { "CS0001", ReportDiagnostic.Error } }.ToImmutableDictionary());
122TestProperty((old, value) => old.WithGeneralDiagnosticOption(value), opt => opt.GeneralDiagnosticOption, ReportDiagnostic.Suppress);
126new Dictionary<string, ReportDiagnostic> { { "CS0001", ReportDiagnostic.Error } }.ToImmutableDictionary());
193Assert.Equal(ReportDiagnostic.Default, defaultWarnings.GeneralDiagnosticOption);
196Assert.Equal(ReportDiagnostic.Error, new CSharpCompilationOptions(OutputKind.ConsoleApplication).WithGeneralDiagnosticOption(ReportDiagnostic.Error).GeneralDiagnosticOption);
197Assert.Equal(ReportDiagnostic.Default, new CSharpCompilationOptions(OutputKind.ConsoleApplication).WithGeneralDiagnosticOption(ReportDiagnostic.Default).GeneralDiagnosticOption);
228var warnings = new Dictionary<string, ReportDiagnostic>
230{ MessageProvider.Instance.GetIdForErrorCode(1), ReportDiagnostic.Error },
231{ MessageProvider.Instance.GetIdForErrorCode(2), ReportDiagnostic.Suppress },
232{ MessageProvider.Instance.GetIdForErrorCode(3), ReportDiagnostic.Warn }
397ReportDiagnostic generalDiagnosticOption = 0;
399IEnumerable<KeyValuePair<string, ReportDiagnostic>> specificDiagnosticOptions = null;
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (105)
Diagnostics\DiagnosticTest.cs (97)
569IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
570warnings.Add(MessageProvider.Instance.GetIdForErrorCode(420), ReportDiagnostic.Suppress);
574option = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error);
580warnings[MessageProvider.Instance.GetIdForErrorCode(420)] = ReportDiagnostic.Error;
581option = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Default).WithSpecificDiagnosticOptions(warnings);
613IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
614warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Suppress);
621warnings[MessageProvider.Instance.GetIdForErrorCode(168)] = ReportDiagnostic.Error;
643option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
673IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
674warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
690option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
724IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
725warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
747option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
780IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
781warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
803option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
836IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
837warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
859option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
894IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
895warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
917option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
952IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
953warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
975option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1011IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1012warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1040option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1081IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1082warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1116option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1152IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1153warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1181option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1217IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1218warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1234option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1270IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1271warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1287option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1324IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1325warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1341option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1374IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1375warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1385option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1425var warnings = new Dictionary<string, ReportDiagnostic>();
1426warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1442option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1481IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1482warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1498warnings = new Dictionary<string, ReportDiagnostic>();
1499warnings.Add(MessageProvider.Instance.GetIdForErrorCode(1633), ReportDiagnostic.Suppress);
1548IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1549warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1598IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1599warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1654IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1655warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1701IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1702warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1738IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1739warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1771IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1772warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1782warnings[MessageProvider.Instance.GetIdForErrorCode(168)] = ReportDiagnostic.Suppress;
1820var warnings = new Dictionary<string, ReportDiagnostic>();
1821warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1834warnings[MessageProvider.Instance.GetIdForErrorCode(168)] = ReportDiagnostic.Suppress;
2143var options = TestOptions.DebugDll.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress);
2244var warnings = new Dictionary<string, ReportDiagnostic>();
2245warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
2264warnings[MessageProvider.Instance.GetIdForErrorCode(168)] = ReportDiagnostic.Suppress;
Syntax\SyntaxTreeTests.cs (8)
130var options = CreateImmutableDictionary(("CS0078", ReportDiagnostic.Suppress));
140var options = CreateImmutableDictionary(("CS0078", ReportDiagnostic.Suppress));
166Assert.NotSame(ImmutableDictionary<string, ReportDiagnostic>.Empty, tree.DiagnosticOptions);
176diagnosticOptions: ImmutableDictionary<string, ReportDiagnostic>.Empty,
181Assert.Same(ImmutableDictionary<string, ReportDiagnostic>.Empty, tree.DiagnosticOptions);
187var options = CreateImmutableDictionary(("CS0078", ReportDiagnostic.Suppress));
220var newTree = tree.WithDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty);
232new[] { KeyValuePair.Create("CS00778", ReportDiagnostic.Suppress) });
Microsoft.CodeAnalysis.CSharp.Test.Utilities (10)
CSharpTestBase.cs (6)
2380internal static ImmutableDictionary<string, ReportDiagnostic> ReportStructInitializationWarnings { get; } = ImmutableDictionary.CreateRange(
2383KeyValuePairUtil.Create(GetIdForErrorCode(ErrorCode.WRN_UseDefViolationPropertySupportedVersion), ReportDiagnostic.Warn),
2384KeyValuePairUtil.Create(GetIdForErrorCode(ErrorCode.WRN_UseDefViolationFieldSupportedVersion), ReportDiagnostic.Warn),
2385KeyValuePairUtil.Create(GetIdForErrorCode(ErrorCode.WRN_UseDefViolationThisSupportedVersion), ReportDiagnostic.Warn),
2386KeyValuePairUtil.Create(GetIdForErrorCode(ErrorCode.WRN_UnassignedThisAutoPropertySupportedVersion), ReportDiagnostic.Warn),
2387KeyValuePairUtil.Create(GetIdForErrorCode(ErrorCode.WRN_UnassignedThisSupportedVersion), ReportDiagnostic.Warn),
TestOptions.cs (4)
172public static CSharpCompilationOptions WithSpecificDiagnosticOptions(this CSharpCompilationOptions options, string key, ReportDiagnostic value)
174return options.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add(key, value));
177public static CSharpCompilationOptions WithSpecificDiagnosticOptions(this CSharpCompilationOptions options, string key1, string key2, ReportDiagnostic value)
179return options.WithSpecificDiagnosticOptions(ImmutableDictionary<string, ReportDiagnostic>.Empty.Add(key1, value).Add(key2, value));
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (12)
CodeStyle\CSharpEditorConfigCodeStyleParserTests.cs (12)
43[InlineData("false:none", (int)ExpressionBodyPreference.Never, ReportDiagnostic.Suppress)]
44[InlineData("true:warning", (int)ExpressionBodyPreference.WhenPossible, ReportDiagnostic.Warn)]
45[InlineData("when_on_single_line:error", (int)ExpressionBodyPreference.WhenOnSingleLine, ReportDiagnostic.Error)]
48[InlineData("false : none", (int)ExpressionBodyPreference.Never, ReportDiagnostic.Suppress)]
49[InlineData("true : warning", (int)ExpressionBodyPreference.WhenPossible, ReportDiagnostic.Warn)]
50[InlineData("when_on_single_line : error", (int)ExpressionBodyPreference.WhenOnSingleLine, ReportDiagnostic.Error)]
55public void TestParseExpressionBodyPreference(string optionString, int parsedValue, ReportDiagnostic? severity)
58severity ??= ReportDiagnostic.Error;
67[InlineData("inside_namespace:warning", AddImportPlacement.InsideNamespace, ReportDiagnostic.Warn)]
68[InlineData("outside_namespace:suggestion", AddImportPlacement.OutsideNamespace, ReportDiagnostic.Info)]
71internal void TestParseUsingDirectivesPlacement(string optionString, AddImportPlacement parsedValue, ReportDiagnostic? severity)
74severity ??= ReportDiagnostic.Error;
Microsoft.CodeAnalysis.EditorFeatures (27)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (4)
Microsoft.CodeAnalysis.Features (36)
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (1)
Microsoft.CodeAnalysis.Rebuild (2)
Microsoft.CodeAnalysis.Rebuild.UnitTests (4)
Microsoft.CodeAnalysis.Test.Utilities (33)
Compilation\TestSyntaxTreeOptionsProvider.cs (13)
15private readonly Dictionary<SyntaxTree, Dictionary<string, ReportDiagnostic>>? _options;
17private readonly Dictionary<string, ReportDiagnostic>? _globalOptions;
20(string? key, ReportDiagnostic diagnostic) globalOption,
21params (SyntaxTree, (string, ReportDiagnostic)[])[] options)
32_globalOptions = new Dictionary<string, ReportDiagnostic>(Section.PropertiesKeyComparer) { { globalOption.key, globalOption.diagnostic } };
38params (SyntaxTree, (string, ReportDiagnostic)[])[] options)
43(string, ReportDiagnostic) globalOption,
44params (SyntaxTree, (string, ReportDiagnostic)[])[] options)
49SyntaxTree tree, params (string, ReportDiagnostic)[] options)
71out ReportDiagnostic severity)
79severity = ReportDiagnostic.Default;
83public override bool TryGetGlobalDiagnosticValue(string diagnosticId, CancellationToken cancellationToken, out ReportDiagnostic severity)
90severity = ReportDiagnostic.Default;
Microsoft.CodeAnalysis.UnitTests (94)
Analyzers\AnalyzerConfigTests.cs (39)
964CreateImmutableDictionary(("cs000", ReportDiagnostic.Suppress)),
965CreateImmutableDictionary(("cs000", ReportDiagnostic.Error)),
993CreateImmutableDictionary(("cs000", ReportDiagnostic.Suppress))
1014CreateImmutableDictionary(("cs000", ReportDiagnostic.Error)),
1015CreateImmutableDictionary(("cs000", ReportDiagnostic.Error)),
1041CreateImmutableDictionary(("cs000", ReportDiagnostic.Suppress)),
1042CreateImmutableDictionary(("cs000", ReportDiagnostic.Error)),
1064("cs000", ReportDiagnostic.Suppress),
1065("cs001", ReportDiagnostic.Info)),
1086("cs000", ReportDiagnostic.Hidden),
1087("cs001", ReportDiagnostic.Hidden)),
1110("cs000", ReportDiagnostic.Suppress),
1111("cs001", ReportDiagnostic.Info))
1140("cs000", ReportDiagnostic.Warn),
1141("cs001", ReportDiagnostic.Error)),
1143("cs000", ReportDiagnostic.Warn),
1144("cs001", ReportDiagnostic.Info))
1166("cs000", ReportDiagnostic.Info)),
1192("cs001", ReportDiagnostic.Info)),
1194("cs000", ReportDiagnostic.Suppress),
1195("cs001", ReportDiagnostic.Error)),
1197("cs000", ReportDiagnostic.Suppress))
1217("cs000", ReportDiagnostic.Suppress))
1253(string diagId, ReportDiagnostic severity)[][] expected,
1270Assert.True(treeOptions.TryGetValue(item.diagId, out var severity));
1410new[] { ("cs000", ReportDiagnostic.Suppress) },
1411new[] { ("cs000", ReportDiagnostic.Error) },
1412new[] { ("cs000", ReportDiagnostic.Warn) }
1510CreateImmutableDictionary(("", ReportDiagnostic.Warn)),
1538Assert.Equal(new ImmutableDictionary<string, ReportDiagnostic>[]
1571("cs000", ReportDiagnostic.Warn)),
1573("cs000", ReportDiagnostic.Warn)),
1609Assert.Equal(KeyValuePair.Create("cs000", ReportDiagnostic.Warn), options[0].TreeOptions.Single());
2033Assert.Equal(CreateImmutableDictionary(("cs000", ReportDiagnostic.Suppress),
2034("cs001", ReportDiagnostic.Error)),
2056CreateImmutableDictionary(("cs000", ReportDiagnostic.Error))
2103CreateImmutableDictionary(("cs000", ReportDiagnostic.Error)),
2132CreateImmutableDictionary(("cs000", ReportDiagnostic.Suppress)),
2133CreateImmutableDictionary(("cs000", ReportDiagnostic.Warn))
CommonCommandLineParserTests.cs (54)
167Assert.Equal(expected: ReportDiagnostic.Error, actual: ruleSet.SpecificDiagnosticOptions["CA1012"]);
202Assert.Equal(ReportDiagnostic.Warn, ruleSet.GeneralDiagnosticOption);
216Assert.Equal(ReportDiagnostic.Default, ruleSet.GeneralDiagnosticOption);
231Assert.Equal(ReportDiagnostic.Default, ruleSet.GeneralDiagnosticOption);
256Assert.Equal(ReportDiagnostic.Default, ruleSet.GeneralDiagnosticOption);
291Assert.Equal(ReportDiagnostic.Default, ruleSet.GeneralDiagnosticOption);
411Assert.Equal(ReportDiagnostic.Error, ruleSet.SpecificDiagnosticOptions["CA1012"]);
413Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1013"]);
415Assert.Equal(ReportDiagnostic.Suppress, ruleSet.SpecificDiagnosticOptions["CA1014"]);
417Assert.Equal(ReportDiagnostic.Info, ruleSet.SpecificDiagnosticOptions["CA1015"]);
419Assert.Equal(ReportDiagnostic.Hidden, ruleSet.SpecificDiagnosticOptions["CA1016"]);
452Assert.Equal(ReportDiagnostic.Default, ruleSet.Includes.First().Action);
476Assert.Equal(ReportDiagnostic.Default, ruleSet.GeneralDiagnosticOption);
478Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1013"]);
501Assert.Equal(ReportDiagnostic.Default, ruleSet.GeneralDiagnosticOption);
503Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]);
505Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1013"]);
529Assert.Equal(ReportDiagnostic.Hidden, ruleSet.GeneralDiagnosticOption);
531Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]);
533Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1013"]);
557Assert.Equal(ReportDiagnostic.Info, ruleSet.GeneralDiagnosticOption);
559Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]);
561Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1013"]);
586Assert.Equal(ReportDiagnostic.Error, ruleSet.GeneralDiagnosticOption);
588Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]);
590Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1013"]);
624Assert.Equal(ReportDiagnostic.Error, ruleSet.GeneralDiagnosticOption);
626Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]);
628Assert.Equal(ReportDiagnostic.Error, ruleSet.SpecificDiagnosticOptions["CA1013"]);
662Assert.Equal(ReportDiagnostic.Error, ruleSet.GeneralDiagnosticOption);
664Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]);
666Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1013"]);
668Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1014"]);
694Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]);
730Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]);
764Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]);
767Assert.Equal(ReportDiagnostic.Error, ruleSet.SpecificDiagnosticOptions["CA1013"]);
791Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]);
815Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]);
817Assert.Equal(ReportDiagnostic.Error, ruleSet.SpecificDiagnosticOptions["CA1013"]);
818Assert.Equal(ReportDiagnostic.Default, ruleSet.GeneralDiagnosticOption);
841Assert.Equal(ReportDiagnostic.Error, ruleSet.GeneralDiagnosticOption);
864Assert.Equal(ReportDiagnostic.Warn, ruleSet.GeneralDiagnosticOption);
887Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]);
889Assert.Equal(ReportDiagnostic.Suppress, ruleSet.SpecificDiagnosticOptions["CA1013"]);
912Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1012"]);
914Assert.Equal(ReportDiagnostic.Error, ruleSet.SpecificDiagnosticOptions["CA1013"]);
952Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1000"]);
953Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA1001"]);
954Assert.Equal(ReportDiagnostic.Error, ruleSet.SpecificDiagnosticOptions["CA2100"]);
955Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA2104"]);
956Assert.Equal(ReportDiagnostic.Warn, ruleSet.SpecificDiagnosticOptions["CA2105"]);
957Assert.Equal(ReportDiagnostic.Suppress, ruleSet.SpecificDiagnosticOptions["CA2111"]);
958Assert.Equal(ReportDiagnostic.Suppress, ruleSet.SpecificDiagnosticOptions["CA2119"]);
Microsoft.CodeAnalysis.VisualBasic (99)
CommandLine\VisualBasicCommandLineParser.vb (23)
148Dim generalDiagnosticOption As ReportDiagnostic = ReportDiagnostic.Default
152Dim specificDiagnosticOptionsFromRuleSet = New Dictionary(Of String, ReportDiagnostic)(CaseInsensitiveComparison.Comparer)
153Dim specificDiagnosticOptionsFromGeneralArguments = New Dictionary(Of String, ReportDiagnostic)(CaseInsensitiveComparison.Comparer)
154Dim specificDiagnosticOptionsFromSpecificArguments = New Dictionary(Of String, ReportDiagnostic)(CaseInsensitiveComparison.Comparer)
155Dim specificDiagnosticOptionsFromNoWarnArguments = New Dictionary(Of String, ReportDiagnostic)(CaseInsensitiveComparison.Comparer)
828generalDiagnosticOption = ReportDiagnostic.Error
832If pair.Value = ReportDiagnostic.Warn Then
833specificDiagnosticOptionsFromGeneralArguments.Add(pair.Key, ReportDiagnostic.Error)
840AddWarnings(specificDiagnosticOptionsFromSpecificArguments, ReportDiagnostic.Error, ParseWarnings(value))
845If generalDiagnosticOption <> ReportDiagnostic.Suppress Then
846generalDiagnosticOption = ReportDiagnostic.Default
855Dim ruleSetValue As ReportDiagnostic
859specificDiagnosticOptionsFromSpecificArguments(id) = ReportDiagnostic.Default
867generalDiagnosticOption = ReportDiagnostic.Suppress
871If pair.Value <> ReportDiagnostic.Error Then
872specificDiagnosticOptionsFromGeneralArguments.Add(pair.Key, ReportDiagnostic.Suppress)
879AddWarnings(specificDiagnosticOptionsFromNoWarnArguments, ReportDiagnostic.Suppress, ParseWarnings(value))
1283Dim specificDiagnosticOptions = New Dictionary(Of String, ReportDiagnostic)(specificDiagnosticOptionsFromRuleSet, CaseInsensitiveComparison.Comparer)
2260Private Shared Sub AddWarnings(d As IDictionary(Of String, ReportDiagnostic), kind As ReportDiagnostic, items As IEnumerable(Of String))
2262Dim existing As ReportDiagnostic
2265If existing <> ReportDiagnostic.Suppress Then
Compilation\VisualBasicDiagnosticFilter.vb (27)
31generalDiagnosticOption As ReportDiagnostic,
32specificDiagnosticOptions As IDictionary(Of String, ReportDiagnostic),
38ImmutableDictionary.Create(Of String, ReportDiagnostic)(CaseInsensitiveComparison.Comparer).AddRange(specificDiagnosticOptions)
66Dim report As ReportDiagnostic
130generalDiagnosticOption As ReportDiagnostic,
131caseInsensitiveSpecificDiagnosticOptions As IDictionary(Of String, ReportDiagnostic),
134<Out> ByRef hasDisableDirectiveSuppression As Boolean) As ReportDiagnostic
137Dim report As ReportDiagnostic
148If report = ReportDiagnostic.Default Then
166If report = ReportDiagnostic.Warn AndAlso generalDiagnosticOption = ReportDiagnostic.Error AndAlso Not specifiedWarnAsErrorMinus Then
167report = ReportDiagnostic.Error
180Dim reportFromSyntaxTreeOptions As ReportDiagnostic
183Not (specifiedWarnAsErrorMinus AndAlso severity = DiagnosticSeverity.Warning AndAlso reportFromSyntaxTreeOptions = ReportDiagnostic.Error) Then
188If Not specifiedWarnAsErrorMinus AndAlso report = ReportDiagnostic.Warn AndAlso generalDiagnosticOption = ReportDiagnostic.Error Then
189report = ReportDiagnostic.Error
195report = If(isEnabledByDefault, ReportDiagnostic.Default, ReportDiagnostic.Suppress)
199If report = ReportDiagnostic.Suppress Then
200Return ReportDiagnostic.Suppress
205location.SourceTree.GetWarningState(id, location.SourceSpan.Start) = ReportDiagnostic.Suppress Then
216If generalDiagnosticOption = ReportDiagnostic.Suppress AndAlso
218Return ReportDiagnostic.Suppress
223If (generalDiagnosticOption = ReportDiagnostic.Error) AndAlso (severity = DiagnosticSeverity.Warning) Then
227If (Not isSpecified) AndAlso (report = ReportDiagnostic.Default) Then
228Return ReportDiagnostic.Error
Syntax\VisualBasicSyntaxTree.vb (6)
164Optional diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) = Nothing) As SyntaxTree
239Optional diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) = Nothing,
249Optional diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) = Nothing,
266Optional diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) = Nothing,
282Optional diagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic) = Nothing,
473Friend Function GetWarningState(id As String, position As Integer) As ReportDiagnostic
VisualBasicCompilationOptions.vb (21)
88Optional generalDiagnosticOption As ReportDiagnostic = ReportDiagnostic.Default,
89Optional specificDiagnosticOptions As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic)) = Nothing,
165generalDiagnosticOption As ReportDiagnostic,
166specificDiagnosticOptions As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic)),
234generalDiagnosticOption As ReportDiagnostic,
235specificDiagnosticOptions As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic)),
811Protected Overrides Function CommonWithGeneralDiagnosticOption(value As ReportDiagnostic) As CompilationOptions
815Protected Overrides Function CommonWithSpecificDiagnosticOptions(specificDiagnosticOptions As ImmutableDictionary(Of String, ReportDiagnostic)) As CompilationOptions
819Protected Overrides Function CommonWithSpecificDiagnosticOptions(specificDiagnosticOptions As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic))) As CompilationOptions
841Public Shadows Function WithGeneralDiagnosticOption(value As ReportDiagnostic) As VisualBasicCompilationOptions
854Public Shadows Function WithSpecificDiagnosticOptions(value As ImmutableDictionary(Of String, ReportDiagnostic)) As VisualBasicCompilationOptions
856value = ImmutableDictionary(Of String, ReportDiagnostic).Empty
871Public Shadows Function WithSpecificDiagnosticOptions(value As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic))) As VisualBasicCompilationOptions
1164generalDiagnosticOption As ReportDiagnostic,
1165specificDiagnosticOptions As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic)),
1229generalDiagnosticOption As ReportDiagnostic,
1230specificDiagnosticOptions As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic)),
1295Optional generalDiagnosticOption As ReportDiagnostic = ReportDiagnostic.Default,
1296Optional specificDiagnosticOptions As IEnumerable(Of KeyValuePair(Of String, ReportDiagnostic)) = Nothing,
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (60)
CommandLineTests.vb (60)
134Dim report As ReportDiagnostic
136Assert.Equal(ReportDiagnostic.Suppress, report)
138Assert.Equal(ReportDiagnostic.Suppress, report)
140Assert.Equal(ReportDiagnostic.Suppress, report)
288Assert.Equal(cmd.Arguments.CompilationOptions.GeneralDiagnosticOption, ReportDiagnostic.Suppress)
291Assert.Equal(cmd.Arguments.CompilationOptions.GeneralDiagnosticOption, ReportDiagnostic.Error)
294Assert.Equal(cmd.Arguments.CompilationOptions.GeneralDiagnosticOption, ReportDiagnostic.Error)
297Assert.Equal(cmd.Arguments.CompilationOptions.GeneralDiagnosticOption, ReportDiagnostic.Suppress)
300Assert.Equal(cmd.Arguments.CompilationOptions.GeneralDiagnosticOption, ReportDiagnostic.Suppress)
303Assert.Equal(cmd.Arguments.CompilationOptions.GeneralDiagnosticOption, ReportDiagnostic.Suppress)
2843Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions("CA1012") = ReportDiagnostic.Error)
2845Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions("CA1013") = ReportDiagnostic.Warn)
2847Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions("CA1014") = ReportDiagnostic.Suppress)
2848Assert.True(parsedArgs.CompilationOptions.GeneralDiagnosticOption = ReportDiagnostic.Warn)
5759Private Shared Sub AssertSpecificDiagnostics(expectedCodes As Integer(), expectedOptions As ReportDiagnostic(), args As VisualBasicCommandLineArguments)
5773Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5777Assert.Equal(ReportDiagnostic.Error, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5781Assert.Equal(ReportDiagnostic.Error, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5785Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5789Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5790AssertSpecificDiagnostics({42024, 42025}, {ReportDiagnostic.Error, ReportDiagnostic.Error}, parsedArgs)
5794Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5798Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5799AssertSpecificDiagnostics({42024, 42025}, {ReportDiagnostic.Error, ReportDiagnostic.Error}, parsedArgs)
5803Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5807Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5811Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5812AssertSpecificDiagnostics({42024, 42025}, {ReportDiagnostic.Default, ReportDiagnostic.Default}, parsedArgs)
5816Assert.Equal(ReportDiagnostic.Suppress, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5820Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5824Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5825AssertSpecificDiagnostics({42024, 42025}, {ReportDiagnostic.Suppress, ReportDiagnostic.Suppress}, parsedArgs)
8693Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8713Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8715Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8734Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8736Assert.Equal(expected:=ReportDiagnostic.Info, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8755Assert.Equal(expected:=ReportDiagnostic.Default, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8757Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8776Assert.Equal(expected:=ReportDiagnostic.Default, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8778Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8797Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8799Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8818Assert.Equal(expected:=ReportDiagnostic.Default, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8820Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8821Assert.Equal(expected:=ReportDiagnostic.Default, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test002"))
8840Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8842Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8861Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8863Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8884Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8886Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8887Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test002"))
8888Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test003"))
8907Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8909Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (3)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (101)
Compilation\CompilationAPITests.vb (11)
30ParamArray options As (String, ReportDiagnostic)()) As VisualBasicCompilationOptions
45WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
50New TestSyntaxTreeOptionsProvider(tree, ("BC42024", ReportDiagnostic.Warn)))
73Dim options = WithDiagnosticOptions(tree, ("BC42024", ReportDiagnostic.Suppress))
92Dim options = WithDiagnosticOptions(tree, ("BC42024", ReportDiagnostic.Warn))
108CreateImmutableDictionary(("BC42024", ReportDiagnostic.Suppress)))
113New TestSyntaxTreeOptionsProvider(tree, ("BC42024", ReportDiagnostic.Error)))
136(tree, {("BC42024", ReportDiagnostic.Suppress)}),
137(newTree, {("BC4024", ReportDiagnostic.Error)})))
156Dim options = WithDiagnosticOptions(tree, ("bc42024", ReportDiagnostic.Suppress))
165(tree, {("bc42024", ReportDiagnostic.Suppress)}))
Compilation\VisualBasicCompilationOptionsTests.vb (31)
38TestHiddenProperty(Function(old, value) old.WithGeneralDiagnosticOption(value), Function(opt) opt.GeneralDiagnosticOption, ReportDiagnostic.Suppress)
41New Dictionary(Of String, ReportDiagnostic) From {{"VB0001", ReportDiagnostic.Error}}.ToImmutableDictionary())
113TestProperty(Function(old, value) old.WithGeneralDiagnosticOption(value), Function(opt) opt.GeneralDiagnosticOption, ReportDiagnostic.Suppress)
116New Dictionary(Of String, ReportDiagnostic) From {{"VB0001", ReportDiagnostic.Error}}.ToImmutableDictionary())
427Dim options = commonoption.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
433Dim warnings As IDictionary(Of String, ReportDiagnostic) = New Dictionary(Of String, ReportDiagnostic)()
434warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress)
435options = commonoption.WithSpecificDiagnosticOptions(New ReadOnlyDictionary(Of String, ReportDiagnostic)(warnings))
443warnings = New Dictionary(Of String, ReportDiagnostic)()
444warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress)
445warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42099), ReportDiagnostic.Suppress)
446options = commonoption.WithSpecificDiagnosticOptions(New ReadOnlyDictionary(Of String, ReportDiagnostic)(warnings))
452options = commonoption.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
462warnings = New Dictionary(Of String, ReportDiagnostic)()
463warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42105), ReportDiagnostic.Error)
464options = commonoption.WithSpecificDiagnosticOptions(New ReadOnlyDictionary(Of String, ReportDiagnostic)(warnings))
474warnings = New Dictionary(Of String, ReportDiagnostic)()
475warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42105), ReportDiagnostic.Error)
476warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42099), ReportDiagnostic.Error)
477options = commonoption.WithSpecificDiagnosticOptions(New ReadOnlyDictionary(Of String, ReportDiagnostic)(warnings))
487warnings = New Dictionary(Of String, ReportDiagnostic)()
488warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress)
489options = commonoption.WithSpecificDiagnosticOptions(New ReadOnlyDictionary(Of String, ReportDiagnostic)(warnings)).WithGeneralDiagnosticOption(ReportDiagnostic.Error)
498warnings = New Dictionary(Of String, ReportDiagnostic)()
499warnings.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error)
500options = commonoption.WithSpecificDiagnosticOptions(New ReadOnlyDictionary(Of String, ReportDiagnostic)(warnings)).WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
Diagnostics\DiagnosticAnalyzerTests.vb (50)
62Dim specificDiagOptions = New Dictionary(Of String, ReportDiagnostic)()
63specificDiagOptions.Add(noneDiagDescriptor.Id, ReportDiagnostic.[Error])
64specificDiagOptions.Add(infoDiagDescriptor.Id, ReportDiagnostic.[Error])
65specificDiagOptions.Add(warningDiagDescriptor.Id, ReportDiagnostic.[Error])
77specificDiagOptions = New Dictionary(Of String, ReportDiagnostic)()
78specificDiagOptions.Add(noneDiagDescriptor.Id, ReportDiagnostic.Suppress)
79specificDiagOptions.Add(infoDiagDescriptor.Id, ReportDiagnostic.Suppress)
80specificDiagOptions.Add(warningDiagDescriptor.Id, ReportDiagnostic.Suppress)
81specificDiagOptions.Add(errorDiagDescriptor.Id, ReportDiagnostic.Suppress)
89specificDiagOptions = New Dictionary(Of String, ReportDiagnostic)()
90specificDiagOptions.Add(noneDiagDescriptor.Id, ReportDiagnostic.Info)
91specificDiagOptions.Add(infoDiagDescriptor.Id, ReportDiagnostic.Hidden)
92specificDiagOptions.Add(warningDiagDescriptor.Id, ReportDiagnostic.[Error])
93specificDiagOptions.Add(errorDiagDescriptor.Id, ReportDiagnostic.Warn)
142Dim options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Default)
147options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
153options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Warn)
160options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Info)
167options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Hidden)
174options = TestOptions.ReleaseDll.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
201Dim specificDiagOptions = New Dictionary(Of String, ReportDiagnostic)()
202specificDiagOptions.Add(disabledDiagDescriptor.Id, ReportDiagnostic.Warn)
203specificDiagOptions.Add(enabledDiagDescriptor.Id, ReportDiagnostic.Suppress)
253Dim specificDiagOptions = New Dictionary(Of String, ReportDiagnostic)()
254specificDiagOptions.Add(FullyDisabledAnalyzer.desc1.Id, ReportDiagnostic.Warn)
255specificDiagOptions.Add(PartiallyDisabledAnalyzer.desc2.Id, ReportDiagnostic.Suppress)
684Dim specificDiagOptions = New Dictionary(Of String, ReportDiagnostic)
685specificDiagOptions.Add(NotConfigurableDiagnosticAnalyzer.EnabledRule.Id, ReportDiagnostic.Suppress)
698specificDiagOptions.Add(NotConfigurableDiagnosticAnalyzer.DisabledRule.Id, ReportDiagnostic.Warn)
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)
753specificOptions = If(specificOptions, New Dictionary(Of String, ReportDiagnostic))
766TestEffectiveSeverity(DiagnosticSeverity.Warning, ReportDiagnostic.Warn)
773Dim specificOptions = New Dictionary(Of String, ReportDiagnostic) From {{"Test0001", ReportDiagnostic.Default}}
774Dim generalOption = ReportDiagnostic.Error
776TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity:=ReportDiagnostic.Warn, specificOptions:=specificOptions, generalOption:=generalOption)
783Dim generalOption = ReportDiagnostic.Error
791Dim specificOption = ReportDiagnostic.Suppress
792Dim specificOptions = New Dictionary(Of String, ReportDiagnostic) From {{"Test0001", specificOption}}
793Dim generalOption = ReportDiagnostic.Error
802Dim generalOption = ReportDiagnostic.Error
805TestEffectiveSeverity(DiagnosticSeverity.Warning, expectedEffectiveSeverity:=ReportDiagnostic.Suppress, generalOption:=generalOption, isEnabledByDefault:=enabledByDefault)
812Dim specificOption = ReportDiagnostic.Warn
813Dim specificOptions = New Dictionary(Of String, ReportDiagnostic) From {{"Test0001", specificOption}}
814Dim generalOption = ReportDiagnostic.Error
899Dim options = compilation.Options.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
1291If compilation.Options.GeneralDiagnosticOption = ReportDiagnostic.Error Then
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (2)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (153)
Parser\ParseDirectives.vb (145)
2785Dim diagOptions = New Dictionary(Of String, ReportDiagnostic)
2786diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error)
2791diagOptions = New Dictionary(Of String, ReportDiagnostic)
2792diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress)
2796compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
2800compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
2825Dim diagOptions = New Dictionary(Of String, ReportDiagnostic)
2826diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error)
2831diagOptions = New Dictionary(Of String, ReportDiagnostic)
2832diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress)
2836compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
2840compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
2865Dim diagOptions = New Dictionary(Of String, ReportDiagnostic)
2866diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error)
2871diagOptions = New Dictionary(Of String, ReportDiagnostic)
2872diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress)
2876compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
2880compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
2905Dim diagOptions = New Dictionary(Of String, ReportDiagnostic)
2906diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error)
2911diagOptions = New Dictionary(Of String, ReportDiagnostic)
2912diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress)
2916compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
2920compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
2945Dim diagOptions = New Dictionary(Of String, ReportDiagnostic)
2946diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error)
2953diagOptions = New Dictionary(Of String, ReportDiagnostic)
2954diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress)
2959compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
2965compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
2990Dim diagOptions = New Dictionary(Of String, ReportDiagnostic)
2991diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error)
2998diagOptions = New Dictionary(Of String, ReportDiagnostic)
2999diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress)
3004compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
3010compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
3036Dim diagOptions = New Dictionary(Of String, ReportDiagnostic)
3037diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error)
3043diagOptions = New Dictionary(Of String, ReportDiagnostic)
3044diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress)
3049compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
3054compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
3079Dim diagOptions = New Dictionary(Of String, ReportDiagnostic)
3080diagOptions.Add("Bc42024", ReportDiagnostic.Error)
3086diagOptions = New Dictionary(Of String, ReportDiagnostic)
3087diagOptions.Add("bc42024", ReportDiagnostic.Suppress)
3092compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
3097compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
3128Dim diagOptions = New Dictionary(Of String, ReportDiagnostic)
3129diagOptions.Add("BC42024", ReportDiagnostic.Error)
3135diagOptions = New Dictionary(Of String, ReportDiagnostic)
3136diagOptions.Add("bC42024", ReportDiagnostic.Suppress)
3141compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
3146compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
3218Dim diagOptions = New Dictionary(Of String, ReportDiagnostic)
3219diagOptions.Add("soMeId", ReportDiagnostic.Error)
3224diagOptions = New Dictionary(Of String, ReportDiagnostic)
3225diagOptions.Add("SoMeiD", ReportDiagnostic.Suppress)
3229compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
3233compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
3260Dim diagOptions = New Dictionary(Of String, ReportDiagnostic)
3261diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Error)
3268diagOptions = New Dictionary(Of String, ReportDiagnostic)
3269diagOptions.Add(MessageProvider.Instance.GetIdForErrorCode(42024), ReportDiagnostic.Suppress)
3274compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
3280compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
3325Dim diagOptions = New Dictionary(Of String, ReportDiagnostic)
3326diagOptions.Add("__someThing_123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789023456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678902345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789023456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678902345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789023456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678902345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ReportDiagnostic.Error)
3331diagOptions = New Dictionary(Of String, ReportDiagnostic)
3332diagOptions.Add("__somethIng_123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789023456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678902345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789023456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678902345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789023456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678902345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ReportDiagnostic.Suppress)
3336compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error)
3340compOptions = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress)
3413Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", 0))
3414Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", 1))
3415Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42104", 0))
3416Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42104", 1))
3418Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#Disable Warning") - 1))
3419Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42104", GetEndPosition(tree, "#Disable Warning") - 1))
3421Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "#Disable Warning")))
3422Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetStartPosition(tree, "Module Program")))
3423Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "Module Program")))
3424Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetStartPosition(tree, "#enable Warning")))
3425Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bC42104", GetEndPosition(tree, "#Disable Warning")))
3426Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bC42104", GetStartPosition(tree, "Module Program")))
3427Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bC42104", GetEndPosition(tree, "Module Program")))
3428Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bC42104", GetStartPosition(tree, "#enable Warning")))
3430Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#enable Warning")))
3431Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "Sub Main()")))
3432Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("bc42104", GetEndPosition(tree, "#enable Warning")))
3433Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("bc42104", GetStartPosition(tree, "Sub Main()")))
3435Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "#Disable Warning BC42024")))
3436Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "Dim b")))
3437Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("Bc42104", GetEndPosition(tree, "#Disable Warning BC42024")))
3438Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("Bc42104", GetEndPosition(tree, "Dim b")))
3440Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "#enable warning [bc42024]") - 1))
3441Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#enable warning [bc42024]")))
3442Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "Dim d")))
3443Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("Bc42104", GetEndPosition(tree, "#enable warning [bc42024]") - 1))
3444Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("Bc42104", GetEndPosition(tree, "#enable warning [bc42024]")))
3445Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("Bc42104", GetEndPosition(tree, "Dim d")))
3447Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#disable warning BC42024") - 1))
3448Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#disable warning BC42024")))
3449Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#disable warning BC42024, [bc42104]") - 1))
3450Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "#disable warning BC42024, [bc42104]")))
3451Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "End Module")))
3452Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("bc42104", GetEndPosition(tree, "#disable warning BC42024")))
3453Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("bc42104", GetEndPosition(tree, "#disable warning BC42024, [bc42104]") - 1))
3454Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bc42104", GetEndPosition(tree, "#disable warning BC42024, [bc42104]")))
3455Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bc42104", GetEndPosition(tree, "End Module")))
3457Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "#enable Warning") - 1))
3458Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#enable Warning")))
3459Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bc42104", GetEndPosition(tree, "#enable Warning") - 1))
3460Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("bc42104", GetEndPosition(tree, "#enable Warning")))
3463Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", endPos - 1))
3464Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", endPos))
3465Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("bc42104", endPos - 1))
3466Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("bc42104", endPos))
3492Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", 0))
3493Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", 1))
3494Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", 0))
3495Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", 1))
3497Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetStartPosition(tree, "#disable warning bc42024, bc42025")))
3498Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#disable warning bc42024, bc42025") + 1))
3499Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", GetStartPosition(tree, "#disable warning bc42024, bc42025")))
3500Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", GetEndPosition(tree, "#disable warning bc42024, bc42025") + 1))
3502Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetStartPosition(tree, "#Disable Warning bc42024, [BC42025]")))
3503Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "#Disable Warning bc42024, [BC42025]")))
3504Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", GetStartPosition(tree, "#Disable Warning bc42024, [BC42025]")))
3505Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42025", GetEndPosition(tree, "#Disable Warning bc42024, [BC42025]")))
3507Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetStartPosition(tree, "#enable warning bc42024, bc42025")))
3508Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetEndPosition(tree, "#enable warning bc42024, bc42025")))
3509Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42025", GetStartPosition(tree, "#enable warning bc42024, bc42025")))
3510Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42025", GetEndPosition(tree, "#enable warning bc42024, bc42025")))
3512Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42024", GetStartPosition(tree, "#Enable Warning [bc42025], [bC42024]") + 1))
3513Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#Enable Warning [bc42025], [bC42024]")))
3514Assert.Equal(ReportDiagnostic.Suppress, tree.GetWarningState("BC42025", GetStartPosition(tree, "#Enable Warning [bc42025], [bC42024]") + 1))
3515Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", GetEndPosition(tree, "#Enable Warning [bc42025], [bC42024]")))
3517Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetStartPosition(tree, "#Disable Warning bc42024, bc42025")))
3518Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", GetEndPosition(tree, "#Disable Warning bc42024, bc42025")))
3519Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", GetStartPosition(tree, "#Disable Warning bc42024, bc42025")))
3520Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", GetEndPosition(tree, "#Disable Warning bc42024, bc42025")))
3523Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", endPos - 1))
3524Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42024", endPos))
3525Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", endPos - 1))
3526Assert.Equal(ReportDiagnostic.Default, tree.GetWarningState("BC42025", endPos))
Syntax\SyntaxTreeTests.vb (8)
25Dim options = CreateImmutableDictionary(("BC000", ReportDiagnostic.Suppress))
32Dim options = CreateImmutableDictionary(("BC000", ReportDiagnostic.Suppress))
49Assert.NotSame(ImmutableDictionary(Of String, ReportDiagnostic).Empty, tree.DiagnosticOptions)
56diagnosticOptions:=ImmutableDictionary(Of String, ReportDiagnostic).Empty)
59Assert.Same(ImmutableDictionary(Of String, ReportDiagnostic).Empty, tree.DiagnosticOptions)
64Dim options = CreateImmutableDictionary(("BC000", ReportDiagnostic.Suppress))
90Dim newTree = tree.WithDiagnosticOptions(ImmutableDictionary(Of String, ReportDiagnostic).Empty)
100Dim map = CreateImmutableDictionary(("BC000", ReportDiagnostic.Suppress))
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
Microsoft.CodeAnalysis.Workspaces (135)
CodeStyle\NotificationOption2_operators.cs (11)
14ReportDiagnostic.Suppress => NotificationOption.None,
15ReportDiagnostic.Hidden => NotificationOption.Silent,
16ReportDiagnostic.Info => NotificationOption.Suggestion,
17ReportDiagnostic.Warn => NotificationOption.Warning,
18ReportDiagnostic.Error => NotificationOption.Error,
25public static string GetDisplayString(this ReportDiagnostic severity)
28ReportDiagnostic.Suppress => WorkspacesResources.None,
29ReportDiagnostic.Hidden => WorkspacesResources.Refactoring_Only,
30ReportDiagnostic.Info => WorkspacesResources.Suggestion,
31ReportDiagnostic.Warn => WorkspacesResources.Warning,
32ReportDiagnostic.Error => WorkspacesResources.Error,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\NotificationOption2.cs (18)
17[property: DataMember(Order = 0)] ReportDiagnostic Severity, [property: DataMember(Order = 1)] bool IsExplicitlySpecified)
20/// Notification option to disable or suppress an option with <see cref="ReportDiagnostic.Suppress"/>.
22public static NotificationOption2 None => new(ReportDiagnostic.Suppress, false);
25/// Notification option for a silent or hidden option with <see cref="ReportDiagnostic.Hidden"/>.
27public static NotificationOption2 Silent => new(ReportDiagnostic.Hidden, false);
30/// Notification option for a suggestion or an info option with <see cref="ReportDiagnostic.Info"/>.
32public static NotificationOption2 Suggestion => new(ReportDiagnostic.Info, false);
35/// Notification option for a warning option with <see cref="ReportDiagnostic.Warn"/>.
37public static NotificationOption2 Warning => new(ReportDiagnostic.Warn, false);
40/// Notification option for an error option with <see cref="ReportDiagnostic.Error"/>.
42public static NotificationOption2 Error => new(ReportDiagnostic.Error, false);
47public static NotificationOption2 ForSeverity(ReportDiagnostic reportDiagnostic)
50ReportDiagnostic.Error => Error,
51ReportDiagnostic.Warn => Warning,
52ReportDiagnostic.Info => Suggestion,
53ReportDiagnostic.Hidden or ReportDiagnostic.Default => Silent,
54ReportDiagnostic.Suppress => None,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (21)
34public static ReportDiagnostic GetEffectiveSeverity(
38ImmutableDictionary<string, ReportDiagnostic>? treeOptions)
40var effectiveSeverity = descriptor.GetEffectiveSeverity(compilationOptions);
45(!compilationOptions.SpecificDiagnosticOptions.TryGetValue(descriptor.Id, out var reportDiagnostic) ||
46reportDiagnostic == ReportDiagnostic.Default))
48if (treeOptions.TryGetValue(descriptor.Id, out reportDiagnostic) && reportDiagnostic != ReportDiagnostic.Default ||
51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
64public static ReportDiagnostic GetEffectiveSeverity(this DiagnosticDescriptor descriptor, CompilationOptions compilationOptions, SyntaxTree tree, AnalyzerOptions analyzerOptions)
66var effectiveSeverity = descriptor.GetEffectiveSeverity(compilationOptions);
70if (!compilationOptions.SpecificDiagnosticOptions.TryGetValue(descriptor.Id, out var reportDiagnostic) ||
71reportDiagnostic == ReportDiagnostic.Default)
78var severityInEditorConfig = descriptor.GetEffectiveSeverity(analyzerConfigOptions, providerAndTree);
79if (severityInEditorConfig != ReportDiagnostic.Default)
86var severityInGlobalConfig = descriptor.GetEffectiveSeverity(analyzerOptions.AnalyzerConfigOptionsProvider.GlobalOptions, providerAndTree);
87if (severityInGlobalConfig != ReportDiagnostic.Default)
102EditorConfigSeverityStrings.TryParse(value, out var severity))
145public static ReportDiagnostic GetEffectiveSeverity(
150ReportDiagnostic severity;
182return ReportDiagnostic.Default;
203return ReportDiagnostic.Default;
217out ReportDiagnostic severity)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ReportDiagnosticExtensions.cs (29)
14/// Returns the equivalent <see cref="DiagnosticSeverity"/> for a <see cref="ReportDiagnostic"/> value.
16/// <param name="reportDiagnostic">The <see cref="ReportDiagnostic"/> value.</param>
18/// The equivalent <see cref="DiagnosticSeverity"/> for a <see cref="ReportDiagnostic"/> value; otherwise,
25public static DiagnosticSeverity? ToDiagnosticSeverity(this ReportDiagnostic reportDiagnostic)
29case ReportDiagnostic.Error:
32case ReportDiagnostic.Warn:
35case ReportDiagnostic.Info:
38case ReportDiagnostic.Hidden:
41case ReportDiagnostic.Suppress:
42case ReportDiagnostic.Default:
51/// Applies a default severity to a <see cref="ReportDiagnostic"/> value.
53/// <param name="reportDiagnostic">The <see cref="ReportDiagnostic"/> value.</param>
56/// <para>If <paramref name="reportDiagnostic"/> is <see cref="ReportDiagnostic.Default"/>, returns
61public static ReportDiagnostic WithDefaultSeverity(this ReportDiagnostic reportDiagnostic, DiagnosticSeverity defaultSeverity)
63if (reportDiagnostic != ReportDiagnostic.Default)
71public static string ToEditorConfigString(this ReportDiagnostic reportDiagnostic)
75ReportDiagnostic.Suppress => EditorConfigSeverityStrings.None,
76ReportDiagnostic.Hidden => EditorConfigSeverityStrings.Silent,
77ReportDiagnostic.Info => EditorConfigSeverityStrings.Suggestion,
78ReportDiagnostic.Warn => EditorConfigSeverityStrings.Warning,
79ReportDiagnostic.Error => EditorConfigSeverityStrings.Error,
84public static NotificationOption2 ToNotificationOption(this ReportDiagnostic reportDiagnostic, DiagnosticSeverity defaultSeverity)
86var isNonDefault = reportDiagnostic != ReportDiagnostic.Default;
89ReportDiagnostic.Error => NotificationOption2.Error,
90ReportDiagnostic.Warn => NotificationOption2.Warning,
91ReportDiagnostic.Info => NotificationOption2.Suggestion,
92ReportDiagnostic.Hidden => NotificationOption2.Silent,
93ReportDiagnostic.Suppress => NotificationOption2.None,
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (6)
Microsoft.CodeAnalysis.Workspaces.UnitTests (48)
CodeStyle\EditorConfigCodeStyleParserTests.cs (30)
15[InlineData("true:none", true, ReportDiagnostic.Suppress)]
16[InlineData("true:refactoring", true, ReportDiagnostic.Hidden)]
17[InlineData("true:silent", true, ReportDiagnostic.Hidden)]
18[InlineData("true:suggestion", true, ReportDiagnostic.Info)]
19[InlineData("true:warning", true, ReportDiagnostic.Warn)]
20[InlineData("true:error", true, ReportDiagnostic.Error)]
21[InlineData("true", true, ReportDiagnostic.Hidden)]
22[InlineData("false:none", false, ReportDiagnostic.Suppress)]
23[InlineData("false:refactoring", false, ReportDiagnostic.Hidden)]
24[InlineData("false:silent", false, ReportDiagnostic.Hidden)]
25[InlineData("false:suggestion", false, ReportDiagnostic.Info)]
26[InlineData("false:warning", false, ReportDiagnostic.Warn)]
27[InlineData("false:error", false, ReportDiagnostic.Error)]
28[InlineData("false", false, ReportDiagnostic.Hidden)]
29[InlineData("*", false, ReportDiagnostic.Hidden)]
30[InlineData("false:false", false, ReportDiagnostic.Hidden)]
33[InlineData("true : warning", true, ReportDiagnostic.Warn)]
34[InlineData("false : warning", false, ReportDiagnostic.Warn)]
35[InlineData("true : error", true, ReportDiagnostic.Error)]
36[InlineData("false : error", false, ReportDiagnostic.Error)]
37public void TestParseEditorConfigCodeStyleOption(string args, bool isEnabled, ReportDiagnostic severity)
47[InlineData("never:none", AccessibilityModifiersRequired.Never, ReportDiagnostic.Suppress)]
48[InlineData("always:suggestion", AccessibilityModifiersRequired.Always, ReportDiagnostic.Info)]
49[InlineData("for_non_interface_members:warning", AccessibilityModifiersRequired.ForNonInterfaceMembers, ReportDiagnostic.Warn)]
50[InlineData("omit_if_default:error", AccessibilityModifiersRequired.OmitIfDefault, ReportDiagnostic.Error)]
51[InlineData("never : none", AccessibilityModifiersRequired.Never, ReportDiagnostic.Suppress), WorkItem("https://github.com/dotnet/roslyn/issues/27685")]
52[InlineData("always : suggestion", AccessibilityModifiersRequired.Always, ReportDiagnostic.Info)]
53[InlineData("for_non_interface_members : warning", AccessibilityModifiersRequired.ForNonInterfaceMembers, ReportDiagnostic.Warn)]
54[InlineData("omit_if_default : error", AccessibilityModifiersRequired.OmitIfDefault, ReportDiagnostic.Error)]
55internal void TestParseEditorConfigAccessibilityModifiers(string configurationString, AccessibilityModifiersRequired value, ReportDiagnostic severity)
SolutionTests\SolutionTests.cs (9)
4699Assert.True(provider.TryGetDiagnosticValue(newSyntaxTree, "CA1234", CancellationToken.None, out var severity));
4700Assert.Equal(ReportDiagnostic.Error, severity);
4728Assert.True(provider.TryGetDiagnosticValue(syntaxTreeAfterAddingEditorConfig, "CA1234", CancellationToken.None, out var severity));
4729Assert.Equal(ReportDiagnostic.Error, severity);
4769Assert.True(provider.TryGetDiagnosticValue(syntaxTreeBeforeEditorConfigChange, "CA1234", CancellationToken.None, out var severity));
4770Assert.Equal(ReportDiagnostic.Error, severity);
4783Assert.Equal(ReportDiagnostic.Error, severity);
4813Assert.True(newProvider.TryGetGlobalDiagnosticValue("CA1234", default, out var severity));
4814Assert.Equal(ReportDiagnostic.Error, severity);
Microsoft.VisualStudio.LanguageServices (48)
EditorConfigSettings\Analyzers\ViewModel\SeverityViewModel.cs (11)
51ReportDiagnostic.Suppress => 0,
52ReportDiagnostic.Hidden => 1,
53ReportDiagnostic.Info => 2,
54ReportDiagnostic.Warn => 3,
55ReportDiagnostic.Error => 4,
70var severity = selectedIndex switch
720 => ReportDiagnostic.Suppress,
731 => ReportDiagnostic.Hidden,
742 => ReportDiagnostic.Info,
753 => ReportDiagnostic.Warn,
764 => ReportDiagnostic.Error,
EditorConfigSettings\NamingStyle\ViewModel\ColumnViewModels\NamingStylesSeverityViewModel.cs (11)
21ReportDiagnostic.Suppress => 0,
22ReportDiagnostic.Hidden => 1,
23ReportDiagnostic.Info => 2,
24ReportDiagnostic.Warn => 3,
25ReportDiagnostic.Error => 4,
34var severity = selectedIndex switch
360 => ReportDiagnostic.Suppress,
371 => ReportDiagnostic.Hidden,
382 => ReportDiagnostic.Info,
393 => ReportDiagnostic.Warn,
404 => ReportDiagnostic.Error,
Microsoft.VisualStudio.LanguageServices.CSharp (15)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (24)
ProjectSystemShim\LegacyProject\AnalyzersTests.cs (16)
41Assert.Equal(expected: ReportDiagnostic.Default, actual: options.GeneralDiagnosticOption);
47Assert.Equal(expected: ReportDiagnostic.Error, actual: options.GeneralDiagnosticOption);
82Assert.Equal(expected: ReportDiagnostic.Warn, actual: options.GeneralDiagnosticOption);
89Assert.Equal(expected: ReportDiagnostic.Error, actual: options.GeneralDiagnosticOption);
112var ca1012DiagnosticOption = options.SpecificDiagnosticOptions["CA1012"];
113Assert.Equal(expected: ReportDiagnostic.Error, actual: ca1012DiagnosticOption);
136var ca1014DiagnosticOption = options.SpecificDiagnosticOptions["CS1014"];
137Assert.Equal(expected: ReportDiagnostic.Error, actual: ca1014DiagnosticOption);
178Assert.Equal(expected: ReportDiagnostic.Error, actual: options.SpecificDiagnosticOptions["CS1014"]);
182Assert.Equal(expected: ReportDiagnostic.Suppress, actual: options.SpecificDiagnosticOptions["CS1014"]);
186Assert.Equal(expected: ReportDiagnostic.Error, actual: options.SpecificDiagnosticOptions["CS1014"]);
190Assert.Equal(expected: ReportDiagnostic.Suppress, actual: options.SpecificDiagnosticOptions["CS1014"]);
216var ca1014DiagnosticOption = options.SpecificDiagnosticOptions["CS1014"];
217Assert.Equal(expected: ReportDiagnostic.Suppress, actual: ca1014DiagnosticOption);
248Assert.Equal(expected: ReportDiagnostic.Error, actual: options.GeneralDiagnosticOption);
259Assert.Equal(expected: ReportDiagnostic.Warn, actual: options.GeneralDiagnosticOption);
Microsoft.VisualStudio.LanguageServices.UnitTests (57)
ProjectSystemShim\ConvertedVisualBasicProjectOptionsTests.vb (39)
25Dim convertedOptions = GetConvertedOptions(ruleSetGeneralOption:=ReportDiagnostic.Warn, commandLineGeneralOption:=WarningLevel.WARN_AsError)
27Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.GeneralDiagnosticOption)
33Dim ruleSetSpecificOptions = New Dictionary(Of String, ReportDiagnostic) From
35{"Test001", ReportDiagnostic.Warn}
40Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.GeneralDiagnosticOption)
42Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.SpecificDiagnosticOptions("Test001"))
47Dim ruleSetSpecificOptions = New Dictionary(Of String, ReportDiagnostic) From
49{"Test001", ReportDiagnostic.Info}
54Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.GeneralDiagnosticOption)
56Assert.Equal(expected:=ReportDiagnostic.Info, actual:=convertedOptions.SpecificDiagnosticOptions("Test001"))
61Dim ruleSetSpecificOptions = New Dictionary(Of String, ReportDiagnostic) From
63{"Test001", ReportDiagnostic.Info}
71Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.GeneralDiagnosticOption)
73Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.SpecificDiagnosticOptions("Test001"))
78Dim ruleSetSpecificOptions = New Dictionary(Of String, ReportDiagnostic) From
80{"Test001", ReportDiagnostic.Warn}
88Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.GeneralDiagnosticOption)
90Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=convertedOptions.SpecificDiagnosticOptions("Test001"))
95Dim ruleSetSpecificOptions = New Dictionary(Of String, ReportDiagnostic) From
97{"Test001", ReportDiagnostic.Warn}
105Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.GeneralDiagnosticOption)
107Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=convertedOptions.SpecificDiagnosticOptions("Test001"))
108Assert.Equal(expected:=ReportDiagnostic.Default, actual:=convertedOptions.SpecificDiagnosticOptions("Test002"))
113Dim ruleSetSpecificOptions = New Dictionary(Of String, ReportDiagnostic) From
115{"Test001", ReportDiagnostic.Error},
116{"Test002", ReportDiagnostic.Warn},
117{"Test003", ReportDiagnostic.Info}
124Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=convertedOptions.GeneralDiagnosticOption)
126Assert.Equal(expected:=ReportDiagnostic.Error, actual:=convertedOptions.SpecificDiagnosticOptions("Test001"))
127Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=convertedOptions.SpecificDiagnosticOptions("Test002"))
128Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=convertedOptions.SpecificDiagnosticOptions("Test003"))
133Dim ruleSetSpecificOptions = New Dictionary(Of String, ReportDiagnostic) From
135{"Test001", ReportDiagnostic.Warn}
143Assert.Equal(expected:=ReportDiagnostic.Default, actual:=convertedOptions.GeneralDiagnosticOption)
145Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=convertedOptions.SpecificDiagnosticOptions("Test001"))
149Optional ruleSetGeneralOption As ReportDiagnostic = ReportDiagnostic.Default,
150Optional ruleSetSpecificOptions As ImmutableDictionary(Of String, ReportDiagnostic) = Nothing,
156ruleSetSpecificOptions = If(ruleSetSpecificOptions, ImmutableDictionary(Of String, ReportDiagnostic).Empty)
SolutionExplorer\RuleSetDocumentExtensionsTests.vb (7)
20document.SetSeverity("Alpha.Analyzer", "Test001", ReportDiagnostic.Error)
43document.SetSeverity("Alpha.Analyzer", "Test001", ReportDiagnostic.Warn)
66document.SetSeverity("Beta.Analyzer", "Test001", ReportDiagnostic.Warn)
95document.SetSeverity("Alpha.Analyzer", "Test001", ReportDiagnostic.Error)
118document.SetSeverity("Alpha.Analyzer", "Test001", ReportDiagnostic.Default)
140document.SetSeverity("Alpha.Analyzer", "Test001", ReportDiagnostic.Default)
165document.SetSeverity("Alpha.Analyzer", "Test001", ReportDiagnostic.Default)
Microsoft.VisualStudio.LanguageServices.VisualBasic (23)
ProjectSystemShim\VisualBasicProject.OptionsProcessor.vb (23)
64Dim ruleSetFileGeneralDiagnosticOption As ReportDiagnostic? = Nothing
65Dim ruleSetFileSpecificDiagnosticOptions As IDictionary(Of String, ReportDiagnostic) = Nothing
72Dim generalDiagnosticOption As ReportDiagnostic = DetermineGeneralDiagnosticOption(compilerOptions.WarningLevel, ruleSetFileGeneralDiagnosticOption)
73Dim specificDiagnosticOptions As IReadOnlyDictionary(Of String, ReportDiagnostic) = DetermineSpecificDiagnosticOptions(compilerOptions, ruleSetFileSpecificDiagnosticOptions)
251Private Shared Function DetermineGeneralDiagnosticOption(level As WarningLevel, ruleSetGeneralDiagnosticOption As ReportDiagnostic?) As ReportDiagnostic
262Private Shared Function DetermineSpecificDiagnosticOptions(options As VBCompilerOptions, ruleSetSpecificDiagnosticOptions As IDictionary(Of String, ReportDiagnostic)) As IReadOnlyDictionary(Of String, ReportDiagnostic)
264ruleSetSpecificDiagnosticOptions = New Dictionary(Of String, ReportDiagnostic)
268Dim diagnosticOptions = New Dictionary(Of String, ReportDiagnostic)(ruleSetSpecificDiagnosticOptions)
273If pair.Value = ReportDiagnostic.Warn Then
274diagnosticOptions(pair.Key) = ReportDiagnostic.Error
280If pair.Value <> ReportDiagnostic.Error Then
281diagnosticOptions(pair.Key) = ReportDiagnostic.Suppress
288diagnosticOptions(diagnosticID) = ReportDiagnostic.Error
292Dim ruleSetOption As ReportDiagnostic
296diagnosticOptions(diagnosticID) = ReportDiagnostic.Default
301diagnosticOptions(diagnosticID) = ReportDiagnostic.Suppress
304Return New ReadOnlyDictionary(Of String, ReportDiagnostic)(diagnosticOptions)
307Private Shared Function ConvertWarningLevel(level As WarningLevel) As ReportDiagnostic
310Return ReportDiagnostic.Suppress
313Return ReportDiagnostic.Default
316Return ReportDiagnostic.Error
Mvc.Api.Analyzers.Test (2)
System.Windows.Forms.Analyzers.CSharp.Tests (5)