/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/RoslynAnalyzers/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Verifiers/CSharpVerifierHelper.cs
31 строка
2 KB
Cyrus Najmabadi
Use collection expressions
08 июл 2025, 23:00
08 июл 2025, 23:00
5cfde68
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable enable using System; using System.Collections.Immutable; using Microsoft.CodeAnalysis.CSharp; namespace Microsoft.CodeAnalysis.ResxSourceGenerator.Test { internal static class CSharpVerifierHelper { /// <summary> /// By default, the compiler reports diagnostics for nullable reference types at /// <see cref="DiagnosticSeverity.Warning"/>, and the analyzer test framework defaults to only validating /// diagnostics at <see cref="DiagnosticSeverity.Error"/>. This map contains all compiler diagnostic IDs /// related to nullability mapped to <see cref="ReportDiagnostic.Error"/>, which is then used to enable all /// of these warnings for default validation during analyzer and code fix tests. /// </summary> internal static ImmutableDictionary<string, ReportDiagnostic> NullableWarnings { get; } = GetNullableWarningsFromCompiler(); private static ImmutableDictionary<string, ReportDiagnostic> GetNullableWarningsFromCompiler() { string[] args = ["/warnaserror:nullable"]; var commandLineArguments = CSharpCommandLineParser.Default.Parse(args, baseDirectory: Environment.CurrentDirectory, sdkDirectory: Environment.CurrentDirectory); return commandLineArguments.CompilationOptions.SpecificDiagnosticOptions; } } }