2153 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;
2133private static void AddWarnings(Dictionary<string, ReportDiagnostic> d, ReportDiagnostic kind, ReadOnlyMemory<char> warningArgument)
2139ReportDiagnostic existing;
2143if (existing != ReportDiagnostic.Suppress)
2178private static void AddDiagnostic(IList<Diagnostic> diagnostics, Dictionary<string, ReportDiagnostic> warningOptions, ErrorCode errorCode, params object[] arguments)
2181ReportDiagnostic value;
2183if (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.CodeStyle.UnitTests (4)
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (159)
CommandLineTests.cs (154)
307Assert.True(compilerTreeOptions.TryGetDiagnosticValue(tree, "cs0169", CancellationToken.None, out var severity));
308Assert.Equal(ReportDiagnostic.Suppress, severity);
310Assert.Equal(ReportDiagnostic.Suppress, severity);
2842Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions["CA1012"] == ReportDiagnostic.Error);
2844Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions["CA1013"] == ReportDiagnostic.Warn);
2846Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions["CA1014"] == ReportDiagnostic.Suppress);
2847Assert.True(parsedArgs.CompilationOptions.GeneralDiagnosticOption == ReportDiagnostic.Warn);
3046Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Error);
3078Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Error);
3079Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Error);
3111Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Error);
3112Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Info);
3144Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Default);
3145Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Error);
3178Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Default);
3179Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Warn);
3212Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Error);
3213Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Warn);
3246Assert.Equal(actual: arguments.CompilationOptions.GeneralDiagnosticOption, expected: ReportDiagnostic.Default);
3247Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"], expected: ReportDiagnostic.Warn);
3248Assert.Equal(actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test002"], expected: ReportDiagnostic.Default);
3280Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption);
3282Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"]);
3315Assert.Equal(expected: ReportDiagnostic.Error, actual: arguments.CompilationOptions.GeneralDiagnosticOption);
3317Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"]);
3350Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption);
3352Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"]);
3374Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption);
3379Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions[warning]);
3382Assert.Equal(expected: ReportDiagnostic.Suppress,
3384Assert.Equal(expected: ReportDiagnostic.Suppress,
3407Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption);
3412Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions[warning]);
3415Assert.Equal(expected: ReportDiagnostic.Suppress,
3417Assert.Equal(expected: ReportDiagnostic.Suppress,
3440Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption);
3445Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions[warning]);
3448Assert.Equal(expected: ReportDiagnostic.Suppress, actual: arguments.CompilationOptions.SpecificDiagnosticOptions["Test001"]);
3449Assert.Equal(expected: ReportDiagnostic.Suppress,
3451Assert.Equal(expected: ReportDiagnostic.Suppress,
3474Assert.Equal(expected: ReportDiagnostic.Default, actual: arguments.CompilationOptions.GeneralDiagnosticOption);
3479Assert.Equal(expected: ReportDiagnostic.Error, actual: arguments.CompilationOptions.SpecificDiagnosticOptions[warning]);
3482Assert.Equal(expected: ReportDiagnostic.Error,
3484Assert.Equal(expected: ReportDiagnostic.Error,
5446private static void AssertSpecificDiagnostics(int[] expectedCodes, ReportDiagnostic[] expectedOptions, CSharpCommandLineArguments args)
5462Assert.Equal(ReportDiagnostic.Error, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5468Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5470AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Error }, parsedArgs);
5474Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5476AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Error }, parsedArgs);
5480Assert.Equal(ReportDiagnostic.Error, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5482AssertSpecificDiagnostics(new int[0], new ReportDiagnostic[0], parsedArgs);
5486Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5488AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Error }, parsedArgs);
5492Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5494AssertSpecificDiagnostics(new int[0], new ReportDiagnostic[0], parsedArgs);
5498Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5500AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Default, ReportDiagnostic.Default, ReportDiagnostic.Default }, parsedArgs);
5504Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5508new[] { ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Default, ReportDiagnostic.Default },
5513Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5516AssertSpecificDiagnostics(new[] { 1062, 1066, 1734, 1974 }, new[] { ReportDiagnostic.Default, ReportDiagnostic.Error, ReportDiagnostic.Error, ReportDiagnostic.Default }, parsedArgs);
5520Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5522AssertSpecificDiagnostics(new[] { 1062, 1066, 1734, 1974 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Default, ReportDiagnostic.Default, ReportDiagnostic.Error }, parsedArgs);
5526Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5528AssertSpecificDiagnostics(new int[0], new ReportDiagnostic[0], parsedArgs);
5532Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5534AssertSpecificDiagnostics(new int[0], new ReportDiagnostic[0], parsedArgs);
5538Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5540AssertSpecificDiagnostics(new[] { 1062, 1974 }, new[] { ReportDiagnostic.Error, ReportDiagnostic.Error }, parsedArgs);
5544Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5546AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Suppress }, parsedArgs);
5550Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5552AssertSpecificDiagnostics(new[] { 1062, 1066, 1734 }, new[] { ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Suppress }, parsedArgs);
5556Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5558AssertSpecificDiagnostics(new[] { 1062, 1066, 1734, 1762 }, new[] { ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Error }, parsedArgs);
5562Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption);
5564AssertSpecificDiagnostics(new[] { 1062, 1066, 1734, 1762 }, new[] { ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Suppress, ReportDiagnostic.Error }, parsedArgs);
13163TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Error);
13166TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress, noWarn: true);
13175TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn, rulesetText: rulesetText);
13182TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn);
13189TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn);
13196TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn);
13203TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn);
13209TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, warnAsError: true, expectedDiagnosticSeverity: ReportDiagnostic.Error);
13216TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress);
13223TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress);
13230TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText: string.Empty, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress);
13236TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress);
13242TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress);
13264var defaultReportDiagnostic = DiagnosticDescriptor.MapSeverityToReport(defaultSeverity);
13265var expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Error;
13272TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Suppress, noWarn: true);
13281TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn, rulesetText: rulesetText);
13285expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Warn;
13302expectedDiagnosticSeverity = customConfigurable && defaultReportDiagnostic != ReportDiagnostic.Warn ? defaultReportDiagnostic : ReportDiagnostic.Error;
13311expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Suppress;
13322expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Suppress;
13328expectedDiagnosticSeverity = customConfigurable ? defaultReportDiagnostic : ReportDiagnostic.Suppress;
13354TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Error);
13361TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Error);
13369TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn);
13382TestBulkAnalyzerConfigurationCore(analyzer, analyzerConfigText, errorlog, expectedDiagnosticSeverity: ReportDiagnostic.Warn, rulesetText);
13389ReportDiagnostic expectedDiagnosticSeverity,
13434var expectedErrorCode = expectedDiagnosticSeverity == ReportDiagnostic.Error ? 1 : 0;
13439ReportDiagnostic.Error => "error",
13440ReportDiagnostic.Warn => "warning",
13441ReportDiagnostic.Info => errorlog ? "info" : null,
13442ReportDiagnostic.Hidden => null,
13443ReportDiagnostic.Suppress => null,
13622public void AnalyzerConfigRespectedForNoLocationDiagnostic(ReportDiagnostic reportDiagnostic, bool isEnabledByDefault, bool noWarn, bool errorlog)
13631public void AnalyzerConfigRespectedForDisabledByDefaultDiagnostic(ReportDiagnostic analyzerConfigSeverity, bool isEnabledByDefault, bool noWarn, bool errorlog, bool customConfigurable)
13637private void TestAnalyzerConfigRespectedCore(DiagnosticAnalyzer analyzer, DiagnosticDescriptor descriptor, ReportDiagnostic analyzerConfigSeverity, bool noWarn, bool errorlog, bool customConfigurable)
13639if (analyzerConfigSeverity == ReportDiagnostic.Default)
13679var expectedErrorCode = !noWarn && analyzerConfigSeverity == ReportDiagnostic.Error ? 1 : 0;
13684(analyzerConfigSeverity == ReportDiagnostic.Error ||
13685analyzerConfigSeverity == ReportDiagnostic.Warn ||
13686(analyzerConfigSeverity == ReportDiagnostic.Info && errorlog)))
13688var prefix = analyzerConfigSeverity == ReportDiagnostic.Error ? "error" : analyzerConfigSeverity == ReportDiagnostic.Warn ? "warning" : "info";
15658var comp = CreateCompilation(src, options: TestOptions.DebugExe.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress));
15794var 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 (14)
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)
572IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
573warnings.Add(MessageProvider.Instance.GetIdForErrorCode(420), ReportDiagnostic.Suppress);
577option = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Error);
583warnings[MessageProvider.Instance.GetIdForErrorCode(420)] = ReportDiagnostic.Error;
584option = TestOptions.ReleaseExe.WithGeneralDiagnosticOption(ReportDiagnostic.Default).WithSpecificDiagnosticOptions(warnings);
616IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
617warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Suppress);
624warnings[MessageProvider.Instance.GetIdForErrorCode(168)] = ReportDiagnostic.Error;
646option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
676IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
677warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
693option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
727IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
728warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
750option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
783IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
784warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
806option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
839IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
840warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
862option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
897IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
898warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
920option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
955IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
956warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
978option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1014IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1015warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1043option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1084IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1085warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1119option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1155IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1156warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1184option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1220IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1221warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1237option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1273IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1274warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1290option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1327IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1328warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1344option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1377IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1378warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1388option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1428var warnings = new Dictionary<string, ReportDiagnostic>();
1429warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1445option = commonoption.WithWarningLevel(2).WithGeneralDiagnosticOption(ReportDiagnostic.Error);
1484IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1485warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1501warnings = new Dictionary<string, ReportDiagnostic>();
1502warnings.Add(MessageProvider.Instance.GetIdForErrorCode(1633), ReportDiagnostic.Suppress);
1551IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1552warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1601IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1602warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1657IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1658warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1704IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1705warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1741IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1742warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1774IDictionary<string, ReportDiagnostic> warnings = new Dictionary<string, ReportDiagnostic>();
1775warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1785warnings[MessageProvider.Instance.GetIdForErrorCode(168)] = ReportDiagnostic.Suppress;
1823var warnings = new Dictionary<string, ReportDiagnostic>();
1824warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
1837warnings[MessageProvider.Instance.GetIdForErrorCode(168)] = ReportDiagnostic.Suppress;
2146var options = TestOptions.DebugDll.WithGeneralDiagnosticOption(ReportDiagnostic.Suppress);
2247var warnings = new Dictionary<string, ReportDiagnostic>();
2248warnings.Add(MessageProvider.Instance.GetIdForErrorCode(168), ReportDiagnostic.Error);
2267warnings[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 (3)
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)
2842Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions("CA1012") = ReportDiagnostic.Error)
2844Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions("CA1013") = ReportDiagnostic.Warn)
2846Assert.True(parsedArgs.CompilationOptions.SpecificDiagnosticOptions("CA1014") = ReportDiagnostic.Suppress)
2847Assert.True(parsedArgs.CompilationOptions.GeneralDiagnosticOption = ReportDiagnostic.Warn)
5786Private Shared Sub AssertSpecificDiagnostics(expectedCodes As Integer(), expectedOptions As ReportDiagnostic(), args As VisualBasicCommandLineArguments)
5800Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5804Assert.Equal(ReportDiagnostic.Error, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5808Assert.Equal(ReportDiagnostic.Error, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5812Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5816Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5817AssertSpecificDiagnostics({42024, 42025}, {ReportDiagnostic.Error, ReportDiagnostic.Error}, parsedArgs)
5821Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5825Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5826AssertSpecificDiagnostics({42024, 42025}, {ReportDiagnostic.Error, ReportDiagnostic.Error}, parsedArgs)
5830Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5834Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5838Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5839AssertSpecificDiagnostics({42024, 42025}, {ReportDiagnostic.Default, ReportDiagnostic.Default}, parsedArgs)
5843Assert.Equal(ReportDiagnostic.Suppress, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5847Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5851Assert.Equal(ReportDiagnostic.Default, parsedArgs.CompilationOptions.GeneralDiagnosticOption)
5852AssertSpecificDiagnostics({42024, 42025}, {ReportDiagnostic.Suppress, ReportDiagnostic.Suppress}, parsedArgs)
8720Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8740Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8742Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8761Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8763Assert.Equal(expected:=ReportDiagnostic.Info, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8782Assert.Equal(expected:=ReportDiagnostic.Default, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8784Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8803Assert.Equal(expected:=ReportDiagnostic.Default, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8805Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8824Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8826Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8845Assert.Equal(expected:=ReportDiagnostic.Default, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8847Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8848Assert.Equal(expected:=ReportDiagnostic.Default, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test002"))
8867Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8869Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8888Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8890Assert.Equal(expected:=ReportDiagnostic.Warn, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8911Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8913Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
8914Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test002"))
8915Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test003"))
8934Assert.Equal(expected:=ReportDiagnostic.Error, actual:=arguments.CompilationOptions.GeneralDiagnosticOption)
8936Assert.Equal(expected:=ReportDiagnostic.Suppress, actual:=arguments.CompilationOptions.SpecificDiagnosticOptions("Test001"))
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (3)
Microsoft.CodeAnalysis.VisualBasic.Features.UnitTests (2)
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 (7)
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)