diff --git a/.editorconfig b/.editorconfig
index ec7ce9e028..554c51394f 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -12,6 +12,11 @@ indent_style = space
# https://github.com/dotnet/roslyn-analyzers/issues/3389
dotnet_diagnostic.RS1024.severity = none
+# IDE0078: Use pattern matching
+# https://github.com/dotnet/roslyn/issues/51691
+# https://github.com/dotnet/roslyn/issues/51693
+dotnet_diagnostic.IDE0078.severity = silent
+
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md
index 82c2a5cecf..8b98f2e512 100644
--- a/.github/ISSUE_TEMPLATE/bug-report.md
+++ b/.github/ISSUE_TEMPLATE/bug-report.md
@@ -1,6 +1,6 @@
---
name: Bug report
-about: Report a bug, false-positive or false-negative
+about: Report a bug, false-positive or false-negative for a CAxxxx rule. For IDExxxx, please open an issue in dotnet/roslyn repository.
title: ''
labels: ''
assignees: ''
diff --git a/README.md b/README.md
index 7b14b99f26..44f4e31f11 100644
--- a/README.md
+++ b/README.md
@@ -160,7 +160,7 @@ See [VERSIONING.md](.//VERSIONING.md) for the versioning scheme for all analyzer
Recommended Analyzer Package Version: [![NuGet](https://img.shields.io/nuget/v/Microsoft.CodeAnalysis.NetAnalyzers.svg)](https://www.nuget.org/packages/Microsoft.CodeAnalysis.NetAnalyzers)
-Required Visual Studio Version: **Visual Studio 2019 16.8 RTW or later**
+Required Visual Studio Version: **Visual Studio 2019 16.9 RTW or later**
Required .NET SDK Version: **.NET 5.0 SDK or later**
diff --git a/eng/Versions.props b/eng/Versions.props
index 4b3b2f50bc..456e39cff5 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -24,7 +24,7 @@
true
- 3.8.0
+ 3.9.0$(MicrosoftNETCoreCompilersPackageVersion)$(MicrosoftNETCoreCompilersPackageVersion)
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/ClassIsNotDiagnosticAnalyzer.cs b/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/ClassIsNotDiagnosticAnalyzer.cs
index ad52abb322..b2dba40de0 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/ClassIsNotDiagnosticAnalyzer.cs
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/ClassIsNotDiagnosticAnalyzer.cs
@@ -13,7 +13,7 @@ public sealed class ClassIsNotDiagnosticAnalyzer : DiagnosticAnalyzer
private static readonly LocalizableString s_localizableTitleNotDiagnosticAnalyzer = new LocalizableResourceString(nameof(CodeAnalysisDiagnosticsResources.ClassIsNotDiagnosticAnalyzerTitle), CodeAnalysisDiagnosticsResources.ResourceManager, typeof(CodeAnalysisDiagnosticsResources));
private static readonly LocalizableString s_localizableMessageNotDiagnosticAnalyzer = new LocalizableResourceString(nameof(CodeAnalysisDiagnosticsResources.ClassIsNotDiagnosticAnalyzerMessage), CodeAnalysisDiagnosticsResources.ResourceManager, typeof(CodeAnalysisDiagnosticsResources));
- public static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(
+ public static readonly DiagnosticDescriptor Rule = new(
DiagnosticIds.TypeIsNotDiagnosticAnalyzerRuleId,
s_localizableTitleNotDiagnosticAnalyzer,
s_localizableMessageNotDiagnosticAnalyzer,
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/DiagnosticDescriptorCreationAnalyzer.cs b/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/DiagnosticDescriptorCreationAnalyzer.cs
index 9985e56343..65321bdf0e 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/DiagnosticDescriptorCreationAnalyzer.cs
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/DiagnosticDescriptorCreationAnalyzer.cs
@@ -171,7 +171,7 @@ public sealed partial class DiagnosticDescriptorCreationAnalyzer : DiagnosticAna
///
/// RS1031 ()
///
- public static readonly DiagnosticDescriptor DefineDiagnosticTitleCorrectlyRule = new DiagnosticDescriptor(
+ public static readonly DiagnosticDescriptor DefineDiagnosticTitleCorrectlyRule = new(
DiagnosticIds.DefineDiagnosticTitleCorrectlyRuleId,
s_localizableDefineDiagnosticTitleCorrectlyTitle,
s_localizableDefineDiagnosticTitleCorrectlyMessage,
@@ -183,7 +183,7 @@ public sealed partial class DiagnosticDescriptorCreationAnalyzer : DiagnosticAna
///
/// RS1032 ()
///
- public static readonly DiagnosticDescriptor DefineDiagnosticMessageCorrectlyRule = new DiagnosticDescriptor(
+ public static readonly DiagnosticDescriptor DefineDiagnosticMessageCorrectlyRule = new(
DiagnosticIds.DefineDiagnosticMessageCorrectlyRuleId,
s_localizableDefineDiagnosticMessageCorrectlyTitle,
s_localizableDefineDiagnosticMessageCorrectlyMessage,
@@ -195,7 +195,7 @@ public sealed partial class DiagnosticDescriptorCreationAnalyzer : DiagnosticAna
///
/// RS1033 ()
///
- public static readonly DiagnosticDescriptor DefineDiagnosticDescriptionCorrectlyRule = new DiagnosticDescriptor(
+ public static readonly DiagnosticDescriptor DefineDiagnosticDescriptionCorrectlyRule = new(
DiagnosticIds.DefineDiagnosticDescriptionCorrectlyRuleId,
s_localizableDefineDiagnosticDescriptionCorrectlyTitle,
s_localizableDefineDiagnosticDescriptionCorrectlyMessage,
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/DiagnosticDescriptorCreationAnalyzer_IdRangeAndCategoryValidation.cs b/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/DiagnosticDescriptorCreationAnalyzer_IdRangeAndCategoryValidation.cs
index d053507fa6..87699ebc7e 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/DiagnosticDescriptorCreationAnalyzer_IdRangeAndCategoryValidation.cs
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/DiagnosticDescriptorCreationAnalyzer_IdRangeAndCategoryValidation.cs
@@ -35,7 +35,7 @@ public sealed partial class DiagnosticDescriptorCreationAnalyzer
///
/// RS1018 ()
///
- public static readonly DiagnosticDescriptor DiagnosticIdMustBeInSpecifiedFormatRule = new DiagnosticDescriptor(
+ public static readonly DiagnosticDescriptor DiagnosticIdMustBeInSpecifiedFormatRule = new(
DiagnosticIds.DiagnosticIdMustBeInSpecifiedFormatRuleId,
s_localizableDiagnosticIdMustBeInSpecifiedFormatTitle,
s_localizableDiagnosticIdMustBeInSpecifiedFormatMessage,
@@ -48,7 +48,7 @@ public sealed partial class DiagnosticDescriptorCreationAnalyzer
///
/// RS1020 ()
///
- public static readonly DiagnosticDescriptor UseCategoriesFromSpecifiedRangeRule = new DiagnosticDescriptor(
+ public static readonly DiagnosticDescriptor UseCategoriesFromSpecifiedRangeRule = new(
DiagnosticIds.UseCategoriesFromSpecifiedRangeRuleId,
s_localizableUseCategoriesFromSpecifiedRangeTitle,
s_localizableUseCategoriesFromSpecifiedRangeMessage,
@@ -61,7 +61,7 @@ public sealed partial class DiagnosticDescriptorCreationAnalyzer
///
/// RS1021 ()
///
- public static readonly DiagnosticDescriptor AnalyzerCategoryAndIdRangeFileInvalidRule = new DiagnosticDescriptor(
+ public static readonly DiagnosticDescriptor AnalyzerCategoryAndIdRangeFileInvalidRule = new(
DiagnosticIds.AnalyzerCategoryAndIdRangeFileInvalidRuleId,
s_localizableAnalyzerCategoryAndIdRangeFileInvalidTitle,
s_localizableAnalyzerCategoryAndIdRangeFileInvalidMessage,
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/DoNotUseCompilationGetSemanticModelAnalyzer.cs b/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/DoNotUseCompilationGetSemanticModelAnalyzer.cs
index 66fe860b75..7ba5f46311 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/DoNotUseCompilationGetSemanticModelAnalyzer.cs
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/DoNotUseCompilationGetSemanticModelAnalyzer.cs
@@ -16,7 +16,7 @@ public sealed class DoNotUseCompilationGetSemanticModelAnalyzer : DiagnosticAnal
private static readonly LocalizableString s_localizableMessage = new LocalizableResourceString(nameof(CodeAnalysisDiagnosticsResources.DoNotUseCompilationGetSemanticModelMessage), CodeAnalysisDiagnosticsResources.ResourceManager, typeof(CodeAnalysisDiagnosticsResources));
private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(CodeAnalysisDiagnosticsResources.DoNotUseCompilationGetSemanticModelDescription), CodeAnalysisDiagnosticsResources.ResourceManager, typeof(CodeAnalysisDiagnosticsResources));
- public static readonly DiagnosticDescriptor Rule = new DiagnosticDescriptor(
+ public static readonly DiagnosticDescriptor Rule = new(
DiagnosticIds.DoNotUseCompilationGetSemanticModelRuleId,
s_localizableTitle,
s_localizableMessage,
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/Fixers/DefineDiagnosticDescriptorArgumentsCorrectlyFix.CustomFixAllProvider.cs b/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/Fixers/DefineDiagnosticDescriptorArgumentsCorrectlyFix.CustomFixAllProvider.cs
index 9673a99e02..bc67817878 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/Fixers/DefineDiagnosticDescriptorArgumentsCorrectlyFix.CustomFixAllProvider.cs
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/Fixers/DefineDiagnosticDescriptorArgumentsCorrectlyFix.CustomFixAllProvider.cs
@@ -18,7 +18,7 @@ public sealed partial class DefineDiagnosticDescriptorArgumentsCorrectlyFix : Co
{
private sealed class CustomFixAllProvider : FixAllProvider
{
- public static CustomFixAllProvider Instance = new CustomFixAllProvider();
+ public static CustomFixAllProvider Instance = new();
private CustomFixAllProvider()
{
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.cs.xlf b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.cs.xlf
index 6b289810ca..3bbe952d7c 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.cs.xlf
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.cs.xlf
@@ -259,22 +259,22 @@
- Prefer 'syntax.IsKind(kind)' to 'syntax.Kind() == kind' when checking syntax kinds. Code using 'IsKind' is slightly more efficient at runtime, so consistent use of this form where applicable helps improve performance in complex analysis scenarios.
+ Při kontrole typů syntaxe upřednostňovat syntax.IsKind(kind) před syntax.Kind() == kind. Kód, který používá IsKind, je za běhu o něco efektivnější, proto konzistentní používání tohoto tvaru tam, kde je to možné, pomáhá zlepšit výkon ve scénářích komplexní analýzy.
- Use 'IsKind' instead of 'Kind'
+ Použijte IsKind místo Kind.
- Prefer 'IsKind' for checking syntax kinds
+ Při kontrole typů syntaxí upřednostňujte IsKind.
- Prefer 'IsKind' for checking syntax kinds
+ Při kontrole typů syntaxí upřednostňovat IsKind
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.de.xlf b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.de.xlf
index 3361521c83..f0e8910634 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.de.xlf
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.de.xlf
@@ -259,22 +259,22 @@
- Prefer 'syntax.IsKind(kind)' to 'syntax.Kind() == kind' when checking syntax kinds. Code using 'IsKind' is slightly more efficient at runtime, so consistent use of this form where applicable helps improve performance in complex analysis scenarios.
+ Bei der Überprüfung von Syntaxarten ist "syntax.IsKind(kind)" der Syntax "syntax.Kind() == kind" vorzuziehen. Der Code mit "IsKind" ist zur Laufzeit etwas effizienter, daher trägt die konsistente Verwendung dieser Form in komplexen Analyseszenarios zur Verbesserung der Leistung bei.
- Use 'IsKind' instead of 'Kind'
+ "IsKind" anstelle von "Kind" verwenden
- Prefer 'IsKind' for checking syntax kinds
+ "IsKind" für die Überprüfung von Syntaxarten bevorzugen
- Prefer 'IsKind' for checking syntax kinds
+ "IsKind" für die Überprüfung von Syntaxarten bevorzugen
@@ -557,7 +557,7 @@
- Ein CodeFixProvider sollte FixAll-Unterstützung bereitstellen, um mehrere Instanzen der zugrunde liegenden Diagnose mit einer einzigen Codefehlerbehebung zu korrigieren. Weitere Informationen finden Sie in der Dokumentation unter https://github.com/dotnet/roslyn/blob/main/docs/analyzers/FixAllProvider.md.
+ Ein CodeFixProvider muss FixAll-Unterstützung bereitstellen, damit mehrere Instanzen der zugrunde liegenden Diagnose mit einer einzigen Codefehlerbehebung korrigiert werden können. Weitere Informationen finden Sie in der Dokumentation unter https://github.com/dotnet/roslyn/blob/main/docs/analyzers/FixAllProvider.md.
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.es.xlf b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.es.xlf
index dcbfd48716..1d99ded1b9 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.es.xlf
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.es.xlf
@@ -259,22 +259,22 @@
- Prefer 'syntax.IsKind(kind)' to 'syntax.Kind() == kind' when checking syntax kinds. Code using 'IsKind' is slightly more efficient at runtime, so consistent use of this form where applicable helps improve performance in complex analysis scenarios.
+ Use preferentemente "syntax.IsKind(kind)" antes que "syntax.Kind() == kind" al comprobar las variantes de sintaxis. El código que usa "IsKind" es algo más eficaz en tiempo de ejecución, por lo que el uso coherente de esta forma, cuando proceda, ayuda a mejorar el rendimiento en los escenarios de análisis complejos.
- Use 'IsKind' instead of 'Kind'
+ Usar "IsKind" en lugar de "Kind"
- Prefer 'IsKind' for checking syntax kinds
+ Preferir "IsKind" para comprobar las variantes de sintaxis
- Prefer 'IsKind' for checking syntax kinds
+ Preferir "IsKind" para comprobar las variantes de sintaxis
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.fr.xlf b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.fr.xlf
index 97942b4e38..ab6b2bfd35 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.fr.xlf
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.fr.xlf
@@ -134,7 +134,7 @@
- L'activation du suivi de version pour les packages d'analyseurs permet de suivre et de documenter les diagnostics d'analyseurs qui sont fournis et/ou changés avec chaque version d'analyseur. Consultez les détails sur https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md.
+ L'activation du suivi de version pour les packages d'analyseurs permet de suivre et de documenter les diagnostics d'analyseurs qui sont fournis et/ou changés pour chaque version d'analyseur. Consultez les détails sur https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md.
@@ -259,22 +259,22 @@
- Prefer 'syntax.IsKind(kind)' to 'syntax.Kind() == kind' when checking syntax kinds. Code using 'IsKind' is slightly more efficient at runtime, so consistent use of this form where applicable helps improve performance in complex analysis scenarios.
+ Utilisez 'syntax.IsKind(kind)' au lieu de 'syntax.Kind() == kind' pour la vérification des genres de syntaxe. Dans la mesure où le code utilisant 'IsKind' est légèrement plus efficace au moment de l'exécution, l'utilisation systématique de cette forme permet d'améliorer les performances dans les scénarios d'analyse complexes.
- Use 'IsKind' instead of 'Kind'
+ Utilisez 'IsKind' au lieu de 'Kind'
- Prefer 'IsKind' for checking syntax kinds
+ Préférez 'IsKind' pour la vérification des genres de syntaxe
- Prefer 'IsKind' for checking syntax kinds
+ Préférez 'IsKind' pour la vérification des genres de syntaxe
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.it.xlf b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.it.xlf
index 5623929623..2a1e72bb7a 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.it.xlf
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.it.xlf
@@ -259,22 +259,22 @@
- Prefer 'syntax.IsKind(kind)' to 'syntax.Kind() == kind' when checking syntax kinds. Code using 'IsKind' is slightly more efficient at runtime, so consistent use of this form where applicable helps improve performance in complex analysis scenarios.
+ Preferire 'syntax.IsKind(kind)' a 'syntax.Kind() == kind' durante la verifica dei tipi di sintassi. Il codice che usa 'IsKind' è leggermente più efficiente in fase di runtime, di conseguenza l'uso coerente di questo formato dove possibile contribuisce a migliorare le prestazioni in scenari di analisi complessi.
- Use 'IsKind' instead of 'Kind'
+ Usare 'IsKind' invece di 'Kind'
- Prefer 'IsKind' for checking syntax kinds
+ Preferire 'IsKind' per la verifica dei tipi di sintassi
- Prefer 'IsKind' for checking syntax kinds
+ Preferire 'IsKind' per la verifica dei tipi di sintassi
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.ja.xlf b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.ja.xlf
index ea946e6b1a..c3edebc972 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.ja.xlf
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.ja.xlf
@@ -259,22 +259,22 @@
- Prefer 'syntax.IsKind(kind)' to 'syntax.Kind() == kind' when checking syntax kinds. Code using 'IsKind' is slightly more efficient at runtime, so consistent use of this form where applicable helps improve performance in complex analysis scenarios.
+ 構文の種類をチェックするときに 'syntax.Kind() == kind' よりも 'syntax.IsKind(kind)' を優先します。'IsKind' を使用するコードは実行時に多少効率がよくなるため、この形式 (存在する場合) を常に使用すると、複雑な分析シナリオのパフォーマンスが向上します。
- Use 'IsKind' instead of 'Kind'
+ 'Kind' ではなく 'IsKind' を使用する
- Prefer 'IsKind' for checking syntax kinds
+ 構文の種類のチェックで 'IsKind' を優先します
- Prefer 'IsKind' for checking syntax kinds
+ 構文の種類のチェックで 'IsKind' を優先する
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.ko.xlf b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.ko.xlf
index cf6794be75..735d8f20c2 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.ko.xlf
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.ko.xlf
@@ -259,22 +259,22 @@
- Prefer 'syntax.IsKind(kind)' to 'syntax.Kind() == kind' when checking syntax kinds. Code using 'IsKind' is slightly more efficient at runtime, so consistent use of this form where applicable helps improve performance in complex analysis scenarios.
+ 구문 종류를 확인할 때 'syntax.IsKind(kind)' ~ 'syntax.Kind() == kind'를 선호합니다. 'IsKind'를 사용하는 코드는 런타임 시 약간 더 효율적이므로 해당하는 경우 이 형식을 일관되게 사용하면 복잡한 분석 시나리오에서 성능을 향상하는 데 도움이 됩니다.
- Use 'IsKind' instead of 'Kind'
+ 'Kind' 대신 'IsKind' 사용
- Prefer 'IsKind' for checking syntax kinds
+ 구문 종류 확인에 'IsKind' 선호
- Prefer 'IsKind' for checking syntax kinds
+ 구문 종류 확인에 'IsKind' 선호
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.pl.xlf b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.pl.xlf
index 2f82aede9d..34e8556753 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.pl.xlf
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.pl.xlf
@@ -259,22 +259,22 @@
- Prefer 'syntax.IsKind(kind)' to 'syntax.Kind() == kind' when checking syntax kinds. Code using 'IsKind' is slightly more efficient at runtime, so consistent use of this form where applicable helps improve performance in complex analysis scenarios.
+ Preferuj formę „syntax.IsKind(kind)” zamiast „syntax.Kind() == kind” podczas sprawdzania rodzajów składni. Kod używający elementu „IsKind” jest nieco bardziej wydajny w środowisku uruchomieniowym, więc konsekwentne używanie tej formy w stosownych przypadkach pomaga zwiększyć wydajność w złożonych scenariuszach analizy.
- Use 'IsKind' instead of 'Kind'
+ Użyj elementu „IsKind” zamiast elementu „Kind”
- Prefer 'IsKind' for checking syntax kinds
+ Preferuj metodę „IsKind” do sprawdzania rodzajów składni
- Prefer 'IsKind' for checking syntax kinds
+ Preferuj metodę „IsKind” do sprawdzania rodzajów składni
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.pt-BR.xlf b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.pt-BR.xlf
index e0a7b25cff..218653bcb7 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.pt-BR.xlf
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.pt-BR.xlf
@@ -134,7 +134,7 @@
- Habilitar o acompanhamento de versão de pacotes do analisador ajuda a controlar e documentar o diagnóstico do analisador que é fornecido e/ou alterado com cada versão do analisador. Veja os detalhes em https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md.
+ A habilitação do acompanhamento de versão dos pacotes do analisador ajuda a acompanhar e documentar o diagnóstico do analisador que é fornecido e/ou alterado com cada versão do analisador. Veja os detalhes em https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md.
@@ -259,22 +259,22 @@
- Prefer 'syntax.IsKind(kind)' to 'syntax.Kind() == kind' when checking syntax kinds. Code using 'IsKind' is slightly more efficient at runtime, so consistent use of this form where applicable helps improve performance in complex analysis scenarios.
+ Preferir 'syntax.IsKind(kind)' em vez de 'syntax.Kind() == kind' ao verificar os tipos de sintaxe. O código que usa 'IsKind' é um pouco mais eficiente no runtime, portanto o uso consistente deste formulário, nas circunstâncias em que ele se aplica, ajuda a aprimorar o desempenho em cenários de análise complexos.
- Use 'IsKind' instead of 'Kind'
+ Usar 'IsKind' em vez de 'Kind'
- Prefer 'IsKind' for checking syntax kinds
+ Preferir 'IsKind' para verificar os tipos de sintaxe
- Prefer 'IsKind' for checking syntax kinds
+ Preferir 'IsKind' para verificar os tipos de sintaxe
@@ -557,7 +557,7 @@
- Um CodeFixProvider deve dar suporte a FixAll para permitir que os usuários corrijam várias instâncias do diagnóstico subjacente com uma única correção de código. Confira a documentação em https://github.com/dotnet/roslyn/blob/main/docs/analyzers/FixAllProvider.md para obter mais detalhes.
+ Um CodeFixProvider deve dar suporte a FixAll para permitir que os usuários corrijam várias instâncias do diagnóstico subjacente com apenas uma correção de código. Confira a documentação em https://github.com/dotnet/roslyn/blob/main/docs/analyzers/FixAllProvider.md para obter mais detalhes.
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.ru.xlf b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.ru.xlf
index 90e5d7f082..01846ad182 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.ru.xlf
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.ru.xlf
@@ -259,22 +259,22 @@
- Prefer 'syntax.IsKind(kind)' to 'syntax.Kind() == kind' when checking syntax kinds. Code using 'IsKind' is slightly more efficient at runtime, so consistent use of this form where applicable helps improve performance in complex analysis scenarios.
+ При проверке видов синтаксиса предпочтение отдается "syntax.IsKind(kind)" вместо "syntax.Kind() == kind". Код с использованием "IsKind" имеет чуть большее быстродействие во время выполнения, поэтому регулярное применение этого формата где возможно помогает повысить производительность в сложных сценариях анализа.
- Use 'IsKind' instead of 'Kind'
+ Использование "IsKind" вместо "Kind"
- Prefer 'IsKind' for checking syntax kinds
+ Предпочтение "IsKind" для проверки видов синтаксиса
- Prefer 'IsKind' for checking syntax kinds
+ Предпочтение "IsKind" для проверки видов синтаксиса
@@ -557,7 +557,7 @@
- CodeFixProvider должен предоставлять поддержку FixAll, чтобы пользователи могли исправить несколько экземпляров базовых диагностических данных с помощью одного исправления кода. Дополнительные сведения см. в документации по адресу https://github.com/dotnet/roslyn/blob/main/docs/analyzers/FixAllProvider.md.
+ CodeFixProvider должен предоставлять поддержку FixAll, чтобы пользователи могли исправить несколько экземпляров базовых диагностических данных с помощью одного исправления кода. Дополнительные сведения см. в документации на странице https://github.com/dotnet/roslyn/blob/main/docs/analyzers/FixAllProvider.md.
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.tr.xlf b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.tr.xlf
index a2c10f9cdd..aa5f10680f 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.tr.xlf
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.tr.xlf
@@ -259,22 +259,22 @@
- Prefer 'syntax.IsKind(kind)' to 'syntax.Kind() == kind' when checking syntax kinds. Code using 'IsKind' is slightly more efficient at runtime, so consistent use of this form where applicable helps improve performance in complex analysis scenarios.
+ Söz dizimi çeşitleri denetlenirken 'syntax.IsKind(kind)' türünü 'syntax.Kind() == kind' türüne tercih edin. 'IsKind' kullanan kod, çalışma zamanında biraz daha etkilidir, bu nedenle bu formu kullanmak, karmaşık analiz senaryolarında performansın artırılmasına yardımcı olur.
- Use 'IsKind' instead of 'Kind'
+ 'Kind' yerine 'IsKind' kullanın
- Prefer 'IsKind' for checking syntax kinds
+ Söz dizimi türlerini denetlemek için 'IsKind' öğesini tercih et
- Prefer 'IsKind' for checking syntax kinds
+ Söz dizimi türlerini denetlemek için 'IsKind' öğesini tercih et
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.zh-Hans.xlf b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.zh-Hans.xlf
index 2d4314095f..828e04e0b1 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.zh-Hans.xlf
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.zh-Hans.xlf
@@ -259,22 +259,22 @@
- Prefer 'syntax.IsKind(kind)' to 'syntax.Kind() == kind' when checking syntax kinds. Code using 'IsKind' is slightly more efficient at runtime, so consistent use of this form where applicable helps improve performance in complex analysis scenarios.
+ 检查语法类型时,首选 "syntax.IsKind(kind)" 而不是 "syntax.Kind() == kind"。使用 "IsKind" 的代码在运行时更加高效一些,因此在适用时始终使用此形式有助于提高复杂分析方案中的性能。
- Use 'IsKind' instead of 'Kind'
+ 使用 "IsKind" 而不是 "Kind"
- Prefer 'IsKind' for checking syntax kinds
+ 首选 "IsKind" 来检查语法类型
- Prefer 'IsKind' for checking syntax kinds
+ 首选 "IsKind" 来检查语法类型
diff --git a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.zh-Hant.xlf b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.zh-Hant.xlf
index e8aa0efb6e..e7499be9c0 100644
--- a/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.zh-Hant.xlf
+++ b/src/Microsoft.CodeAnalysis.Analyzers/Core/xlf/CodeAnalysisDiagnosticsResources.zh-Hant.xlf
@@ -259,22 +259,22 @@
- Prefer 'syntax.IsKind(kind)' to 'syntax.Kind() == kind' when checking syntax kinds. Code using 'IsKind' is slightly more efficient at runtime, so consistent use of this form where applicable helps improve performance in complex analysis scenarios.
+ 檢查語法類型時,相較於 'syntax.Kind() == kind',更建議使用 'syntax.IsKind(kind)'。使用 'IsKind' 的程式碼,在執行階段的效率稍高。因此在適用情況下,一致使用此格式有助改進複雜分析案例的效能。
- Use 'IsKind' instead of 'Kind'
+ 使用 'IsKind' 代替 'Kind'
- Prefer 'IsKind' for checking syntax kinds
+ 建議使用 'IsKind' 來檢查語法類型
- Prefer 'IsKind' for checking syntax kinds
+ 建議使用 'IsKind' 來檢查語法類型
@@ -557,7 +557,7 @@
- CodeFixProvider 應提供 FixAll 支援,讓使用者能利用單一程式碼修正來修正基礎診斷的多個執行個體。如需進一步的詳細資料,請參閱位置在 https://github.com/dotnet/roslyn/blob/main/docs/analyzers/FixAllProvider.md 的文件。
+ CodeFixProvider 應提供 FixAll 支援,讓使用者能利用單一程式碼修正來修正基礎診斷的多個執行個體。如需進一步的詳細資料,請參閱下列位置的文件 https://github.com/dotnet/roslyn/blob/main/docs/analyzers/FixAllProvider.md。
diff --git a/src/NetAnalyzers/Core/AbstractGlobalizationDiagnosticAnalyzer.cs b/src/NetAnalyzers/Core/AbstractGlobalizationDiagnosticAnalyzer.cs
new file mode 100644
index 0000000000..6c8e36e3ac
--- /dev/null
+++ b/src/NetAnalyzers/Core/AbstractGlobalizationDiagnosticAnalyzer.cs
@@ -0,0 +1,28 @@
+// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Analyzer.Utilities;
+using Microsoft.CodeAnalysis.Diagnostics;
+
+namespace Microsoft.CodeAnalysis.NetAnalyzers
+{
+ public abstract class AbstractGlobalizationDiagnosticAnalyzer : DiagnosticAnalyzer
+ {
+ protected virtual GeneratedCodeAnalysisFlags GeneratedCodeAnalysisFlags { get; } = GeneratedCodeAnalysisFlags.None;
+
+ public sealed override void Initialize(AnalysisContext context)
+ {
+ context.EnableConcurrentExecution();
+ context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags);
+ context.RegisterCompilationStartAction(context =>
+ {
+ var value = context.Options.GetMSBuildPropertyValue(MSBuildPropertyOptionNames.InvariantGlobalization, context.Compilation, context.CancellationToken);
+ if (value != "true")
+ {
+ InitializeWorker(context);
+ }
+ });
+ }
+
+ protected abstract void InitializeWorker(CompilationStartAnalysisContext context);
+ }
+}
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldHaveCorrectSuffix.cs b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldHaveCorrectSuffix.cs
index a142e99bbc..e8bb838964 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldHaveCorrectSuffix.cs
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldHaveCorrectSuffix.cs
@@ -46,27 +46,27 @@ public sealed class IdentifiersShouldHaveCorrectSuffixAnalyzer : DiagnosticAnaly
// Tuple says s
// The bool values are as mentioned in the Uri
- private static readonly List<(string typeName, string suffix, bool canSuffixBeCollection)> s_baseTypesAndTheirSuffix = new List<(string, string, bool)>()
- {
- ("System.Attribute", "Attribute", false),
- ("System.EventArgs", "EventArgs", false),
- ("System.Exception", "Exception", false),
- ("System.Collections.ICollection", "Collection", false),
- ("System.Collections.IDictionary", "Dictionary", false),
- ("System.Collections.IEnumerable", "Collection", false),
- ("System.Collections.Queue", "Queue", true),
- ("System.Collections.Stack", "Stack", true),
- ("System.Collections.Generic.Queue`1", "Queue", true),
- ("System.Collections.Generic.Stack`1", "Stack", true),
- ("System.Collections.Generic.ICollection`1", "Collection", false),
- ("System.Collections.Generic.IDictionary`2", "Dictionary", false),
- ("System.Collections.Generic.IReadOnlyDictionary`2", "Dictionary", false),
- ("System.Data.DataSet", "DataSet", false),
- ("System.Data.DataTable", "DataTable", true),
- ("System.IO.Stream", "Stream", false),
- ("System.Security.IPermission","Permission", false),
- ("System.Security.Policy.IMembershipCondition", "Condition", false)
- };
+ private static readonly List<(string typeName, string suffix, bool canSuffixBeCollection)> s_baseTypesAndTheirSuffix = new()
+ {
+ ("System.Attribute", "Attribute", false),
+ ("System.EventArgs", "EventArgs", false),
+ ("System.Exception", "Exception", false),
+ ("System.Collections.ICollection", "Collection", false),
+ ("System.Collections.IDictionary", "Dictionary", false),
+ ("System.Collections.IEnumerable", "Collection", false),
+ ("System.Collections.Queue", "Queue", true),
+ ("System.Collections.Stack", "Stack", true),
+ ("System.Collections.Generic.Queue`1", "Queue", true),
+ ("System.Collections.Generic.Stack`1", "Stack", true),
+ ("System.Collections.Generic.ICollection`1", "Collection", false),
+ ("System.Collections.Generic.IDictionary`2", "Dictionary", false),
+ ("System.Collections.Generic.IReadOnlyDictionary`2", "Dictionary", false),
+ ("System.Data.DataSet", "DataSet", false),
+ ("System.Data.DataTable", "DataTable", true),
+ ("System.IO.Stream", "Stream", false),
+ ("System.Security.IPermission", "Permission", false),
+ ("System.Security.Policy.IMembershipCondition", "Condition", false)
+ };
public override void Initialize(AnalysisContext context)
{
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/UriParametersShouldNotBeStrings.Fixer.cs b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/UriParametersShouldNotBeStrings.Fixer.cs
index 9ee1206391..f2e588e561 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/UriParametersShouldNotBeStrings.Fixer.cs
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/UriParametersShouldNotBeStrings.Fixer.cs
@@ -31,7 +31,7 @@ public sealed override FixAllProvider GetFixAllProvider()
public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
{
- var title = MicrosoftCodeQualityAnalyzersResources.UriParametersShouldNotBeStringsTitle;
+ var title = MicrosoftCodeQualityAnalyzersResources.UriParametersShouldNotBeStringsCodeFixTitle;
var document = context.Document;
var cancellationToken = context.CancellationToken;
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/Maintainability/CodeMetricsAnalyzer.cs b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/Maintainability/CodeMetricsAnalyzer.cs
index 0b6028acad..e4572bfee7 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/Maintainability/CodeMetricsAnalyzer.cs
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/Maintainability/CodeMetricsAnalyzer.cs
@@ -285,7 +285,7 @@ static bool isApplicableByDefault(string ruleId, SymbolKind symbolKind)
CA1505RuleId => 10,
- CA1506RuleId => symbolKind == SymbolKind.NamedType ? 95 : 40,
+ CA1506RuleId => symbolKind == SymbolKind.NamedType ? 95 : (uint)40,
_ => throw new NotImplementedException(),
};
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/MicrosoftCodeQualityAnalyzersResources.resx b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/MicrosoftCodeQualityAnalyzersResources.resx
index 4f477a6d1f..8eb36a3f12 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/MicrosoftCodeQualityAnalyzersResources.resx
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/MicrosoftCodeQualityAnalyzersResources.resx
@@ -1256,6 +1256,10 @@
Apply 'AttributeUsageAttribute'
+
+ Add 'System.Uri' overloads
+ {Locked="System.Uri"}
+
Add operator overload named alternate
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.cs.xlf b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.cs.xlf
index 32eaf87870..b256a4dd8f 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.cs.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.cs.xlf
@@ -244,7 +244,7 @@
- Add operator overload named alternate
+ Přidat přetížení operátoru s názvem alternate
@@ -267,6 +267,11 @@
Typ {0} vlastní jednoúčelová pole {1}, ale není jednoúčelový.
+
+
+ Add 'System.Uri' overloads
+ {Locked="System.Uri"}
+ Použijte obecné instance obslužné rutiny události.
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.de.xlf b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.de.xlf
index b47d65a948..971e9f90ad 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.de.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.de.xlf
@@ -244,7 +244,7 @@
- Add operator overload named alternate
+ Operatorüberladung mit alternativem Namen hinzufügen
@@ -267,6 +267,11 @@
Der Typ "{0}" besitzt verwerfbare Felder "{1}", ist jedoch nicht verwerfbar.
+
+
+ Add 'System.Uri' overloads
+ {Locked="System.Uri"}
+ Generische Ereignishandlerinstanzen verwenden
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.es.xlf b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.es.xlf
index 8d165e0d4a..323ddd7445 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.es.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.es.xlf
@@ -244,7 +244,7 @@
- Add operator overload named alternate
+ Agregar alternativa con nombre de la sobrecarga del operador
@@ -267,6 +267,11 @@
El tipo "{0}" tiene campos descartables "{1}" pero no es descartable
+
+
+ Add 'System.Uri' overloads
+ {Locked="System.Uri"}
+ Usar instancias genéricas del controlador de eventos
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.fr.xlf b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.fr.xlf
index dafb863fea..98d15a4879 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.fr.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.fr.xlf
@@ -244,7 +244,7 @@
- Add operator overload named alternate
+ Ajouter une surcharge d'opérateur nommée alternative
@@ -267,6 +267,11 @@
Le type '{0}' a un ou plusieurs champs supprimables '{1}', mais n'est pas supprimable
+
+
+ Add 'System.Uri' overloads
+ {Locked="System.Uri"}
+ Utiliser les instances du gestionnaire d'événements génériques
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.it.xlf b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.it.xlf
index c6790cf66a..164c9478f9 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.it.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.it.xlf
@@ -244,7 +244,7 @@
- Add operator overload named alternate
+ Aggiungi l'overload degli operatori con nome alternativo
@@ -267,6 +267,11 @@
Il tipo '{0}' è proprietario di campi Disposable '{1}' ma non è Disposable
+
+
+ Add 'System.Uri' overloads
+ {Locked="System.Uri"}
+ Usare istanze del gestore dell'evento generico
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.ja.xlf b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.ja.xlf
index 325984793a..e5a0323ad0 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.ja.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.ja.xlf
@@ -244,7 +244,7 @@
- Add operator overload named alternate
+ 代替名の付いた演算子オーバーロードを追加
@@ -267,6 +267,11 @@
型 '{0}' は破棄可能なフィールド '{1}' を所有しますが、破棄可能ではありません
+
+
+ Add 'System.Uri' overloads
+ {Locked="System.Uri"}
+ 汎用イベント ハンドラーのインスタンスを使用します
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.ko.xlf b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.ko.xlf
index b784e497ea..7795b04baf 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.ko.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.ko.xlf
@@ -244,7 +244,7 @@
- Add operator overload named alternate
+ 연산자 오버로드 명명된 대체 항목 추가
@@ -267,6 +267,11 @@
삭제 가능한 필드 '{1}'이(가) 있는 '{0}' 형식을 삭제할 수 없습니다.
+
+
+ Add 'System.Uri' overloads
+ {Locked="System.Uri"}
+ 제네릭 이벤트 처리기 인스턴스를 사용하세요.
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.pl.xlf b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.pl.xlf
index aec70fa83d..f39df69e34 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.pl.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.pl.xlf
@@ -244,7 +244,7 @@
- Add operator overload named alternate
+ Dodawanie nazwanego elementu alternatywnego przeciążenia operatora
@@ -267,6 +267,11 @@
Typ „{0}” zawiera pola możliwe do likwidacji („{1}”), ale sam nie jest możliwy do likwidacji
+
+
+ Add 'System.Uri' overloads
+ {Locked="System.Uri"}
+ Używaj ogólnych wystąpień procedur obsługi zdarzeń
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.pt-BR.xlf b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.pt-BR.xlf
index d95c2e0341..cbb68cbfc1 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.pt-BR.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.pt-BR.xlf
@@ -244,7 +244,7 @@
- Add operator overload named alternate
+ Adicionar uma alternativa nomeada de sobrecarga do operador
@@ -267,6 +267,11 @@
O tipo '{0}' tem campos descartáveis '{1}', mas não é descartável
+
+
+ Add 'System.Uri' overloads
+ {Locked="System.Uri"}
+ Usar instâncias do manipulador de eventos genéricos
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.ru.xlf b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.ru.xlf
index 7117920c87..73e7befba0 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.ru.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.ru.xlf
@@ -244,7 +244,7 @@
- Add operator overload named alternate
+ Добавление перегрузки оператора с другим именем
@@ -267,6 +267,11 @@
Тип "{0}" владеет высвобождаемыми полями "{1}", но не является высвобождаемым
+
+
+ Add 'System.Uri' overloads
+ {Locked="System.Uri"}
+ Используйте экземпляры обработчика универсальных событий
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.tr.xlf b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.tr.xlf
index b15c35018e..559fe03f6a 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.tr.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.tr.xlf
@@ -244,7 +244,7 @@
- Add operator overload named alternate
+ Alternatif adlı işleç aşırı yüklemesi ekleme
@@ -267,6 +267,11 @@
'{0}' türü '{1}' atılabilir alanlarını içeriyor ancak atılabilir değil
+
+
+ Add 'System.Uri' overloads
+ {Locked="System.Uri"}
+ Genel olay işleyicisi örnekleri kullanın
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.zh-Hans.xlf b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.zh-Hans.xlf
index b4fe346a72..296e4adba7 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.zh-Hans.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.zh-Hans.xlf
@@ -244,7 +244,7 @@
- Add operator overload named alternate
+ 添加名为“替代”的运算符重载
@@ -267,6 +267,11 @@
类型“{0}”具有可释放的字段“{1}”,但该类型是不可释放的
+
+
+ Add 'System.Uri' overloads
+ {Locked="System.Uri"}
+ 使用泛型事件处理程序实例
diff --git a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.zh-Hant.xlf b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.zh-Hant.xlf
index c42a37162b..13b284bf19 100644
--- a/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.zh-Hant.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/xlf/MicrosoftCodeQualityAnalyzersResources.zh-Hant.xlf
@@ -244,7 +244,7 @@
- Add operator overload named alternate
+ 新增名稱為 alternate 的運算子多載
@@ -267,6 +267,11 @@
類型 '{0}' 擁有可處置的欄位 '{1}' 但其本身並非可處置項目
+
+
+ Add 'System.Uri' overloads
+ {Locked="System.Uri"}
+ 使用泛型事件處理常式執行個體
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PInvokeDiagnosticAnalyzer.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PInvokeDiagnosticAnalyzer.cs
index 8d363cfd89..b92fba6155 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PInvokeDiagnosticAnalyzer.cs
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PInvokeDiagnosticAnalyzer.cs
@@ -121,7 +121,8 @@ public void AnalyzeSymbol(SymbolAnalysisContext context)
}
// CA2101 - Specify marshalling for PInvoke string arguments
- if (dllImportData.BestFitMapping != false)
+ if (dllImportData.BestFitMapping != false ||
+ context.Options.GetMSBuildPropertyValue(MSBuildPropertyOptionNames.InvariantGlobalization, context.Compilation, context.CancellationToken) is not "true")
{
bool appliedCA2101ToMethod = false;
foreach (IParameterSymbol parameter in methodSymbol.Parameters)
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs
index e322ec1705..4778666c5d 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/InteropServices/PlatformCompatibilityAnalyzer.cs
@@ -297,7 +297,7 @@ private void AnalyzeOperationBlock(
return;
- OperationVisitor CreateOperationVisitor(GlobalFlowStateAnalysisContext context) => new OperationVisitor(guardMethods, osPlatformType, context);
+ OperationVisitor CreateOperationVisitor(GlobalFlowStateAnalysisContext context) => new(guardMethods, osPlatformType, context);
ValueContentAbstractValue GetValueContentValue(IOperation operation)
{
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/DoNotPassLiteralsAsLocalizedParameters.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/DoNotPassLiteralsAsLocalizedParameters.cs
index 4a4102b4eb..316ec52c4f 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/DoNotPassLiteralsAsLocalizedParameters.cs
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/DoNotPassLiteralsAsLocalizedParameters.cs
@@ -8,13 +8,14 @@
using System.Text;
using Analyzer.Utilities;
using Analyzer.Utilities.Extensions;
+using Analyzer.Utilities.PooledObjects;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Operations;
using Microsoft.CodeAnalysis.FlowAnalysis.DataFlow;
using Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.ValueContentAnalysis;
-using Analyzer.Utilities.PooledObjects;
using Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.PointsToAnalysis;
+using Microsoft.CodeAnalysis.NetAnalyzers;
namespace Microsoft.NetCore.Analyzers.Runtime
{
@@ -27,7 +28,7 @@ namespace Microsoft.NetCore.Analyzers.Runtime
/// 3. The name of the string parameter that is passed to a Console.Write or Console.WriteLine method is either "value" or "format".
///
[DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)]
- public sealed class DoNotPassLiteralsAsLocalizedParameters : DiagnosticAnalyzer
+ public sealed class DoNotPassLiteralsAsLocalizedParameters : AbstractGlobalizationDiagnosticAnalyzer
{
internal const string RuleId = "CA1303";
@@ -46,135 +47,129 @@ public sealed class DoNotPassLiteralsAsLocalizedParameters : DiagnosticAnalyzer
public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(Rule);
- public override void Initialize(AnalysisContext context)
+ protected override void InitializeWorker(CompilationStartAnalysisContext context)
{
- context.EnableConcurrentExecution();
- context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
+ INamedTypeSymbol? localizableStateAttributeSymbol = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemComponentModelLocalizableAttribute);
+ INamedTypeSymbol? conditionalAttributeSymbol = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemDiagnosticsConditionalAttribute);
+ INamedTypeSymbol? systemConsoleSymbol = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemConsole);
+ ImmutableHashSet typesToIgnore = GetTypesToIgnore(context.Compilation);
- context.RegisterCompilationStartAction(compilationContext =>
+ context.RegisterOperationBlockStartAction(operationBlockStartContext =>
{
- INamedTypeSymbol? localizableStateAttributeSymbol = compilationContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemComponentModelLocalizableAttribute);
- INamedTypeSymbol? conditionalAttributeSymbol = compilationContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemDiagnosticsConditionalAttribute);
- INamedTypeSymbol? systemConsoleSymbol = compilationContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemConsole);
- ImmutableHashSet typesToIgnore = GetTypesToIgnore(compilationContext.Compilation);
+ if (operationBlockStartContext.OwningSymbol is not IMethodSymbol containingMethod ||
+ operationBlockStartContext.Options.IsConfiguredToSkipAnalysis(Rule, containingMethod, operationBlockStartContext.Compilation, operationBlockStartContext.CancellationToken))
+ {
+ return;
+ }
- compilationContext.RegisterOperationBlockStartAction(operationBlockStartContext =>
+ Lazy?> lazyValueContentResult = new Lazy?>(
+ valueFactory: ComputeValueContentAnalysisResult, isThreadSafe: false);
+
+ operationBlockStartContext.RegisterOperationAction(operationContext =>
{
- if (operationBlockStartContext.OwningSymbol is not IMethodSymbol containingMethod ||
- operationBlockStartContext.Options.IsConfiguredToSkipAnalysis(Rule, containingMethod, operationBlockStartContext.Compilation, operationBlockStartContext.CancellationToken))
+ var argument = (IArgumentOperation)operationContext.Operation;
+ IMethodSymbol? targetMethod = null;
+ switch (argument.Parent)
{
- return;
+ case IInvocationOperation invocation:
+ targetMethod = invocation.TargetMethod;
+ break;
+
+ case IObjectCreationOperation objectCreation:
+ targetMethod = objectCreation.Constructor;
+ break;
}
- Lazy?> lazyValueContentResult = new Lazy?>(
- valueFactory: ComputeValueContentAnalysisResult, isThreadSafe: false);
+ if (ShouldAnalyze(targetMethod))
+ {
+ AnalyzeArgument(argument.Parameter, containingPropertySymbol: null, operation: argument, reportDiagnostic: operationContext.ReportDiagnostic, GetUseNamingHeuristicOption(operationContext));
+ }
+ }, OperationKind.Argument);
- operationBlockStartContext.RegisterOperationAction(operationContext =>
+ operationBlockStartContext.RegisterOperationAction(operationContext =>
+ {
+ var propertyReference = (IPropertyReferenceOperation)operationContext.Operation;
+ if (propertyReference.Parent is IAssignmentOperation assignment &&
+ assignment.Target == propertyReference &&
+ !propertyReference.Property.IsIndexer &&
+ propertyReference.Property.SetMethod?.Parameters.Length == 1 &&
+ ShouldAnalyze(propertyReference.Property))
{
- var argument = (IArgumentOperation)operationContext.Operation;
- IMethodSymbol? targetMethod = null;
- switch (argument.Parent)
- {
- case IInvocationOperation invocation:
- targetMethod = invocation.TargetMethod;
- break;
+ IParameterSymbol valueSetterParam = propertyReference.Property.SetMethod.Parameters[0];
+ AnalyzeArgument(valueSetterParam, propertyReference.Property, assignment, operationContext.ReportDiagnostic, GetUseNamingHeuristicOption(operationContext));
+ }
+ }, OperationKind.PropertyReference);
- case IObjectCreationOperation objectCreation:
- targetMethod = objectCreation.Constructor;
- break;
- }
+ return;
- if (ShouldAnalyze(targetMethod))
- {
- AnalyzeArgument(argument.Parameter, containingPropertySymbol: null, operation: argument, reportDiagnostic: operationContext.ReportDiagnostic, GetUseNamingHeuristicOption(operationContext));
- }
- }, OperationKind.Argument);
+ // Local functions
+ bool ShouldAnalyze(ISymbol? symbol)
+ => symbol != null && !operationBlockStartContext.Options.IsConfiguredToSkipAnalysis(Rule, symbol, operationBlockStartContext.OwningSymbol, operationBlockStartContext.Compilation, operationBlockStartContext.CancellationToken);
+
+ static bool GetUseNamingHeuristicOption(OperationAnalysisContext operationContext)
+ => operationContext.Options.GetBoolOptionValue(EditorConfigOptionNames.UseNamingHeuristic, Rule,
+ operationContext.Operation.Syntax.SyntaxTree, operationContext.Compilation, defaultValue: false, operationContext.CancellationToken);
- operationBlockStartContext.RegisterOperationAction(operationContext =>
+ void AnalyzeArgument(IParameterSymbol parameter, IPropertySymbol? containingPropertySymbol, IOperation operation, Action reportDiagnostic, bool useNamingHeuristic)
+ {
+ if (ShouldBeLocalized(parameter.OriginalDefinition, containingPropertySymbol?.OriginalDefinition, localizableStateAttributeSymbol, conditionalAttributeSymbol, systemConsoleSymbol, typesToIgnore, useNamingHeuristic) &&
+ lazyValueContentResult.Value != null)
{
- var propertyReference = (IPropertyReferenceOperation)operationContext.Operation;
- if (propertyReference.Parent is IAssignmentOperation assignment &&
- assignment.Target == propertyReference &&
- !propertyReference.Property.IsIndexer &&
- propertyReference.Property.SetMethod?.Parameters.Length == 1 &&
- ShouldAnalyze(propertyReference.Property))
+ ValueContentAbstractValue stringContentValue = lazyValueContentResult.Value[operation.Kind, operation.Syntax];
+ if (stringContentValue.IsLiteralState)
{
- IParameterSymbol valueSetterParam = propertyReference.Property.SetMethod.Parameters[0];
- AnalyzeArgument(valueSetterParam, propertyReference.Property, assignment, operationContext.ReportDiagnostic, GetUseNamingHeuristicOption(operationContext));
- }
- }, OperationKind.PropertyReference);
+ Debug.Assert(!stringContentValue.LiteralValues.IsEmpty);
- return;
+ if (stringContentValue.LiteralValues.Any(l => l is not string))
+ {
+ return;
+ }
- // Local functions
- bool ShouldAnalyze(ISymbol? symbol)
- => symbol != null && !operationBlockStartContext.Options.IsConfiguredToSkipAnalysis(Rule, symbol, operationBlockStartContext.OwningSymbol, operationBlockStartContext.Compilation, operationBlockStartContext.CancellationToken);
+ var stringLiteralValues = stringContentValue.LiteralValues.Cast();
- static bool GetUseNamingHeuristicOption(OperationAnalysisContext operationContext)
- => operationContext.Options.GetBoolOptionValue(EditorConfigOptionNames.UseNamingHeuristic, Rule,
- operationContext.Operation.Syntax.SyntaxTree, operationContext.Compilation, defaultValue: false, operationContext.CancellationToken);
+ // FxCop compat: Do not fire if the literal value came from a default parameter value
+ if (stringContentValue.LiteralValues.Count == 1 &&
+ parameter.IsOptional &&
+ parameter.ExplicitDefaultValue is string defaultValue &&
+ defaultValue == stringLiteralValues.Single())
+ {
+ return;
+ }
- void AnalyzeArgument(IParameterSymbol parameter, IPropertySymbol? containingPropertySymbol, IOperation operation, Action reportDiagnostic, bool useNamingHeuristic)
- {
- if (ShouldBeLocalized(parameter.OriginalDefinition, containingPropertySymbol?.OriginalDefinition, localizableStateAttributeSymbol, conditionalAttributeSymbol, systemConsoleSymbol, typesToIgnore, useNamingHeuristic) &&
- lazyValueContentResult.Value != null)
- {
- ValueContentAbstractValue stringContentValue = lazyValueContentResult.Value[operation.Kind, operation.Syntax];
- if (stringContentValue.IsLiteralState)
+ // FxCop compat: Do not fire if none of the string literals have any non-control character.
+ if (!LiteralValuesHaveNonControlCharacters(stringLiteralValues))
{
- Debug.Assert(!stringContentValue.LiteralValues.IsEmpty);
-
- if (stringContentValue.LiteralValues.Any(l => l is not string))
- {
- return;
- }
-
- var stringLiteralValues = stringContentValue.LiteralValues.Cast();
-
- // FxCop compat: Do not fire if the literal value came from a default parameter value
- if (stringContentValue.LiteralValues.Count == 1 &&
- parameter.IsOptional &&
- parameter.ExplicitDefaultValue is string defaultValue &&
- defaultValue == stringLiteralValues.Single())
- {
- return;
- }
-
- // FxCop compat: Do not fire if none of the string literals have any non-control character.
- if (!LiteralValuesHaveNonControlCharacters(stringLiteralValues))
- {
- return;
- }
-
- // FxCop compat: Filter out xml string literals.
- IEnumerable filteredStrings = stringLiteralValues.Where(literal => literal != null && !LooksLikeXmlTag(literal))!;
- if (filteredStrings.Any())
- {
- // Method '{0}' passes a literal string as parameter '{1}' of a call to '{2}'. Retrieve the following string(s) from a resource table instead: "{3}".
- var arg1 = containingMethod.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat);
- var arg2 = parameter.Name;
- var arg3 = parameter.ContainingSymbol.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat);
- var arg4 = FormatLiteralValues(filteredStrings);
- var diagnostic = operation.CreateDiagnostic(Rule, arg1, arg2, arg3, arg4);
- reportDiagnostic(diagnostic);
- }
+ return;
+ }
+
+ // FxCop compat: Filter out xml string literals.
+ IEnumerable filteredStrings = stringLiteralValues.Where(literal => literal != null && !LooksLikeXmlTag(literal))!;
+ if (filteredStrings.Any())
+ {
+ // Method '{0}' passes a literal string as parameter '{1}' of a call to '{2}'. Retrieve the following string(s) from a resource table instead: "{3}".
+ var arg1 = containingMethod.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat);
+ var arg2 = parameter.Name;
+ var arg3 = parameter.ContainingSymbol.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat);
+ var arg4 = FormatLiteralValues(filteredStrings);
+ var diagnostic = operation.CreateDiagnostic(Rule, arg1, arg2, arg3, arg4);
+ reportDiagnostic(diagnostic);
}
}
}
+ }
- DataFlowAnalysisResult? ComputeValueContentAnalysisResult()
+ DataFlowAnalysisResult? ComputeValueContentAnalysisResult()
+ {
+ var cfg = operationBlockStartContext.OperationBlocks.GetControlFlowGraph();
+ if (cfg != null)
{
- var cfg = operationBlockStartContext.OperationBlocks.GetControlFlowGraph();
- if (cfg != null)
- {
- var wellKnownTypeProvider = WellKnownTypeProvider.GetOrCreate(operationBlockStartContext.Compilation);
- return ValueContentAnalysis.TryGetOrComputeResult(cfg, containingMethod, wellKnownTypeProvider,
- operationBlockStartContext.Options, Rule, PointsToAnalysisKind.PartialWithoutTrackingFieldsAndProperties, operationBlockStartContext.CancellationToken);
- }
-
- return null;
+ var wellKnownTypeProvider = WellKnownTypeProvider.GetOrCreate(operationBlockStartContext.Compilation);
+ return ValueContentAnalysis.TryGetOrComputeResult(cfg, containingMethod, wellKnownTypeProvider,
+ operationBlockStartContext.Options, Rule, PointsToAnalysisKind.PartialWithoutTrackingFieldsAndProperties, operationBlockStartContext.CancellationToken);
}
- });
+
+ return null;
+ }
});
}
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/NormalizeStringsToUppercase.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/NormalizeStringsToUppercase.cs
index 31711ee99e..72dfae538a 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/NormalizeStringsToUppercase.cs
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/NormalizeStringsToUppercase.cs
@@ -6,6 +6,7 @@
using Analyzer.Utilities.Extensions;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
+using Microsoft.CodeAnalysis.NetAnalyzers;
using Microsoft.CodeAnalysis.Operations;
namespace Microsoft.NetCore.Analyzers.Runtime
@@ -19,7 +20,7 @@ namespace Microsoft.NetCore.Analyzers.Runtime
///
///
[DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)]
- public sealed class NormalizeStringsToUppercaseAnalyzer : DiagnosticAnalyzer
+ public sealed class NormalizeStringsToUppercaseAnalyzer : AbstractGlobalizationDiagnosticAnalyzer
{
internal const string RuleId = "CA1308";
@@ -39,64 +40,58 @@ public sealed class NormalizeStringsToUppercaseAnalyzer : DiagnosticAnalyzer
public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(ToUpperRule);
- public override void Initialize(AnalysisContext context)
+ protected override void InitializeWorker(CompilationStartAnalysisContext context)
{
- context.EnableConcurrentExecution();
- context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
-
- context.RegisterCompilationStartAction(compilationStartContext =>
+ var stringType = context.Compilation.GetSpecialType(SpecialType.System_String);
+ if (stringType == null)
{
- var stringType = compilationStartContext.Compilation.GetSpecialType(SpecialType.System_String);
- if (stringType == null)
- {
- return;
- }
+ return;
+ }
- var cultureInfo = compilationStartContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemGlobalizationCultureInfo);
- var invariantCulture = cultureInfo?.GetMembers("InvariantCulture").OfType().FirstOrDefault();
+ var cultureInfo = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemGlobalizationCultureInfo);
+ var invariantCulture = cultureInfo?.GetMembers("InvariantCulture").OfType().FirstOrDefault();
- // We want to flag calls to "ToLowerInvariant" and "ToLower(CultureInfo.InvariantCulture)".
- var toLowerInvariant = stringType.GetMembers("ToLowerInvariant").OfType().FirstOrDefault();
- var toLowerWithCultureInfo = cultureInfo != null ?
- stringType.GetMembers("ToLower").OfType().FirstOrDefault(m => m.Parameters.Length == 1 && Equals(m.Parameters[0].Type, cultureInfo)) :
- null;
+ // We want to flag calls to "ToLowerInvariant" and "ToLower(CultureInfo.InvariantCulture)".
+ var toLowerInvariant = stringType.GetMembers("ToLowerInvariant").OfType().FirstOrDefault();
+ var toLowerWithCultureInfo = cultureInfo != null ?
+ stringType.GetMembers("ToLower").OfType().FirstOrDefault(m => m.Parameters.Length == 1 && Equals(m.Parameters[0].Type, cultureInfo)) :
+ null;
- if (toLowerInvariant == null && toLowerWithCultureInfo == null)
- {
- return;
- }
+ if (toLowerInvariant == null && toLowerWithCultureInfo == null)
+ {
+ return;
+ }
+
+ // We want to recommend calling "ToUpperInvariant" or "ToUpper(CultureInfo.InvariantCulture)".
+ var toUpperInvariant = stringType.GetMembers("ToUpperInvariant").OfType().FirstOrDefault();
+ var toUpperWithCultureInfo = cultureInfo != null ?
+ stringType.GetMembers("ToUpper").OfType().FirstOrDefault(m => m.Parameters.Length == 1 && Equals(m.Parameters[0].Type, cultureInfo)) :
+ null;
- // We want to recommend calling "ToUpperInvariant" or "ToUpper(CultureInfo.InvariantCulture)".
- var toUpperInvariant = stringType.GetMembers("ToUpperInvariant").OfType().FirstOrDefault();
- var toUpperWithCultureInfo = cultureInfo != null ?
- stringType.GetMembers("ToUpper").OfType().FirstOrDefault(m => m.Parameters.Length == 1 && Equals(m.Parameters[0].Type, cultureInfo)) :
- null;
+ if (toUpperInvariant == null && toUpperWithCultureInfo == null)
+ {
+ return;
+ }
- if (toUpperInvariant == null && toUpperWithCultureInfo == null)
+ context.RegisterOperationAction(operationAnalysisContext =>
+ {
+ var invocation = (IInvocationOperation)operationAnalysisContext.Operation;
+ if (invocation.TargetMethod == null)
{
return;
}
-
- compilationStartContext.RegisterOperationAction(operationAnalysisContext =>
+ var method = invocation.TargetMethod;
+ if (method.Equals(toLowerInvariant) ||
+ (method.Equals(toLowerWithCultureInfo) &&
+ ((invocation.Arguments.FirstOrDefault()?.Value as IMemberReferenceOperation)?.Member.Equals(invariantCulture) ?? false)))
{
- var invocation = (IInvocationOperation)operationAnalysisContext.Operation;
- if (invocation.TargetMethod == null)
- {
- return;
- }
- var method = invocation.TargetMethod;
- if (method.Equals(toLowerInvariant) ||
- (method.Equals(toLowerWithCultureInfo) &&
- ((invocation.Arguments.FirstOrDefault()?.Value as IMemberReferenceOperation)?.Member.Equals(invariantCulture) ?? false)))
- {
- IMethodSymbol suggestedMethod = toUpperInvariant ?? toUpperWithCultureInfo!;
+ IMethodSymbol suggestedMethod = toUpperInvariant ?? toUpperWithCultureInfo!;
- // In method {0}, replace the call to {1} with {2}.
- var diagnostic = invocation.CreateDiagnostic(ToUpperRule, operationAnalysisContext.ContainingSymbol.Name, method.Name, suggestedMethod.Name);
- operationAnalysisContext.ReportDiagnostic(diagnostic);
- }
- }, OperationKind.Invocation);
- });
+ // In method {0}, replace the call to {1} with {2}.
+ var diagnostic = invocation.CreateDiagnostic(ToUpperRule, operationAnalysisContext.ContainingSymbol.Name, method.Name, suggestedMethod.Name);
+ operationAnalysisContext.ReportDiagnostic(diagnostic);
+ }
+ }, OperationKind.Invocation);
}
}
}
\ No newline at end of file
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/SpecifyCultureInfo.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/SpecifyCultureInfo.cs
index 4c69e2a34a..2bbbb7158b 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/SpecifyCultureInfo.cs
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/SpecifyCultureInfo.cs
@@ -7,6 +7,7 @@
using Analyzer.Utilities.Extensions;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
+using Microsoft.CodeAnalysis.NetAnalyzers;
using Microsoft.CodeAnalysis.Operations;
namespace Microsoft.NetCore.Analyzers.Runtime
@@ -15,7 +16,7 @@ namespace Microsoft.NetCore.Analyzers.Runtime
/// CA1304: Specify CultureInfo
///
[DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)]
- public sealed class SpecifyCultureInfoAnalyzer : DiagnosticAnalyzer
+ public sealed class SpecifyCultureInfoAnalyzer : AbstractGlobalizationDiagnosticAnalyzer
{
internal const string RuleId = "CA1304";
@@ -34,56 +35,50 @@ public sealed class SpecifyCultureInfoAnalyzer : DiagnosticAnalyzer
public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(Rule);
- public override void Initialize(AnalysisContext context)
+ protected override void InitializeWorker(CompilationStartAnalysisContext context)
{
- context.EnableConcurrentExecution();
- context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
+ var obsoleteAttributeType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemObsoleteAttribute);
- context.RegisterCompilationStartAction(csaContext =>
+ var cultureInfoType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemGlobalizationCultureInfo);
+ if (cultureInfoType != null)
{
- var obsoleteAttributeType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemObsoleteAttribute);
-
- var cultureInfoType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemGlobalizationCultureInfo);
- if (cultureInfoType != null)
+ context.RegisterOperationAction(oaContext =>
{
- csaContext.RegisterOperationAction(oaContext =>
+ var invocationExpression = (IInvocationOperation)oaContext.Operation;
+ var targetMethod = invocationExpression.TargetMethod;
+ if (targetMethod.ContainingType == null || targetMethod.ContainingType.IsErrorType() || targetMethod.IsGenericMethod)
{
- var invocationExpression = (IInvocationOperation)oaContext.Operation;
- var targetMethod = invocationExpression.TargetMethod;
- if (targetMethod.ContainingType == null || targetMethod.ContainingType.IsErrorType() || targetMethod.IsGenericMethod)
- {
- return;
- }
+ return;
+ }
- if (oaContext.Options.IsConfiguredToSkipAnalysis(Rule, targetMethod, oaContext.ContainingSymbol, oaContext.Compilation, oaContext.CancellationToken))
- {
- return;
- }
+ if (oaContext.Options.IsConfiguredToSkipAnalysis(Rule, targetMethod, oaContext.ContainingSymbol, oaContext.Compilation, oaContext.CancellationToken))
+ {
+ return;
+ }
- IEnumerable methodsWithSameNameAsTargetMethod = targetMethod.ContainingType.GetMembers(targetMethod.Name).OfType().WhereMethodDoesNotContainAttribute(obsoleteAttributeType).ToList();
- if (methodsWithSameNameAsTargetMethod.HasFewerThan(2))
- {
- return;
- }
+ IEnumerable methodsWithSameNameAsTargetMethod = targetMethod.ContainingType.GetMembers(targetMethod.Name).OfType().WhereMethodDoesNotContainAttribute(obsoleteAttributeType).ToList();
+ if (methodsWithSameNameAsTargetMethod.HasFewerThan(2))
+ {
+ return;
+ }
- var correctOverloads = methodsWithSameNameAsTargetMethod.GetMethodOverloadsWithDesiredParameterAtLeadingOrTrailing(targetMethod, cultureInfoType).ToList();
+ var correctOverloads = methodsWithSameNameAsTargetMethod.GetMethodOverloadsWithDesiredParameterAtLeadingOrTrailing(targetMethod, cultureInfoType).ToList();
- // If there are two matching overloads, one with CultureInfo as the first parameter and one with CultureInfo as the last parameter,
- // report the diagnostic on the overload with CultureInfo as the last parameter, to match the behavior of FxCop.
- var correctOverload = correctOverloads.FirstOrDefault(overload => overload.Parameters.Last().Type.Equals(cultureInfoType)) ?? correctOverloads.FirstOrDefault();
+ // If there are two matching overloads, one with CultureInfo as the first parameter and one with CultureInfo as the last parameter,
+ // report the diagnostic on the overload with CultureInfo as the last parameter, to match the behavior of FxCop.
+ var correctOverload = correctOverloads.FirstOrDefault(overload => overload.Parameters.Last().Type.Equals(cultureInfoType)) ?? correctOverloads.FirstOrDefault();
- if (correctOverload != null)
- {
- oaContext.ReportDiagnostic(
- invocationExpression.Syntax.CreateDiagnostic(
- Rule,
- targetMethod.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat),
- oaContext.ContainingSymbol.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat),
- correctOverload.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat)));
- }
- }, OperationKind.Invocation);
- }
- });
+ if (correctOverload != null)
+ {
+ oaContext.ReportDiagnostic(
+ invocationExpression.Syntax.CreateDiagnostic(
+ Rule,
+ targetMethod.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat),
+ oaContext.ContainingSymbol.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat),
+ correctOverload.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat)));
+ }
+ }, OperationKind.Invocation);
+ }
}
}
}
\ No newline at end of file
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/SpecifyIFormatProvider.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/SpecifyIFormatProvider.cs
index c8a19d269c..da5d624249 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/SpecifyIFormatProvider.cs
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/SpecifyIFormatProvider.cs
@@ -7,6 +7,7 @@
using Analyzer.Utilities.Extensions;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
+using Microsoft.CodeAnalysis.NetAnalyzers;
using Microsoft.CodeAnalysis.Operations;
namespace Microsoft.NetCore.Analyzers.Runtime
@@ -15,7 +16,7 @@ namespace Microsoft.NetCore.Analyzers.Runtime
/// CA1305: Specify IFormatProvider
///
[DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)]
- public sealed class SpecifyIFormatProviderAnalyzer : DiagnosticAnalyzer
+ public sealed class SpecifyIFormatProviderAnalyzer : AbstractGlobalizationDiagnosticAnalyzer
{
internal const string RuleId = "CA1305";
@@ -64,186 +65,180 @@ public sealed class SpecifyIFormatProviderAnalyzer : DiagnosticAnalyzer
public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(IFormatProviderAlternateStringRule, IFormatProviderAlternateRule, UICultureStringRule, UICultureRule);
- public override void Initialize(AnalysisContext context)
+ protected override void InitializeWorker(CompilationStartAnalysisContext context)
{
- context.EnableConcurrentExecution();
- context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
- context.RegisterCompilationStartAction(csaContext =>
+ #region "Get All the WellKnown Types and Members"
+ var iformatProviderType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemIFormatProvider);
+ var cultureInfoType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemGlobalizationCultureInfo);
+ if (iformatProviderType == null || cultureInfoType == null)
{
- #region "Get All the WellKnown Types and Members"
- var iformatProviderType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemIFormatProvider);
- var cultureInfoType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemGlobalizationCultureInfo);
- if (iformatProviderType == null || cultureInfoType == null)
+ return;
+ }
+
+ var objectType = context.Compilation.GetSpecialType(SpecialType.System_Object);
+ var stringType = context.Compilation.GetSpecialType(SpecialType.System_String);
+ if (objectType == null || stringType == null)
+ {
+ return;
+ }
+
+ var charType = context.Compilation.GetSpecialType(SpecialType.System_Char);
+ var boolType = context.Compilation.GetSpecialType(SpecialType.System_Boolean);
+ var guidType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemGuid);
+
+ var builder = ImmutableHashSet.CreateBuilder();
+ builder.AddIfNotNull(charType);
+ builder.AddIfNotNull(boolType);
+ builder.AddIfNotNull(stringType);
+ builder.AddIfNotNull(guidType);
+ var invariantToStringTypes = builder.ToImmutableHashSet();
+
+ var dateTimeType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemDateTime);
+ var dateTimeOffsetType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemDateTimeOffset);
+ var timeSpanType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemTimeSpan);
+
+ var stringFormatMembers = stringType.GetMembers("Format").OfType();
+
+ var stringFormatMemberWithStringAndObjectParameter = stringFormatMembers.GetFirstOrDefaultMemberWithParameterInfos(
+ GetParameterInfo(stringType),
+ GetParameterInfo(objectType));
+ var stringFormatMemberWithStringObjectAndObjectParameter = stringFormatMembers.GetFirstOrDefaultMemberWithParameterInfos(
+ GetParameterInfo(stringType),
+ GetParameterInfo(objectType),
+ GetParameterInfo(objectType));
+ var stringFormatMemberWithStringObjectObjectAndObjectParameter = stringFormatMembers.GetFirstOrDefaultMemberWithParameterInfos(
+ GetParameterInfo(stringType),
+ GetParameterInfo(objectType),
+ GetParameterInfo(objectType),
+ GetParameterInfo(objectType));
+ var stringFormatMemberWithStringAndParamsObjectParameter = stringFormatMembers.GetFirstOrDefaultMemberWithParameterInfos(
+ GetParameterInfo(stringType),
+ GetParameterInfo(objectType, isArray: true, arrayRank: 1, isParams: true));
+ var stringFormatMemberWithIFormatProviderStringAndParamsObjectParameter = stringFormatMembers.GetFirstOrDefaultMemberWithParameterInfos(
+ GetParameterInfo(iformatProviderType),
+ GetParameterInfo(stringType),
+ GetParameterInfo(objectType, isArray: true, arrayRank: 1, isParams: true));
+
+ var currentCultureProperty = cultureInfoType.GetMembers("CurrentCulture").OfType().FirstOrDefault();
+ var invariantCultureProperty = cultureInfoType.GetMembers("InvariantCulture").OfType().FirstOrDefault();
+ var currentUICultureProperty = cultureInfoType.GetMembers("CurrentUICulture").OfType().FirstOrDefault();
+ var installedUICultureProperty = cultureInfoType.GetMembers("InstalledUICulture").OfType().FirstOrDefault();
+
+ var threadType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemThreadingThread);
+ var currentThreadCurrentUICultureProperty = threadType?.GetMembers("CurrentUICulture").OfType().FirstOrDefault();
+
+ var activatorType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemActivator);
+ var resourceManagerType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemResourcesResourceManager);
+
+ var computerInfoType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.MicrosoftVisualBasicDevicesComputerInfo);
+ var installedUICulturePropertyOfComputerInfoType = computerInfoType?.GetMembers("InstalledUICulture").OfType().FirstOrDefault();
+
+ var obsoleteAttributeType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemObsoleteAttribute);
+ #endregion
+
+ context.RegisterOperationAction(oaContext =>
+ {
+ var invocationExpression = (IInvocationOperation)oaContext.Operation;
+ var targetMethod = invocationExpression.TargetMethod;
+
+ #region "Exceptions"
+ if (targetMethod.IsGenericMethod ||
+ targetMethod.ContainingType.IsErrorType() ||
+ (activatorType != null && activatorType.Equals(targetMethod.ContainingType)) ||
+ (resourceManagerType != null && resourceManagerType.Equals(targetMethod.ContainingType)) ||
+ IsValidToStringCall(invocationExpression, invariantToStringTypes, dateTimeType, dateTimeOffsetType, timeSpanType))
{
return;
}
+ #endregion
- var objectType = csaContext.Compilation.GetSpecialType(SpecialType.System_Object);
- var stringType = csaContext.Compilation.GetSpecialType(SpecialType.System_String);
- if (objectType == null || stringType == null)
+ #region "IFormatProviderAlternateStringRule Only"
+ if (stringFormatMemberWithIFormatProviderStringAndParamsObjectParameter != null &&
+ (targetMethod.Equals(stringFormatMemberWithStringAndObjectParameter) ||
+ targetMethod.Equals(stringFormatMemberWithStringObjectAndObjectParameter) ||
+ targetMethod.Equals(stringFormatMemberWithStringObjectObjectAndObjectParameter) ||
+ targetMethod.Equals(stringFormatMemberWithStringAndParamsObjectParameter)))
{
+ // Sample message for IFormatProviderAlternateStringRule: Because the behavior of string.Format(string, object) could vary based on the current user's locale settings,
+ // replace this call in IFormatProviderStringTest.M() with a call to string.Format(IFormatProvider, string, params object[]).
+ oaContext.ReportDiagnostic(
+ invocationExpression.Syntax.CreateDiagnostic(
+ IFormatProviderAlternateStringRule,
+ targetMethod.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat),
+ oaContext.ContainingSymbol.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat),
+ stringFormatMemberWithIFormatProviderStringAndParamsObjectParameter.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat)));
+
return;
}
-
- var charType = csaContext.Compilation.GetSpecialType(SpecialType.System_Char);
- var boolType = csaContext.Compilation.GetSpecialType(SpecialType.System_Boolean);
- var guidType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemGuid);
-
- var builder = ImmutableHashSet.CreateBuilder();
- builder.AddIfNotNull(charType);
- builder.AddIfNotNull(boolType);
- builder.AddIfNotNull(stringType);
- builder.AddIfNotNull(guidType);
- var invariantToStringTypes = builder.ToImmutableHashSet();
-
- var dateTimeType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemDateTime);
- var dateTimeOffsetType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemDateTimeOffset);
- var timeSpanType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemTimeSpan);
-
- var stringFormatMembers = stringType.GetMembers("Format").OfType();
-
- var stringFormatMemberWithStringAndObjectParameter = stringFormatMembers.GetFirstOrDefaultMemberWithParameterInfos(
- GetParameterInfo(stringType),
- GetParameterInfo(objectType));
- var stringFormatMemberWithStringObjectAndObjectParameter = stringFormatMembers.GetFirstOrDefaultMemberWithParameterInfos(
- GetParameterInfo(stringType),
- GetParameterInfo(objectType),
- GetParameterInfo(objectType));
- var stringFormatMemberWithStringObjectObjectAndObjectParameter = stringFormatMembers.GetFirstOrDefaultMemberWithParameterInfos(
- GetParameterInfo(stringType),
- GetParameterInfo(objectType),
- GetParameterInfo(objectType),
- GetParameterInfo(objectType));
- var stringFormatMemberWithStringAndParamsObjectParameter = stringFormatMembers.GetFirstOrDefaultMemberWithParameterInfos(
- GetParameterInfo(stringType),
- GetParameterInfo(objectType, isArray: true, arrayRank: 1, isParams: true));
- var stringFormatMemberWithIFormatProviderStringAndParamsObjectParameter = stringFormatMembers.GetFirstOrDefaultMemberWithParameterInfos(
- GetParameterInfo(iformatProviderType),
- GetParameterInfo(stringType),
- GetParameterInfo(objectType, isArray: true, arrayRank: 1, isParams: true));
-
- var currentCultureProperty = cultureInfoType?.GetMembers("CurrentCulture").OfType().FirstOrDefault();
- var invariantCultureProperty = cultureInfoType?.GetMembers("InvariantCulture").OfType().FirstOrDefault();
- var currentUICultureProperty = cultureInfoType?.GetMembers("CurrentUICulture").OfType().FirstOrDefault();
- var installedUICultureProperty = cultureInfoType?.GetMembers("InstalledUICulture").OfType().FirstOrDefault();
-
- var threadType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemThreadingThread);
- var currentThreadCurrentUICultureProperty = threadType?.GetMembers("CurrentUICulture").OfType().FirstOrDefault();
-
- var activatorType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemActivator);
- var resourceManagerType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemResourcesResourceManager);
-
- var computerInfoType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.MicrosoftVisualBasicDevicesComputerInfo);
- var installedUICulturePropertyOfComputerInfoType = computerInfoType?.GetMembers("InstalledUICulture").OfType().FirstOrDefault();
-
- var obsoleteAttributeType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemObsoleteAttribute);
#endregion
- csaContext.RegisterOperationAction(oaContext =>
+ #region "IFormatProviderAlternateStringRule & IFormatProviderAlternateRule"
+
+ IEnumerable methodsWithSameNameAsTargetMethod = targetMethod.ContainingType.GetMembers(targetMethod.Name).OfType().WhereMethodDoesNotContainAttribute(obsoleteAttributeType).ToList();
+ if (methodsWithSameNameAsTargetMethod.HasMoreThan(1))
{
- var invocationExpression = (IInvocationOperation)oaContext.Operation;
- var targetMethod = invocationExpression.TargetMethod;
-
- #region "Exceptions"
- if (targetMethod.IsGenericMethod ||
- targetMethod.ContainingType.IsErrorType() ||
- (activatorType != null && activatorType.Equals(targetMethod.ContainingType)) ||
- (resourceManagerType != null && resourceManagerType.Equals(targetMethod.ContainingType)) ||
- IsValidToStringCall(invocationExpression, invariantToStringTypes, dateTimeType, dateTimeOffsetType, timeSpanType))
- {
- return;
- }
- #endregion
-
- #region "IFormatProviderAlternateStringRule Only"
- if (stringType != null && cultureInfoType != null &&
- stringFormatMemberWithIFormatProviderStringAndParamsObjectParameter != null &&
- (targetMethod.Equals(stringFormatMemberWithStringAndObjectParameter) ||
- targetMethod.Equals(stringFormatMemberWithStringObjectAndObjectParameter) ||
- targetMethod.Equals(stringFormatMemberWithStringObjectObjectAndObjectParameter) ||
- targetMethod.Equals(stringFormatMemberWithStringAndParamsObjectParameter)))
+ var correctOverloads = methodsWithSameNameAsTargetMethod.GetMethodOverloadsWithDesiredParameterAtLeadingOrTrailing(targetMethod, iformatProviderType).ToList();
+
+ // If there are two matching overloads, one with CultureInfo as the first parameter and one with CultureInfo as the last parameter,
+ // report the diagnostic on the overload with CultureInfo as the last parameter, to match the behavior of FxCop.
+ var correctOverload = correctOverloads.FirstOrDefault(overload => overload.Parameters.Last().Type.Equals(iformatProviderType)) ?? correctOverloads.FirstOrDefault();
+
+ // Sample message for IFormatProviderAlternateRule: Because the behavior of Convert.ToInt64(string) could vary based on the current user's locale settings,
+ // replace this call in IFormatProviderStringTest.TestMethod() with a call to Convert.ToInt64(string, IFormatProvider).
+ if (correctOverload != null)
{
- // Sample message for IFormatProviderAlternateStringRule: Because the behavior of string.Format(string, object) could vary based on the current user's locale settings,
- // replace this call in IFormatProviderStringTest.M() with a call to string.Format(IFormatProvider, string, params object[]).
oaContext.ReportDiagnostic(
invocationExpression.Syntax.CreateDiagnostic(
- IFormatProviderAlternateStringRule,
+ targetMethod.ReturnType.Equals(stringType) ?
+ IFormatProviderAlternateStringRule :
+ IFormatProviderAlternateRule,
targetMethod.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat),
oaContext.ContainingSymbol.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat),
- stringFormatMemberWithIFormatProviderStringAndParamsObjectParameter.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat)));
-
- return;
+ correctOverload.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat)));
}
- #endregion
+ }
+ #endregion
- #region "IFormatProviderAlternateStringRule & IFormatProviderAlternateRule"
+ #region "UICultureStringRule & UICultureRule"
+ IEnumerable IformatProviderParameterIndices = GetIndexesOfParameterType(targetMethod, iformatProviderType);
+ foreach (var index in IformatProviderParameterIndices)
+ {
+ var argument = invocationExpression.Arguments[index];
- IEnumerable methodsWithSameNameAsTargetMethod = targetMethod.ContainingType.GetMembers(targetMethod.Name).OfType().WhereMethodDoesNotContainAttribute(obsoleteAttributeType).ToList();
- if (methodsWithSameNameAsTargetMethod.HasMoreThan(1))
+ if (argument != null && currentUICultureProperty != null &&
+ installedUICultureProperty != null && currentThreadCurrentUICultureProperty != null)
{
- var correctOverloads = methodsWithSameNameAsTargetMethod.GetMethodOverloadsWithDesiredParameterAtLeadingOrTrailing(targetMethod, iformatProviderType).ToList();
+ var semanticModel = argument.SemanticModel;
- // If there are two matching overloads, one with CultureInfo as the first parameter and one with CultureInfo as the last parameter,
- // report the diagnostic on the overload with CultureInfo as the last parameter, to match the behavior of FxCop.
- var correctOverload = correctOverloads.FirstOrDefault(overload => overload.Parameters.Last().Type.Equals(iformatProviderType)) ?? correctOverloads.FirstOrDefault();
+ var symbol = semanticModel.GetSymbolInfo(argument.Value.Syntax, oaContext.CancellationToken).Symbol;
- // Sample message for IFormatProviderAlternateRule: Because the behavior of Convert.ToInt64(string) could vary based on the current user's locale settings,
- // replace this call in IFormatProviderStringTest.TestMethod() with a call to Convert.ToInt64(string, IFormatProvider).
- if (correctOverload != null)
+ if (symbol != null &&
+ (symbol.Equals(currentUICultureProperty) ||
+ symbol.Equals(installedUICultureProperty) ||
+ symbol.Equals(currentThreadCurrentUICultureProperty) ||
+ (installedUICulturePropertyOfComputerInfoType != null && symbol.Equals(installedUICulturePropertyOfComputerInfoType))))
{
- oaContext.ReportDiagnostic(
- invocationExpression.Syntax.CreateDiagnostic(
- targetMethod.ReturnType.Equals(stringType) ?
- IFormatProviderAlternateStringRule :
- IFormatProviderAlternateRule,
- targetMethod.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat),
- oaContext.ContainingSymbol.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat),
- correctOverload.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat)));
- }
- }
- #endregion
-
- #region "UICultureStringRule & UICultureRule"
- IEnumerable IformatProviderParameterIndices = GetIndexesOfParameterType(targetMethod, iformatProviderType);
- foreach (var index in IformatProviderParameterIndices)
- {
- var argument = invocationExpression.Arguments[index];
+ // Sample message
+ // 1. UICultureStringRule - 'TestClass.TestMethod()' passes 'Thread.CurrentUICulture' as the 'IFormatProvider' parameter to 'TestClass.CalleeMethod(string, IFormatProvider)'.
+ // This property returns a culture that is inappropriate for formatting methods.
+ // 2. UICultureRule -'TestClass.TestMethod()' passes 'CultureInfo.CurrentUICulture' as the 'IFormatProvider' parameter to 'TestClass.Callee(IFormatProvider, string)'.
+ // This property returns a culture that is inappropriate for formatting methods.
- if (argument != null && currentUICultureProperty != null &&
- installedUICultureProperty != null && currentThreadCurrentUICultureProperty != null)
- {
- var semanticModel = argument.SemanticModel;
-
- var symbol = semanticModel.GetSymbolInfo(argument.Value.Syntax, oaContext.CancellationToken).Symbol;
-
- if (symbol != null &&
- (symbol.Equals(currentUICultureProperty) ||
- symbol.Equals(installedUICultureProperty) ||
- symbol.Equals(currentThreadCurrentUICultureProperty) ||
- (installedUICulturePropertyOfComputerInfoType != null && symbol.Equals(installedUICulturePropertyOfComputerInfoType))))
- {
- // Sample message
- // 1. UICultureStringRule - 'TestClass.TestMethod()' passes 'Thread.CurrentUICulture' as the 'IFormatProvider' parameter to 'TestClass.CalleeMethod(string, IFormatProvider)'.
- // This property returns a culture that is inappropriate for formatting methods.
- // 2. UICultureRule -'TestClass.TestMethod()' passes 'CultureInfo.CurrentUICulture' as the 'IFormatProvider' parameter to 'TestClass.Callee(IFormatProvider, string)'.
- // This property returns a culture that is inappropriate for formatting methods.
-
- oaContext.ReportDiagnostic(
- invocationExpression.Syntax.CreateDiagnostic(
- targetMethod.ReturnType.Equals(stringType) ?
- UICultureStringRule :
- UICultureRule,
- oaContext.ContainingSymbol.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat),
- symbol.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat),
- targetMethod.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat)));
- }
+ oaContext.ReportDiagnostic(
+ invocationExpression.Syntax.CreateDiagnostic(
+ targetMethod.ReturnType.Equals(stringType) ?
+ UICultureStringRule :
+ UICultureRule,
+ oaContext.ContainingSymbol.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat),
+ symbol.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat),
+ targetMethod.ToDisplayString(SymbolDisplayFormats.ShortSymbolDisplayFormat)));
}
}
- #endregion
+ }
+ #endregion
- }, OperationKind.Invocation);
- });
+ }, OperationKind.Invocation);
}
private static IEnumerable GetIndexesOfParameterType(IMethodSymbol targetMethod, INamedTypeSymbol formatProviderType)
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/SpecifyStringComparison.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/SpecifyStringComparison.cs
index 0043b544b3..5dd1776a40 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/SpecifyStringComparison.cs
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/SpecifyStringComparison.cs
@@ -7,6 +7,7 @@
using Analyzer.Utilities.Extensions;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
+using Microsoft.CodeAnalysis.NetAnalyzers;
using Microsoft.CodeAnalysis.Operations;
namespace Microsoft.NetCore.Analyzers.Runtime
@@ -15,7 +16,7 @@ namespace Microsoft.NetCore.Analyzers.Runtime
/// CA1307: Specify StringComparison
///
[DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)]
- public sealed class SpecifyStringComparisonAnalyzer : DiagnosticAnalyzer
+ public sealed class SpecifyStringComparisonAnalyzer : AbstractGlobalizationDiagnosticAnalyzer
{
private const string RuleId_CA1307 = "CA1307";
private const string RuleId_CA1310 = "CA1310";
@@ -51,84 +52,78 @@ public sealed class SpecifyStringComparisonAnalyzer : DiagnosticAnalyzer
public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(Rule_CA1307, Rule_CA1310);
- public override void Initialize(AnalysisContext context)
+ protected override void InitializeWorker(CompilationStartAnalysisContext context)
{
- context.EnableConcurrentExecution();
- context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
+ var stringComparisonType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemStringComparison);
+ var stringType = context.Compilation.GetSpecialType(SpecialType.System_String);
- context.RegisterCompilationStartAction(csaContext =>
+ // Without these symbols the rule cannot run
+ if (stringComparisonType == null || stringType == null)
{
- var stringComparisonType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemStringComparison);
- var stringType = csaContext.Compilation.GetSpecialType(SpecialType.System_String);
+ return;
+ }
+
+ var overloadMap = GetWellKnownStringOverloads(context.Compilation, stringType, stringComparisonType);
+
+ var linqExpressionType = context.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemLinqExpressionsExpression1);
- // Without these symbols the rule cannot run
- if (stringComparisonType == null || stringType == null)
+ context.RegisterOperationAction(oaContext =>
+ {
+ var invocationExpression = (IInvocationOperation)oaContext.Operation;
+ var targetMethod = invocationExpression.TargetMethod;
+
+ if (targetMethod.IsGenericMethod ||
+ targetMethod.ContainingType == null ||
+ targetMethod.ContainingType.IsErrorType())
{
return;
}
- var overloadMap = GetWellKnownStringOverloads(csaContext.Compilation, stringType, stringComparisonType);
-
- var linqExpressionType = csaContext.Compilation.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemLinqExpressionsExpression1);
+ // Check if we are in a Expression> context, in which case it is possible
+ // that the underlying call doesn't have the comparison option so we want to bail-out.
+ if (invocationExpression.IsWithinExpressionTree(linqExpressionType))
+ {
+ return;
+ }
- csaContext.RegisterOperationAction(oaContext =>
+ // Report correctness issue CA1310 for known string comparison methods that default to culture specific string comparison:
+ // https://docs.microsoft.com/dotnet/standard/base-types/best-practices-strings#string-comparisons-that-use-the-current-culture
+ if (targetMethod.ContainingType.SpecialType == SpecialType.System_String &&
+ !overloadMap.IsEmpty &&
+ overloadMap.ContainsKey(targetMethod))
{
- var invocationExpression = (IInvocationOperation)oaContext.Operation;
- var targetMethod = invocationExpression.TargetMethod;
+ ReportDiagnostic(
+ Rule_CA1310,
+ oaContext,
+ invocationExpression,
+ targetMethod,
+ overloadMap[targetMethod]);
- if (targetMethod.IsGenericMethod ||
- targetMethod.ContainingType == null ||
- targetMethod.ContainingType.IsErrorType())
- {
- return;
- }
+ return;
+ }
- // Check if we are in a Expression> context, in which case it is possible
- // that the underlying call doesn't have the comparison option so we want to bail-out.
- if (invocationExpression.IsWithinExpressionTree(linqExpressionType))
- {
- return;
- }
+ // Report maintainability issue CA1307 for any method that has an additional overload with the exact same parameter list,
+ // plus as additional StringComparison parameter. Default StringComparison may or may not match user's intent,
+ // but it is recommended to explicitly specify it for clarity and readability:
+ // https://docs.microsoft.com/dotnet/standard/base-types/best-practices-strings#recommendations-for-string-usage
+ IEnumerable methodsWithSameNameAsTargetMethod = targetMethod.ContainingType.GetMembers(targetMethod.Name).OfType();
+ if (methodsWithSameNameAsTargetMethod.HasMoreThan(1))
+ {
+ var correctOverload = methodsWithSameNameAsTargetMethod
+ .GetMethodOverloadsWithDesiredParameterAtTrailing(targetMethod, stringComparisonType)
+ .FirstOrDefault();
- // Report correctness issue CA1310 for known string comparison methods that default to culture specific string comparison:
- // https://docs.microsoft.com/dotnet/standard/base-types/best-practices-strings#string-comparisons-that-use-the-current-culture
- if (targetMethod.ContainingType.SpecialType == SpecialType.System_String &&
- !overloadMap.IsEmpty &&
- overloadMap.ContainsKey(targetMethod))
+ if (correctOverload != null)
{
ReportDiagnostic(
- Rule_CA1310,
+ Rule_CA1307,
oaContext,
invocationExpression,
targetMethod,
- overloadMap[targetMethod]);
-
- return;
- }
-
- // Report maintainability issue CA1307 for any method that has an additional overload with the exact same parameter list,
- // plus as additional StringComparison parameter. Default StringComparison may or may not match user's intent,
- // but it is recommended to explicitly specify it for clarity and readability:
- // https://docs.microsoft.com/dotnet/standard/base-types/best-practices-strings#recommendations-for-string-usage
- IEnumerable methodsWithSameNameAsTargetMethod = targetMethod.ContainingType.GetMembers(targetMethod.Name).OfType();
- if (methodsWithSameNameAsTargetMethod.HasMoreThan(1))
- {
- var correctOverload = methodsWithSameNameAsTargetMethod
- .GetMethodOverloadsWithDesiredParameterAtTrailing(targetMethod, stringComparisonType)
- .FirstOrDefault();
-
- if (correctOverload != null)
- {
- ReportDiagnostic(
- Rule_CA1307,
- oaContext,
- invocationExpression,
- targetMethod,
- correctOverload);
- }
+ correctOverload);
}
- }, OperationKind.Invocation);
- });
+ }
+ }, OperationKind.Invocation);
static ImmutableDictionary GetWellKnownStringOverloads(
Compilation compilation,
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/UseOrdinalStringComparison.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/UseOrdinalStringComparison.cs
index 5384596685..78e03adc15 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/UseOrdinalStringComparison.cs
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Runtime/UseOrdinalStringComparison.cs
@@ -7,11 +7,12 @@
using Analyzer.Utilities.Extensions;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
+using Microsoft.CodeAnalysis.NetAnalyzers;
using Microsoft.CodeAnalysis.Operations;
namespace Microsoft.NetCore.Analyzers.Runtime
{
- public abstract class UseOrdinalStringComparisonAnalyzer : DiagnosticAnalyzer
+ public abstract class UseOrdinalStringComparisonAnalyzer : AbstractGlobalizationDiagnosticAnalyzer
{
internal const string RuleId = "CA1309";
@@ -37,50 +38,43 @@ public abstract class UseOrdinalStringComparisonAnalyzer : DiagnosticAnalyzer
public override ImmutableArray SupportedDiagnostics => ImmutableArray.Create(Rule);
- public override void Initialize(AnalysisContext context)
+ protected override void InitializeWorker(CompilationStartAnalysisContext context)
{
- context.EnableConcurrentExecution();
- context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None);
-
- context.RegisterCompilationStartAction(
- (context) =>
+ INamedTypeSymbol? stringComparisonType = context.Compilation.GetOrCreateTypeByMetadataName(StringComparisonTypeName);
+ if (stringComparisonType != null)
+ {
+ context.RegisterOperationAction(operationContext =>
{
- INamedTypeSymbol? stringComparisonType = context.Compilation.GetOrCreateTypeByMetadataName(StringComparisonTypeName);
- if (stringComparisonType != null)
+ var operation = (IInvocationOperation)operationContext.Operation;
+ IMethodSymbol methodSymbol = operation.TargetMethod;
+ if (methodSymbol != null &&
+ methodSymbol.ContainingType.SpecialType == SpecialType.System_String &&
+ IsEqualsOrCompare(methodSymbol.Name))
{
- context.RegisterOperationAction(operationContext =>
+ if (!IsAcceptableOverload(methodSymbol, stringComparisonType))
+ {
+ // wrong overload
+ operationContext.ReportDiagnostic(Diagnostic.Create(Rule, GetMethodNameLocation(operation.Syntax)));
+ }
+ else
+ {
+ IArgumentOperation lastArgument = operation.Arguments.Last();
+ if (lastArgument.Value.Kind == OperationKind.FieldReference)
{
- var operation = (IInvocationOperation)operationContext.Operation;
- IMethodSymbol methodSymbol = operation.TargetMethod;
- if (methodSymbol != null &&
- methodSymbol.ContainingType.SpecialType == SpecialType.System_String &&
- IsEqualsOrCompare(methodSymbol.Name))
+ IFieldSymbol fieldSymbol = ((IFieldReferenceOperation)lastArgument.Value).Field;
+ if (fieldSymbol != null &&
+ fieldSymbol.ContainingType.Equals(stringComparisonType) &&
+ !IsOrdinalOrOrdinalIgnoreCase(fieldSymbol.Name))
{
- if (!IsAcceptableOverload(methodSymbol, stringComparisonType))
- {
- // wrong overload
- operationContext.ReportDiagnostic(Diagnostic.Create(Rule, GetMethodNameLocation(operation.Syntax)));
- }
- else
- {
- IArgumentOperation lastArgument = operation.Arguments.Last();
- if (lastArgument.Value.Kind == OperationKind.FieldReference)
- {
- IFieldSymbol fieldSymbol = ((IFieldReferenceOperation)lastArgument.Value).Field;
- if (fieldSymbol != null &&
- fieldSymbol.ContainingType.Equals(stringComparisonType) &&
- !IsOrdinalOrOrdinalIgnoreCase(fieldSymbol.Name))
- {
- // right overload, wrong value
- operationContext.ReportDiagnostic(lastArgument.Syntax.CreateDiagnostic(Rule));
- }
- }
- }
+ // right overload, wrong value
+ operationContext.ReportDiagnostic(lastArgument.Syntax.CreateDiagnostic(Rule));
}
- },
- OperationKind.Invocation);
+ }
+ }
}
- });
+ },
+ OperationKind.Invocation);
+ }
}
private static bool IsEqualsOrCompare(string methodName)
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotDisableHttpClientCRLCheck.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotDisableHttpClientCRLCheck.cs
index 6a8b06d978..77ef90d8b1 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotDisableHttpClientCRLCheck.cs
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotDisableHttpClientCRLCheck.cs
@@ -85,16 +85,16 @@ internal class DoNotDisableHttpClientCRLCheck : DiagnosticAnalyzer
"handler",
(IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) =>
{
- return (abstractValue[ServerCertificateValidationCallbackIndex]) switch
+ return abstractValue[ServerCertificateValidationCallbackIndex] switch
{
- PropertySetAbstractValueKind.Flagged => (abstractValue[CheckCertificateRevocationListIndex]) switch
+ PropertySetAbstractValueKind.Flagged => abstractValue[CheckCertificateRevocationListIndex] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
PropertySetAbstractValueKind.MaybeFlagged => HazardousUsageEvaluationResult.MaybeFlagged,
_ => HazardousUsageEvaluationResult.Unflagged,
},
- PropertySetAbstractValueKind.MaybeFlagged => (abstractValue[CheckCertificateRevocationListIndex]) switch
+ PropertySetAbstractValueKind.MaybeFlagged => abstractValue[CheckCertificateRevocationListIndex] switch
{
PropertySetAbstractValueKind.Unflagged => HazardousUsageEvaluationResult.Unflagged,
_ => HazardousUsageEvaluationResult.MaybeFlagged,
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotInstallRootCert.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotInstallRootCert.cs
index d5e6b02823..f437e0ad22 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotInstallRootCert.cs
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotInstallRootCert.cs
@@ -54,7 +54,7 @@ public sealed class DoNotInstallRootCert : DiagnosticAnalyzer
private static HazardousUsageEvaluationResult HazardousUsageCallback(IMethodSymbol methodSymbol, PropertySetAbstractValue propertySetAbstractValue)
{
- return (propertySetAbstractValue[0]) switch
+ return propertySetAbstractValue[0] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotUseInsecureDeserializerJavascriptSerializerWithSimpleTypeResolver.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotUseInsecureDeserializerJavascriptSerializerWithSimpleTypeResolver.cs
index 0039a59687..a2a05b56e3 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotUseInsecureDeserializerJavascriptSerializerWithSimpleTypeResolver.cs
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotUseInsecureDeserializerJavascriptSerializerWithSimpleTypeResolver.cs
@@ -56,7 +56,7 @@ internal class DoNotUseInsecureDeserializerJavaScriptSerializerWithSimpleTypeRes
private static HazardousUsageEvaluationResult HazardousUsageCallback(IMethodSymbol methodSymbol, PropertySetAbstractValue propertySetAbstractValue)
{
- return (propertySetAbstractValue[0]) switch
+ return propertySetAbstractValue[0] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
PropertySetAbstractValueKind.Unflagged => HazardousUsageEvaluationResult.Unflagged,
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotUseWeakKDFInsufficientIterationCount.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotUseWeakKDFInsufficientIterationCount.cs
index eedf740bbb..420aaeb926 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotUseWeakKDFInsufficientIterationCount.cs
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/DoNotUseWeakKDFInsufficientIterationCount.cs
@@ -52,7 +52,7 @@ public sealed class DoNotUseWeakKDFInsufficientIterationCount : DiagnosticAnalyz
private static HazardousUsageEvaluationResult HazardousUsageCallback(IMethodSymbol methodSymbol, PropertySetAbstractValue propertySetAbstractValue)
{
- return (propertySetAbstractValue[0]) switch
+ return propertySetAbstractValue[0] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/UseSecureCookiesASPNetCore.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/UseSecureCookiesASPNetCore.cs
index b8a3d9f7cb..f164728ed2 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/UseSecureCookiesASPNetCore.cs
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/Security/UseSecureCookiesASPNetCore.cs
@@ -59,7 +59,7 @@ public sealed class UseSecureCookiesASPNetCore : DiagnosticAnalyzer
private static HazardousUsageEvaluationResult HazardousUsageCallback(IMethodSymbol methodSymbol, PropertySetAbstractValue propertySetAbstractValue)
{
- return (propertySetAbstractValue[0]) switch
+ return propertySetAbstractValue[0] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.cs.xlf b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.cs.xlf
index 5c543bb8ff..e699d2682c 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.cs.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.cs.xlf
@@ -284,7 +284,7 @@
- Používejte v ASP.Net Core zabezpečené soubory cookie
+ Používat zabezpečené soubory cookie v ASP.NET Core
@@ -434,7 +434,7 @@
- When deserializing an instance of class {0}, method {1} can call dangerous method {2}. The potential method invocations are: {3}.
+ Při deserializaci instance třídy {0} může metoda {1} volat nebezpečnou metodu {2}. Možná volání metod: {3}
@@ -1374,7 +1374,7 @@
- Zajistěte použití zabezpečených souborů cookie v ASP.Net Core
+ Zajistit používání zabezpečených souborů cookie v ASP.NET Core
@@ -1504,7 +1504,7 @@
- and all other platforms
+ a všechny ostatní platformyThis call site is reachable on: 'windows' 10.0.2000 and later, and all other platforms
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.de.xlf b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.de.xlf
index 25704ee473..84b26fb3ba 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.de.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.de.xlf
@@ -284,7 +284,7 @@
- Sichere Cookies in ASP.NET Core verwenden
+ Sichere Cookies in ASP.NET Core verwenden
@@ -434,7 +434,7 @@
- When deserializing an instance of class {0}, method {1} can call dangerous method {2}. The potential method invocations are: {3}.
+ Wenn eine Instanz der Klasse "{0}" deserialisiert wird, kann die Methode "{1}" die gefährliche Methode "{2}" aufrufen. Mögliche Methodenaufrufe: {3}
@@ -1374,7 +1374,7 @@
- Stellen Sie sicher, dass sichere Cookies in ASP.NET Core verwendet werden.
+ Verwendung sicherer Cookies in ASP.NET Core sicherstellen
@@ -1504,7 +1504,7 @@
- and all other platforms
+ und alle anderen PlattformenThis call site is reachable on: 'windows' 10.0.2000 and later, and all other platforms
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.es.xlf b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.es.xlf
index ae9f9fed69..c9d2d58054 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.es.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.es.xlf
@@ -284,7 +284,7 @@
- Usar cookies seguras en ASP.NET Core
+ Usar cookies seguras en ASP.NET Core
@@ -434,7 +434,7 @@
- When deserializing an instance of class {0}, method {1} can call dangerous method {2}. The potential method invocations are: {3}.
+ Al deserializar una instancia de la clase {0}, el método {1} puede llamar al método peligroso {2}. Invocaciones de métodos posibles: {3}.
@@ -1374,7 +1374,7 @@
- Asegurarse de usar cookies seguras en ASP.NET Core
+ Asegurarse de usar cookies seguras en ASP.NET Core
@@ -1504,7 +1504,7 @@
- and all other platforms
+ y el resto de plataformasThis call site is reachable on: 'windows' 10.0.2000 and later, and all other platforms
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.fr.xlf b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.fr.xlf
index 092137f893..62cbb5a6dc 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.fr.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.fr.xlf
@@ -284,7 +284,7 @@
- Utiliser des cookies sécurisés en ASP.Net Core
+ Utiliser des cookies sécurisés en ASP.NET Core
@@ -434,7 +434,7 @@
- When deserializing an instance of class {0}, method {1} can call dangerous method {2}. The potential method invocations are: {3}.
+ Quand vous désérialisez une instance de la classe {0}, la méthode {1} peut appeler une méthode dangereuse {2}. Les appels de méthode potentiels sont : {3}.
@@ -1374,7 +1374,7 @@
- Vérifier l'utilisation de cookies sécurisés en ASP.Net Core
+ Vérifier l'utilisation de cookies sécurisés en ASP.NET Core
@@ -1504,7 +1504,7 @@
- and all other platforms
+ et toutes les autres plateformesThis call site is reachable on: 'windows' 10.0.2000 and later, and all other platforms
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.it.xlf b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.it.xlf
index 4875d8bfda..28a674c05e 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.it.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.it.xlf
@@ -284,7 +284,7 @@
- Usa cookie protetti in ASP.NET Core
+ Usa cookie protetti in ASP.NET Core
@@ -434,7 +434,7 @@
- When deserializing an instance of class {0}, method {1} can call dangerous method {2}. The potential method invocations are: {3}.
+ Durante la deserializzazione di un'istanza della classe {0} il metodo {1} può chiamare il metodo pericoloso {2}. Le potenziali chiamate al metodo sono: {3}.
@@ -1374,7 +1374,7 @@
- Assicura l'uso di cookie protetti in ASP.NET Core
+ Assicura l'uso di cookie protetti in ASP.NET Core
@@ -1504,7 +1504,7 @@
- and all other platforms
+ e tutte le altre piattaformeThis call site is reachable on: 'windows' 10.0.2000 and later, and all other platforms
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.ja.xlf b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.ja.xlf
index 0d7db37eb3..b21cce2180 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.ja.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.ja.xlf
@@ -284,7 +284,7 @@
- ASP.Net Core で安全な Cookie を使用します
+ ASP.NET Core で安全な Cookie を使用します
@@ -434,7 +434,7 @@
- When deserializing an instance of class {0}, method {1} can call dangerous method {2}. The potential method invocations are: {3}.
+ クラス {0} のインスタンスを逆シリアル化すると、メソッド {1} によって危険なメソッド {2} を呼び出されるおそれがあります。考えられるメソッド呼び出し: {3}。
@@ -1374,7 +1374,7 @@
- ASP.Net Core で安全な Cookie を使用することを確認します
+ ASP.Net Core で安全な Cookie を使用していることを確認します
@@ -1504,7 +1504,7 @@
- and all other platforms
+ およびその他すべてのプラットフォームThis call site is reachable on: 'windows' 10.0.2000 and later, and all other platforms
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.ko.xlf b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.ko.xlf
index 0a7f310f36..bcda2ad83a 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.ko.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.ko.xlf
@@ -284,7 +284,7 @@
- ASP.NET Core에서 보안 쿠키 사용
+ ASP.NET Core에서 보안 쿠키 사용
@@ -434,7 +434,7 @@
- When deserializing an instance of class {0}, method {1} can call dangerous method {2}. The potential method invocations are: {3}.
+ 클래스 {0}의 인스턴스를 역직렬화할 때 메서드 {1}이(가) 위험한 메서드 {2}을(를) 호출할 수 있습니다. 잠재적인 메서드 호출은 {3}입니다.
@@ -1374,7 +1374,7 @@
- ASP.NET Core에서 보안 쿠키 사용 확인
+ ASP.NET Core에서 보안 쿠키 사용 확인
@@ -1504,7 +1504,7 @@
- and all other platforms
+ 및 다른 모든 플랫폼This call site is reachable on: 'windows' 10.0.2000 and later, and all other platforms
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.pl.xlf b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.pl.xlf
index 36fb43df5a..7f554bf883 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.pl.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.pl.xlf
@@ -284,7 +284,7 @@
- Użyj bezpiecznych plików cookie na platformie ASP.Net Core
+ Użyj bezpiecznych plików cookie na platformie ASP.NET Core
@@ -434,7 +434,7 @@
- When deserializing an instance of class {0}, method {1} can call dangerous method {2}. The potential method invocations are: {3}.
+ Podczas deserializacji wystąpienia klasy {0} metoda {1} może wywołać niebezpieczną metodę {2}. Potencjalne wywołania metod to: {3}.
@@ -1374,7 +1374,7 @@
- Upewnij się, że używasz bezpiecznych plików cookie na platformie ASP.Net Core
+ Upewnij się, że używasz bezpiecznych plików cookie na platformie ASP.NET Core
@@ -1504,7 +1504,7 @@
- and all other platforms
+ i wszystkie inne platformyThis call site is reachable on: 'windows' 10.0.2000 and later, and all other platforms
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.pt-BR.xlf b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.pt-BR.xlf
index 822e1d16cd..eb5b24a188 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.pt-BR.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.pt-BR.xlf
@@ -284,7 +284,7 @@
- Usar Cookies Seguros no ASP.Net Core
+ Usar Cookies Seguros no ASP.Net Core
@@ -434,7 +434,7 @@
- When deserializing an instance of class {0}, method {1} can call dangerous method {2}. The potential method invocations are: {3}.
+ Ao desserializar uma instância da classe {0}, o método {1} pode chamar o método perigoso {2}. As possíveis invocações de método são: {3}.
@@ -1374,7 +1374,7 @@
- Garantir o Uso de Cookies Seguros no ASP.Net Core
+ Garantir o Uso de Cookies Seguros no ASP.Net Core
@@ -1504,7 +1504,7 @@
- and all other platforms
+ e todas as outras plataformasThis call site is reachable on: 'windows' 10.0.2000 and later, and all other platforms
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.ru.xlf b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.ru.xlf
index 077cad1f2f..07277c7fac 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.ru.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.ru.xlf
@@ -284,7 +284,7 @@
- Использовать защищенные файлы cookie в ASP.NET Core
+ Использовать защищенные файлы cookie в ASP.NET Core
@@ -434,7 +434,7 @@
- When deserializing an instance of class {0}, method {1} can call dangerous method {2}. The potential method invocations are: {3}.
+ При десериализации экземпляра класса {0} метод {1} может вызывать опасный метод {2}. Потенциальные вызовы метода: {3}.
@@ -1374,7 +1374,7 @@
- Убедитесь в использовании защищенных файлов cookie в ASP.NET Core.
+ Убедитесь в использовании защищенных файлов cookie в ASP.NET Core.
@@ -1504,7 +1504,7 @@
- and all other platforms
+ и на всех остальных платформахThis call site is reachable on: 'windows' 10.0.2000 and later, and all other platforms
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.tr.xlf b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.tr.xlf
index f892c67206..64eba8bdd4 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.tr.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.tr.xlf
@@ -284,7 +284,7 @@
- ASP.Net Core'da Güvenli Tanımlama Bilgileri Kullan
+ ASP.NET Core'da Güvenli Tanımlama Bilgileri Kullan
@@ -434,7 +434,7 @@
- When deserializing an instance of class {0}, method {1} can call dangerous method {2}. The potential method invocations are: {3}.
+ {0} sınıfının bir örneği seri durumdan çıkarılırken, {1} metodu tehlikeli {2} metodunu çağırabilir. Olası metot çağırmaları: {3}.
@@ -1374,7 +1374,7 @@
- ASP.Net Core içinde Güvenli Tanımlama Bilgileri Kullanılmasını Sağla
+ ASP.NET Core'da Güvenli Tanımlama Bilgileri Kullanılmasını Sağla
@@ -1504,7 +1504,7 @@
- and all other platforms
+ ve diğer tüm platformlarThis call site is reachable on: 'windows' 10.0.2000 and later, and all other platforms
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.zh-Hans.xlf b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.zh-Hans.xlf
index 5e339d6d45..d2b8f64773 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.zh-Hans.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.zh-Hans.xlf
@@ -284,7 +284,7 @@
- 在 ASP.Net Core 中使用安全 Cookie
+ 在 ASP.NET Core 中使用安全 Cookie
@@ -434,7 +434,7 @@
- When deserializing an instance of class {0}, method {1} can call dangerous method {2}. The potential method invocations are: {3}.
+ 反序列化类 {0} 的实例时,方法 {1} 可调用危险方法 {2}。潜在的方法调用为: {3}。
@@ -1374,7 +1374,7 @@
- 确保在 ASP.Net Core 中使用安全 Cookie
+ 确保在 ASP.NET Core 中使用安全 Cookie
@@ -1504,7 +1504,7 @@
- and all other platforms
+ 和其他所有平台This call site is reachable on: 'windows' 10.0.2000 and later, and all other platforms
diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.zh-Hant.xlf b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.zh-Hant.xlf
index b2f5bc12de..c5f619e2bf 100644
--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.zh-Hant.xlf
+++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/xlf/MicrosoftNetCoreAnalyzersResources.zh-Hant.xlf
@@ -284,7 +284,7 @@
- 在 ASP.Net Core 中使用安全 Cookie
+ 在 ASP.Net Core 中使用安全 Cookie
@@ -434,7 +434,7 @@
- When deserializing an instance of class {0}, method {1} can call dangerous method {2}. The potential method invocations are: {3}.
+ 將類別 {0} 的執行個體還原序列化時,方法 {1} 可以呼叫危險的方法 {2}。潛在的方法引動過程為: {3}。
@@ -1374,7 +1374,7 @@
- 請確認在 ASP.Net Core 中使用安全 Cookie
+ 請確認在 ASP.Net Core 中使用安全 Cookie
@@ -1504,7 +1504,7 @@
- and all other platforms
+ 及所有其他平台This call site is reachable on: 'windows' 10.0.2000 and later, and all other platforms
diff --git a/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/Runtime/SpecifyCultureInfoTests.cs b/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/Runtime/SpecifyCultureInfoTests.cs
index 3dd20ca872..dda6453238 100644
--- a/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/Runtime/SpecifyCultureInfoTests.cs
+++ b/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/Runtime/SpecifyCultureInfoTests.cs
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
+using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Testing;
using Test.Utilities;
using Xunit;
@@ -15,6 +16,28 @@ namespace Microsoft.NetCore.Analyzers.Runtime.UnitTests
{
public class SpecifyCultureInfoTests
{
+ [Theory]
+ [InlineData("build_property.InvariantGlobalization = false", @"[|""aaa"".ToLower()|]")]
+ [InlineData("build_property.InvariantGlobalization = true", @"""aaa"".ToLower()")]
+ public async Task CA1304_PlainString_CSharp_InvariantGlobalization(string property, string returnExpression)
+ {
+ await new VerifyCS.Test
+ {
+ TestCode = $@"
+using System;
+using System.Globalization;
+
+public class CultureInfoTestClass0
+{{
+ public string SpecifyCultureInfo01()
+ {{
+ return {returnExpression};
+ }}
+}}",
+ AnalyzerConfigDocument = property,
+ }.RunAsync();
+ }
+
[Fact]
public async Task CA1304_PlainString_CSharp()
{
@@ -759,4 +782,4 @@ private static DiagnosticResult GetBasicResultAt(int line, int column, string in
#pragma warning restore RS0030 // Do not used banned APIs
.WithArguments(invocation, containingMethod, preferredOverload);
}
-}
\ No newline at end of file
+}
diff --git a/src/NetAnalyzers/UnitTests/MiscellaneousAnalyzerTests.cs b/src/NetAnalyzers/UnitTests/MiscellaneousAnalyzerTests.cs
new file mode 100644
index 0000000000..53d3e9ffb6
--- /dev/null
+++ b/src/NetAnalyzers/UnitTests/MiscellaneousAnalyzerTests.cs
@@ -0,0 +1,80 @@
+// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using Microsoft.CodeAnalysis.Diagnostics;
+using Xunit;
+
+namespace Microsoft.CodeAnalysis.NetAnalyzers.UnitTests
+{
+ public class MiscellaneousAnalyzerTests
+ {
+ private sealed class AnalyzerAssemblyLoader : IAnalyzerAssemblyLoader
+ {
+ public static IAnalyzerAssemblyLoader Instance = new AnalyzerAssemblyLoader();
+
+ private AnalyzerAssemblyLoader() { }
+
+ public void AddDependencyLocation(string fullPath) { }
+
+ public Assembly LoadFromPath(string fullPath) => Assembly.LoadFrom(fullPath);
+ }
+
+ [Fact]
+ public void TestGlobalizationAnalyzersSubclassAbstractGlobalizationDiagnosticAnalyzer()
+ {
+ // \artifacts\bin\Microsoft.CodeAnalysis.NetAnalyzers.UnitTests\Debug\netcoreapp3.1\Microsoft.CodeAnalysis.NetAnalyzers.UnitTests.dll
+ var testsAssemblyPath = typeof(MiscellaneousAnalyzerTests).Assembly.Location;
+
+ var directory = Path.GetDirectoryName(testsAssemblyPath);
+
+ foreach (var assembly in new[] { "Microsoft.CodeAnalysis.NetAnalyzers.dll", "Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll", "Microsoft.CodeAnalysis.VisualBasic.NetAnalyzers.dll" })
+ {
+ var path = Path.Combine(directory, assembly);
+ Assert.True(File.Exists(path), $"File {path} doesn't exist.");
+ var analyzerFileReference = new AnalyzerFileReference(path, AnalyzerAssemblyLoader.Instance);
+ analyzerFileReference.AnalyzerLoadFailed += AnalyzerFileReference_AnalyzerLoadFailed;
+ var analyzers = analyzerFileReference.GetAnalyzersForAllLanguages();
+ foreach (var analyzer in analyzers)
+ {
+ if (analyzer.SupportedDiagnostics.Length == 0)
+ {
+ continue;
+ }
+
+ var analyzerType = analyzer.GetType();
+ var isAbstractGlobalizationDiagnosticAnalyzer = IsSubClassOfGlobalizationAnalyzer(analyzerType);
+ if (analyzer.SupportedDiagnostics.All(d => d.Category == "Globalization"))
+ {
+ Debug.Assert(isAbstractGlobalizationDiagnosticAnalyzer, $"Analyzer {analyzerType.Name} was expected to inherit AbstractGlobalizationDiagnosticAnalyzer.");
+ }
+ else
+ {
+ // Note: If an analyzer have one Globalization rule and other non-Globalization rules, it shouldn't inherit AbstractGlobalizationDiagnosticAnalyzer.
+ // Instead, it should check for InvariantCulture MSBuild property for the Globalization rules only.
+ Debug.Assert(!isAbstractGlobalizationDiagnosticAnalyzer, $"Analyzer {analyzerType.Name} wasn't expected to inherit AbstractGlobalizationDiagnosticAnalyzer.");
+ }
+ }
+ }
+
+ static void AnalyzerFileReference_AnalyzerLoadFailed(object sender, AnalyzerLoadFailureEventArgs e)
+ => throw e.Exception ?? new NotSupportedException(e.Message);
+ }
+
+ private static bool IsSubClassOfGlobalizationAnalyzer(Type analyzerType)
+ {
+ var baseType = analyzerType.BaseType;
+ while (baseType != null)
+ {
+ if (baseType.Name == "AbstractGlobalizationDiagnosticAnalyzer")
+ return true;
+ baseType = baseType.BaseType;
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/src/Roslyn.Diagnostics.Analyzers/CSharp/CSharpSpecializedEnumerableCreationAnalyzer.cs b/src/Roslyn.Diagnostics.Analyzers/CSharp/CSharpSpecializedEnumerableCreationAnalyzer.cs
index f59aa91345..b3df1ebd69 100644
--- a/src/Roslyn.Diagnostics.Analyzers/CSharp/CSharpSpecializedEnumerableCreationAnalyzer.cs
+++ b/src/Roslyn.Diagnostics.Analyzers/CSharp/CSharpSpecializedEnumerableCreationAnalyzer.cs
@@ -64,7 +64,7 @@ public void AnalyzeNode(SyntaxNodeAnalysisContext context)
private bool ShouldAnalyzeExpression(SyntaxNode expression, SemanticModel semanticModel, CancellationToken cancellationToken)
{
- return (expression.Kind()) switch
+ return expression.Kind() switch
{
SyntaxKind.ArrayCreationExpression
or SyntaxKind.ImplicitArrayCreationExpression => ShouldAnalyzeArrayCreationExpression(expression, semanticModel, cancellationToken),
diff --git a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.cs.xlf b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.cs.xlf
index d4d7567791..42c27b2abb 100644
--- a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.cs.xlf
+++ b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.cs.xlf
@@ -4,12 +4,12 @@
- Add 'Shared' attribute
+ Přidat atribut Shared{Locked="Shared"}
- Apply trait to containing type
+ Použít vlastnost pro obsahující typ
@@ -109,12 +109,12 @@
- Auto-properties always copy values, so they cannot be declared with non-copyable types.
+ Automatické vlastnosti vždy kopírují hodnoty, proto se nedají deklarovat s nekopírovatelnými typy.
- Auto-property '{1}' cannot have non-copyable type '{0}'
+ Automatická vlastnost {1} nemůže mít nekopírovatelný typ {0}.
@@ -129,12 +129,12 @@
- A field with a non-copyable type cannot be a member of a copyable type. The containing type can be made non-copyable or converted to a reference type, or the field can be removed or converted to a copyable type.
+ Pole s nekopírovatelným typem nemůže být členem kopírovatelného typu. Obsahující typ se dá nastavit jako nekopírovatelný nebo se dá převést na odkazový typ, nebo se pole může odebrat nebo převést na kopírovatelný typ.
- Copyable field '{1}' cannot have non-copyable type '{0}'
+ Kopírovatelné pole {1} nemůže mít nekopírovatelný typ {0}.
diff --git a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.de.xlf b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.de.xlf
index 599c029bbd..47e1999ab5 100644
--- a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.de.xlf
+++ b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.de.xlf
@@ -4,12 +4,12 @@
- Add 'Shared' attribute
+ Attribut "Shared" hinzufügen{Locked="Shared"}
- Apply trait to containing type
+ Merkmal auf enthaltenden Typ anwenden
@@ -109,12 +109,12 @@
- Auto-properties always copy values, so they cannot be declared with non-copyable types.
+ Automatische Eigenschaften kopieren immer Werte und können daher nicht mit nicht kopierbaren Typen deklariert werden.
- Auto-property '{1}' cannot have non-copyable type '{0}'
+ Die automatische Eigenschaft "{1}" darf nicht den nicht kopierbaren Typ "{0}" aufweisen.
@@ -129,12 +129,12 @@
- A field with a non-copyable type cannot be a member of a copyable type. The containing type can be made non-copyable or converted to a reference type, or the field can be removed or converted to a copyable type.
+ Ein Feld mit einem nicht kopierbaren Typ kann kein Member eines kopierbaren Typs sein. Der enthaltende Typ kann als nicht kopierbar festgelegt oder in einen Verweistyp konvertiert werden, oder das Feld kann entfernt oder in einen kopierbaren Typ konvertiert werden.
- Copyable field '{1}' cannot have non-copyable type '{0}'
+ Das kopierbare Feld "{1}" darf nicht den nicht kopierbaren Typ "{0}" aufweisen.
diff --git a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.es.xlf b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.es.xlf
index 4bfb2a8810..5312a4f049 100644
--- a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.es.xlf
+++ b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.es.xlf
@@ -4,12 +4,12 @@
- Add 'Shared' attribute
+ Agregar el atributo "Shared"{Locked="Shared"}
- Apply trait to containing type
+ Aplicar rasgo al tipo contenedor
@@ -109,12 +109,12 @@
- Auto-properties always copy values, so they cannot be declared with non-copyable types.
+ Las propiedades automáticas siempre copian los valores, por lo que no pueden declararse con tipos que no se puedan copiar.
- Auto-property '{1}' cannot have non-copyable type '{0}'
+ La propiedad automática "{1}" no puede tener el tipo "{0}" que no se puede copiar.
@@ -129,12 +129,12 @@
- A field with a non-copyable type cannot be a member of a copyable type. The containing type can be made non-copyable or converted to a reference type, or the field can be removed or converted to a copyable type.
+ Un campo con un tipo que no se pueda copiar no puede ser miembro de un tipo que pueda copiarse. El tipo contenedor puede hacerse no copiable o convertirse en un tipo de referencia, o bien el campo puede quitarse o convertirse en un tipo que se pueda copiar.
- Copyable field '{1}' cannot have non-copyable type '{0}'
+ El campo "{1}" que se puede copiar no puede tener el tipo "{0}" que no puede copiarse.
diff --git a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.fr.xlf b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.fr.xlf
index 367b34a5f2..0a8313de6a 100644
--- a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.fr.xlf
+++ b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.fr.xlf
@@ -4,12 +4,12 @@
- Add 'Shared' attribute
+ Ajouter l'attribut 'Shared'{Locked="Shared"}
- Apply trait to containing type
+ Appliquer la caractéristique au type conteneur
@@ -109,12 +109,12 @@
- Auto-properties always copy values, so they cannot be declared with non-copyable types.
+ Les propriétés automatiques copient toujours les valeurs, elles ne peuvent donc pas être déclarées avec des types non copiables.
- Auto-property '{1}' cannot have non-copyable type '{0}'
+ La propriété automatique '{1}' ne peut pas avoir le type non copiable '{0}'
@@ -129,12 +129,12 @@
- A field with a non-copyable type cannot be a member of a copyable type. The containing type can be made non-copyable or converted to a reference type, or the field can be removed or converted to a copyable type.
+ Un champ avec un type non copiable ne peut pas être membre d'un type copiable. Le type conteneur peut être rendu non copiable ou être converti en type référence. De même, le champ peut être supprimé ou converti en type copiable.
- Copyable field '{1}' cannot have non-copyable type '{0}'
+ La champ copiable '{1}' ne peut pas avoir le type non copiable '{0}'
diff --git a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.it.xlf b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.it.xlf
index 924fe3a8fa..de9f8c8355 100644
--- a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.it.xlf
+++ b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.it.xlf
@@ -4,12 +4,12 @@
- Add 'Shared' attribute
+ Aggiungere l'attributo 'Shared'{Locked="Shared"}
- Apply trait to containing type
+ Applicare la caratteristica al tipo contenitore
@@ -109,12 +109,12 @@
- Auto-properties always copy values, so they cannot be declared with non-copyable types.
+ Le proprietà automatiche copiano sempre i valori, quindi non possono essere dichiarate con tipi non copiabili.
- Auto-property '{1}' cannot have non-copyable type '{0}'
+ La proprietà automatica '{1}' non può includere il tipo non copiabile '{0}'
@@ -129,12 +129,12 @@
- A field with a non-copyable type cannot be a member of a copyable type. The containing type can be made non-copyable or converted to a reference type, or the field can be removed or converted to a copyable type.
+ Un campo con un tipo non copiabile non può essere membro di un tipo copiabile. Il tipo contenitore può essere reso non copiabile o convertito in un tipo riferimento oppure il campo può essere rimosso o convertito in un tipo copiabile.
- Copyable field '{1}' cannot have non-copyable type '{0}'
+ Il campo copiabile '{1}' non può includere il tipo non copiabile '{0}'
diff --git a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.ja.xlf b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.ja.xlf
index a835d7771e..78581c6ae1 100644
--- a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.ja.xlf
+++ b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.ja.xlf
@@ -4,12 +4,12 @@
- Add 'Shared' attribute
+ 'Shared' 属性の追加{Locked="Shared"}
- Apply trait to containing type
+ 包含する側の型に特性を適用する
@@ -109,12 +109,12 @@
- Auto-properties always copy values, so they cannot be declared with non-copyable types.
+ 自動プロパティでは常に値がコピーされるため、コピー不可の型を使用して宣言することはできません。
- Auto-property '{1}' cannot have non-copyable type '{0}'
+ 自動プロパティ '{1}' にコピー不可の型 '{0}' を指定することはできません
@@ -129,12 +129,12 @@
- A field with a non-copyable type cannot be a member of a copyable type. The containing type can be made non-copyable or converted to a reference type, or the field can be removed or converted to a copyable type.
+ コピー不可の型のフィールドをコピー可能な型のメンバーにすることはできません。包含する側の型をコピー不可にすることも参照型に変換することもできます。あるいは、フィールドを削除することも、コピー可能な型に変換することもできます。
- Copyable field '{1}' cannot have non-copyable type '{0}'
+ コピー可能なフィールド '{1}' にコピー不可の型 '{0}' を指定することはできません
diff --git a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.ko.xlf b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.ko.xlf
index e5646bdded..44b5a345c8 100644
--- a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.ko.xlf
+++ b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.ko.xlf
@@ -4,12 +4,12 @@
- Add 'Shared' attribute
+ 'Shared' 특성 추가{Locked="Shared"}
- Apply trait to containing type
+ 포함하는 형식에 특성 적용
@@ -109,12 +109,12 @@
- Auto-properties always copy values, so they cannot be declared with non-copyable types.
+ 자동 속성은 항상 값을 복사하므로 복사할 수 없는 형식으로 선언할 수 없습니다.
- Auto-property '{1}' cannot have non-copyable type '{0}'
+ 자동 속성 '{1}'은(는) 복사할 수 없는 형식 '{0}'을(를) 포함할 수 없음
@@ -129,12 +129,12 @@
- A field with a non-copyable type cannot be a member of a copyable type. The containing type can be made non-copyable or converted to a reference type, or the field can be removed or converted to a copyable type.
+ 복사할 수 없는 형식의 필드는 복사할 수 있는 형식의 멤버일 수 없습니다. 포함하는 형식은 복사할 수 없는 형식이 되거나 참조 형식으로 변환되거나, 필드가 제거되거나 복사할 수 있는 형식으로 변환될 수 있습니다.
- Copyable field '{1}' cannot have non-copyable type '{0}'
+ 복사할 수 있는 필드 '{1}'은(는) 복사할 수 없는 형식 '{0}'을(를) 포함할 수 없음
diff --git a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.pl.xlf b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.pl.xlf
index a291580081..1c9523f855 100644
--- a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.pl.xlf
+++ b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.pl.xlf
@@ -4,12 +4,12 @@
- Add 'Shared' attribute
+ Dodaj atrybut „Shared”{Locked="Shared"}
- Apply trait to containing type
+ Zastosuj cechę do typu zawierającego
@@ -109,12 +109,12 @@
- Auto-properties always copy values, so they cannot be declared with non-copyable types.
+ Właściwości automatyczne zawsze kopiują wartości, więc nie można ich zadeklarować z typami bez możliwości kopiowania.
- Auto-property '{1}' cannot have non-copyable type '{0}'
+ Właściwość automatyczna „{1}” nie może mieć typu bez możliwości kopiowania „{0}”
@@ -129,12 +129,12 @@
- A field with a non-copyable type cannot be a member of a copyable type. The containing type can be made non-copyable or converted to a reference type, or the field can be removed or converted to a copyable type.
+ Pole typie bez możliwości kopiowania nie może być składową typu z możliwością kopiowania. Typ zawierający można ustawić jako typ z możliwością kopiowania lub przekonwertować na typ referencyjny, ewentualnie można usunąć pole lub przekonwertować je na typ z możliwością kopiowania.
- Copyable field '{1}' cannot have non-copyable type '{0}'
+ Pole z możliwością kopiowania „{1}” nie może mieć typu bez możliwości kopiowania „{0}”
diff --git a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.pt-BR.xlf b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.pt-BR.xlf
index f9276546ca..86457489e9 100644
--- a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.pt-BR.xlf
+++ b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.pt-BR.xlf
@@ -4,12 +4,12 @@
- Add 'Shared' attribute
+ Adicionar o atributo 'Shared'{Locked="Shared"}
- Apply trait to containing type
+ Aplicar a característica ao tipo contentor
@@ -109,12 +109,12 @@
- Auto-properties always copy values, so they cannot be declared with non-copyable types.
+ As propriedades automáticas sempre copiam valores, portanto, elas não podem ser declarados com tipos não copiáveis.
- Auto-property '{1}' cannot have non-copyable type '{0}'
+ A propriedade automática '{1}' não pode ter o tipo não copiável '{0}'
@@ -129,12 +129,12 @@
- A field with a non-copyable type cannot be a member of a copyable type. The containing type can be made non-copyable or converted to a reference type, or the field can be removed or converted to a copyable type.
+ Um campo com um tipo não copiável não pode ser membro de um tipo copiável. O tipo contentor pode ser convertido em não copiável ou em um tipo de referência ou o campo pode ser removido ou convertido em um tipo copiável.
- Copyable field '{1}' cannot have non-copyable type '{0}'
+ O campo copiável '{1}' não pode ter o tipo não copiável '{0}'
diff --git a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.ru.xlf b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.ru.xlf
index 24fb2b374e..29040d542f 100644
--- a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.ru.xlf
+++ b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.ru.xlf
@@ -4,12 +4,12 @@
- Add 'Shared' attribute
+ Добавить атрибут "Shared"{Locked="Shared"}
- Apply trait to containing type
+ Применить признак к содержащему типу
@@ -109,12 +109,12 @@
- Auto-properties always copy values, so they cannot be declared with non-copyable types.
+ Автоматические свойства всегда копируют значения, поэтому их нельзя объявлять с типами, не допускающими копирование.
- Auto-property '{1}' cannot have non-copyable type '{0}'
+ Автоматическое свойство "{1}" не может иметь тип "{0}", не допускающий копирование.
@@ -129,12 +129,12 @@
- A field with a non-copyable type cannot be a member of a copyable type. The containing type can be made non-copyable or converted to a reference type, or the field can be removed or converted to a copyable type.
+ Поле с типом, не допускающим копирование, не может быть элементом типа, допускающего копирование. Содержащий тип можно сделать не допускающим копирование или преобразовать в ссылочный тип, либо можно удалить поле или преобразовать поле в тип, допускающий копирование.
- Copyable field '{1}' cannot have non-copyable type '{0}'
+ Поле "{1}", допускающее копирование, не может иметь тип "{0}", не допускающий копирование.
diff --git a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.tr.xlf b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.tr.xlf
index 1e7be2f159..641268f37f 100644
--- a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.tr.xlf
+++ b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.tr.xlf
@@ -4,12 +4,12 @@
- Add 'Shared' attribute
+ 'Shared' özniteliği ekleme{Locked="Shared"}
- Apply trait to containing type
+ İçeren türe özellik uygulama
@@ -109,12 +109,12 @@
- Auto-properties always copy values, so they cannot be declared with non-copyable types.
+ Otomatik özellikler her zaman değerleri kopyalar, bu nedenle kopyalanabilir olmayan türlerle bildirilemez.
- Auto-property '{1}' cannot have non-copyable type '{0}'
+ '{1}' otomatik özelliği kopyalanabilir olmayan '{0}' türüne sahip olamaz
@@ -129,12 +129,12 @@
- A field with a non-copyable type cannot be a member of a copyable type. The containing type can be made non-copyable or converted to a reference type, or the field can be removed or converted to a copyable type.
+ Kopyalanabilir olmayan bir tür içeren alan, kopyalanabilir türün bir üyesi olamaz. Kapsayan tür, kopyalanabilir olmayan hale getirilebilir veya bir başvuru türüne dönüştürülebilir ya da alan kaldırılabilir ya da kopyalanabilir bir türe dönüştürülebilir.
- Copyable field '{1}' cannot have non-copyable type '{0}'
+ '{1}' kopyalanabilir alanı, kopyalanabilir olmayan '{0}' türüne sahip olamaz
diff --git a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.zh-Hans.xlf b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.zh-Hans.xlf
index d56b080592..a6038f26db 100644
--- a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.zh-Hans.xlf
+++ b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.zh-Hans.xlf
@@ -4,12 +4,12 @@
- Add 'Shared' attribute
+ 添加 "Shared" 属性{Locked="Shared"}
- Apply trait to containing type
+ 将特征应用于包含类型
@@ -109,12 +109,12 @@
- Auto-properties always copy values, so they cannot be declared with non-copyable types.
+ 自动属性始终会复制值,因此不能使用不可复制的类型声明它们。
- Auto-property '{1}' cannot have non-copyable type '{0}'
+ 自动属性“{1}”不能具有不可复制的类型“{0}”
@@ -129,12 +129,12 @@
- A field with a non-copyable type cannot be a member of a copyable type. The containing type can be made non-copyable or converted to a reference type, or the field can be removed or converted to a copyable type.
+ 具有不可复制的类型的字段不能是可复制的类型的成员。可将包含类型设置为不可复制或转换为引用类型,或者可将该字段删除或转换为可复制的类型。
- Copyable field '{1}' cannot have non-copyable type '{0}'
+ 可复制的字段“{1}”不能具有不可复制的类型“{0}”
diff --git a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.zh-Hant.xlf b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.zh-Hant.xlf
index 4601336524..3e42d8d799 100644
--- a/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.zh-Hant.xlf
+++ b/src/Roslyn.Diagnostics.Analyzers/Core/xlf/RoslynDiagnosticsAnalyzersResources.zh-Hant.xlf
@@ -4,12 +4,12 @@
- Add 'Shared' attribute
+ 新增 'Shared' 屬性{Locked="Shared"}
- Apply trait to containing type
+ 將特徵套用至包含的型別
@@ -109,12 +109,12 @@
- Auto-properties always copy values, so they cannot be declared with non-copyable types.
+ 自動屬性一律會複製值,因此不得以不可複製型別宣告。
- Auto-property '{1}' cannot have non-copyable type '{0}'
+ 自動屬性 '{1}' 不得具有不可複製型別 '{0}'
@@ -129,12 +129,12 @@
- A field with a non-copyable type cannot be a member of a copyable type. The containing type can be made non-copyable or converted to a reference type, or the field can be removed or converted to a copyable type.
+ 具有不可複製型別的欄位,不能是可複製型別的成員。可將包含的型別設為不可複製或轉換為參考型別,或將欄位移除或轉換為可複製型別。
- Copyable field '{1}' cannot have non-copyable type '{0}'
+ 可複製欄位 '{1}' 不能具有不可複製型別 '{0}'
diff --git a/src/Text.Analyzers/Core/IdentifiersShouldBeSpelledCorrectly.cs b/src/Text.Analyzers/Core/IdentifiersShouldBeSpelledCorrectly.cs
index 1ed0087dda..58c68d0008 100644
--- a/src/Text.Analyzers/Core/IdentifiersShouldBeSpelledCorrectly.cs
+++ b/src/Text.Analyzers/Core/IdentifiersShouldBeSpelledCorrectly.cs
@@ -43,8 +43,8 @@ public sealed class IdentifiersShouldBeSpelledCorrectlyAnalyzer : DiagnosticAnal
private static readonly LocalizableString s_localizableMessageMethodTypeParameterMoreMeaningfulName = new LocalizableResourceString(nameof(TextAnalyzersResources.IdentifiersShouldBeSpelledCorrectlyMessageMethodTypeParameterMoreMeaningfulName), TextAnalyzersResources.ResourceManager, typeof(TextAnalyzersResources));
private static readonly LocalizableString s_localizableDescription = new LocalizableResourceString(nameof(TextAnalyzersResources.IdentifiersShouldBeSpelledCorrectlyDescription), TextAnalyzersResources.ResourceManager, typeof(TextAnalyzersResources));
- private static readonly SourceTextValueProvider s_xmlDictionaryProvider = new SourceTextValueProvider(ParseXmlDictionary);
- private static readonly SourceTextValueProvider s_dicDictionaryProvider = new SourceTextValueProvider(ParseDicDictionary);
+ private static readonly SourceTextValueProvider s_xmlDictionaryProvider = new(ParseXmlDictionary);
+ private static readonly SourceTextValueProvider s_dicDictionaryProvider = new(ParseDicDictionary);
private static readonly CodeAnalysisDictionary s_mainDictionary = GetMainDictionary();
internal static DiagnosticDescriptor FileParseRule = DiagnosticDescriptorHelper.Create(
diff --git a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.cs.xlf b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.cs.xlf
index b01f0935be..2e6c9f5842 100644
--- a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.cs.xlf
+++ b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.cs.xlf
@@ -19,12 +19,12 @@
- Error parsing dictionary '{0}': {1}
+ Chyba při parsování slovníku {0}: {1}
- Correct the spelling of '{0}' in variable name '{1}'
+ Opravte pravopis slova {0} v názvu proměnné {1}.
@@ -39,7 +39,7 @@
- Opravte pravopis slova {0} v názvu sestavení {1}.
+ Opravte pravopis slova {0} v názvu sestavení {1}.
@@ -49,37 +49,37 @@
- Opravte pravopis slova {0} v názvu typu {1}.
+ Opravte pravopis slova {0} v názvu typu {1}.
- Opravte pravopis slova {0} v názvu členu {1}, nebo ho úplně odeberte, pokud představuje jakýkoli druh maďarské notace.
+ Opravte pravopis slova {0} v názvu členu {1}, nebo ho úplně odeberte, pokud představuje jakýkoli druh maďarské notace.
- V metodě {0} opravte pravopis slova {1} v názvu parametru {2}, nebo ho úplně odeberte, pokud představuje jakýkoli druh maďarské notace.
+ V metodě {0} opravte pravopis slova {1} v názvu parametru {2}, nebo ho úplně odeberte, pokud představuje jakýkoli druh maďarské notace.
- V delegátovi {0} opravte pravopis slova {1} v názvu parametru {2}, nebo ho úplně odeberte, pokud představuje jakýkoli druh maďarské notace.
+ V delegátovi {0} opravte pravopis slova {1} v názvu parametru {2}, nebo ho úplně odeberte, pokud představuje jakýkoli druh maďarské notace.
- U typu {0} opravte pravopis slova {1} v názvu parametru obecného typu {2}.
+ U typu {0} opravte pravopis slova {1} v názvu parametru obecného typu {2}.
- U metody {0} opravte pravopis slova {1} v názvu parametru obecného typu {2}.
+ U metody {0} opravte pravopis slova {1} v názvu parametru obecného typu {2}.
- Zvažte zadání výstižnějšího názvu, než je název sestavení {0}.
+ Zvažte zadání výstižnějšího názvu, než je název sestavení {0}.
@@ -89,32 +89,32 @@
- Zvažte zadání výstižnějšího názvu, než je název typu {0}.
+ Zvažte zadání výstižnějšího názvu, než je název typu {0}.
- Zvažte zadání výstižnějšího názvu, než je název členu {0}.
+ Zvažte zadání výstižnějšího názvu, než je název členu {0}.
- V metodě {0} zvažte zadání výstižnějšího názvu, než je název parametru {1}.
+ V metodě {0} zvažte zadání výstižnějšího názvu, než je název parametru {1}.
- V delegátovi {0} zvažte zadání výstižnějšího názvu, než je název parametru {1}.
+ V delegátovi {0} zvažte zadání výstižnějšího názvu, než je název parametru {1}.
- U typu {0} zvažte zadání výstižnějšího názvu, než je název parametru obecného typu {1}.
+ U typu {0} zvažte zadání výstižnějšího názvu, než je název parametru obecného typu {1}.
- U metody {0} zvažte zadání výstižnějšího názvu, než je název parametru obecného typu {1}.
+ U metody {0} zvažte zadání výstižnějšího názvu, než je název parametru obecného typu {1}.
diff --git a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.de.xlf b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.de.xlf
index f9146e7949..76536fe5ba 100644
--- a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.de.xlf
+++ b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.de.xlf
@@ -19,12 +19,12 @@
- Error parsing dictionary '{0}': {1}
+ Fehler beim Analysieren des Wörterbuchs "{0}": {1}
- Correct the spelling of '{0}' in variable name '{1}'
+ Korrigieren Sie die Schreibweise von "{0}" im Variablennamen "{1}".
@@ -39,7 +39,7 @@
- Korrigieren Sie die Schreibweise von "{0}" im Assemblynamen "{1}".
+ Korrigieren Sie die Schreibweise von "{0}" im Assemblynamen "{1}".
@@ -49,37 +49,37 @@
- Korrigieren Sie die Schreibweise von "{0}" im Typnamen "{1}".
+ Korrigieren Sie die Schreibweise von "{0}" im Typnamen "{1}".
- Korrigieren Sie die Schreibweise von "{0}" im Membernamen "{1}", oder entfernen Sie das Element ganz, wenn es einen beliebigen Typ ungarischer Notation darstellt.
+ Korrigieren Sie die Schreibweise von "{0}" im Membernamen "{1}", oder entfernen Sie das Element ganz, wenn es einen beliebigen Typ ungarischer Notation darstellt.
- Korrigieren Sie in der Methode "{0}" die Schreibweise von "{1}" im Parameternamen "{2}", oder entfernen Sie das Element ganz, wenn es einen beliebigen Typ ungarischer Notation darstellt.
+ Korrigieren Sie in der Methode "{0}" die Schreibweise von "{1}" im Parameternamen "{2}", oder entfernen Sie das Element ganz, wenn es einen beliebigen Typ ungarischer Notation darstellt.
- Korrigieren Sie im Delegaten "{0}" die Schreibweise von "{1}" im Parameternamen "{2}", oder entfernen Sie das Element ganz, wenn es einen beliebigen Typ ungarischer Notation darstellt.
+ Korrigieren Sie im Delegaten "{0}" die Schreibweise von "{1}" im Parameternamen "{2}", oder entfernen Sie das Element ganz, wenn es einen beliebigen Typ ungarischer Notation darstellt.
- Korrigieren Sie für den Typ "{0}" die Schreibweise von "{1}" im Namen des generischen Typparameters ({2}).
+ Korrigieren Sie für den Typ "{0}" die Schreibweise von "{1}" im Namen des generischen Typparameters ({2}).
- Korrigieren Sie für die Methode "{0}" die Schreibweise von "{1}" im Namen des generischen Typparameters ({2}).
+ Korrigieren Sie für die Methode "{0}" die Schreibweise von "{1}" im Namen des generischen Typparameters ({2}).
- Geben Sie ggf. einen aussagekräftigeren Namen als den Assemblynamen "{0}" an.
+ Geben Sie einen aussagekräftigeren Namen als den Assemblynamen "{0}" an.
@@ -89,32 +89,32 @@
- Geben Sie ggf. einen aussagekräftigeren Namen als den Typnamen "{0}" an.
+ Geben Sie einen aussagekräftigeren Namen als den Typnamen "{0}" an.
- Geben Sie ggf. einen aussagekräftigeren Namen als den Membernamen "{0}" an.
+ Geben Sie ggf. einen aussagekräftigeren Namen als den Membernamen "{0}" an.
- Geben Sie in der Methode "{0}" ggf. einen aussagekräftigeren Namen als den Parameternamen "{1}" an.
+ Geben Sie in der Methode "{0}" einen aussagekräftigeren Namen als den Parameternamen "{1}" an.
- Geben Sie im Delegaten "{0}" ggf. einen aussagekräftigeren Namen als den Parameternamen "{1}" an.
+ Geben Sie im Delegaten "{0}" einen aussagekräftigeren Namen als den Parameternamen "{1}" an.
- Geben Sie für den Typ "{0}" ggf. einen aussagekräftigeren Namen als den Namen des generischen Typparameters ({1}) an.
+ Geben Sie für den Typ "{0}" einen aussagekräftigeren Namen als den Namen des generischen Typparameters ({1}) an.
- Geben Sie für die Methode "{0}" ggf. einen aussagekräftigeren Namen als den Namen des generischen Typparameters ({1}) an.
+ Geben Sie für die Methode "{0}" einen aussagekräftigeren Namen als den Namen des generischen Typparameters ({1}) an.
diff --git a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.es.xlf b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.es.xlf
index e5774d530e..b6762eac60 100644
--- a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.es.xlf
+++ b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.es.xlf
@@ -19,12 +19,12 @@
- Error parsing dictionary '{0}': {1}
+ Error al analizar el diccionario "{0}": {1}
- Correct the spelling of '{0}' in variable name '{1}'
+ Corrija la ortografía de "{0}" en el nombre de variable "{1}".
@@ -39,7 +39,7 @@
- Corrija la ortografía de "{0}" en el nombre de ensamblado {1}.
+ Corrija la ortografía de "{0}" en el nombre de ensamblado "{1}".
@@ -49,37 +49,37 @@
- Corrija la ortografía de "{0}" en el nombre de tipo {1}.
+ Corrija la ortografía de "{0}" en el nombre de tipo "{1}".
- Corrija la ortografía de "{0}" en el nombre de miembro {1} o quítelo totalmente si representa algún tipo de notación húngara.
+ Corrija la ortografía de "{0}" en el nombre de miembro "{1}" o quítelo totalmente si representa algún tipo de notación húngara.
- En el método {0}, corrija la ortografía de "{1}" en el nombre de parámetro {2} o quítelo totalmente si representa algún tipo de notación húngara.
+ En el método "{0}", corrija la ortografía de "{1}" en el nombre de parámetro "{2}" o quítelo totalmente si representa algún tipo de notación húngara.
- En el delegado {0}, corrija la ortografía de "{1}" en el nombre de parámetro {2} o quítelo totalmente si representa algún tipo de notación húngara.
+ En el delegado "{0}", corrija la ortografía de "{1}" en el nombre de parámetro "{2}" o quítelo totalmente si representa algún tipo de notación húngara.
- En el tipo {0}, corrija la ortografía de "{1}" en el nombre de parámetro de tipo genérico {2}.
+ En el tipo "{0}", corrija la ortografía de "{1}" en el nombre de parámetro de tipo genérico "{2}".
- En el método {0}, corrija la ortografía de "{1}" en el nombre de parámetro de tipo genérico {2}.
+ En el método "{0}", corrija la ortografía de "{1}" en el nombre de parámetro de tipo genérico "{2}".
- Considere proporcionar un nombre más significativo que el nombre del ensamblado {0}.
+ Considere proporcionar un nombre más significativo que el nombre del ensamblado "{0}".
@@ -89,32 +89,32 @@
- Considere la posibilidad de proporcionar un nombre más significativo que el nombre del tipo {0}.
+ Considere la posibilidad de proporcionar un nombre más significativo que el nombre del tipo "{0}".
- Considere la posibilidad de proporcionar un nombre más significativo que el nombre del miembro {0}.
+ Considere la posibilidad de proporcionar un nombre más significativo que el nombre del miembro "{0}".
- En el método {0}, puede proporcionar un nombre más significativo que el nombre del parámetro {1}.
+ En el método "{0}", puede proporcionar un nombre más significativo que el nombre del parámetro "{1}".
- En el delegado {0}, puede proporcionar un nombre más significativo que el nombre del parámetro {1}.
+ En el delegado "{0}", puede proporcionar un nombre más significativo que el nombre del parámetro "{1}".
- En el tipo {0}, puede proporcionar un nombre más significativo que el nombre del parámetro de tipo genérico {1}.
+ En el tipo "{0}", puede proporcionar un nombre más significativo que el nombre del parámetro de tipo genérico "{1}".
- En el método {0}, puede proporcionar un nombre más significativo que el nombre del parámetro de tipo genérico {1}.
+ En el método "{0}", puede proporcionar un nombre más significativo que el nombre del parámetro de tipo genérico "{1}".
diff --git a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.fr.xlf b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.fr.xlf
index 55593dc230..cf231d1d62 100644
--- a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.fr.xlf
+++ b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.fr.xlf
@@ -19,12 +19,12 @@
- Error parsing dictionary '{0}': {1}
+ Erreur durant l'analyse du dictionnaire '{0}' : {1}
- Correct the spelling of '{0}' in variable name '{1}'
+ Corrigez l'orthographe de '{0}' dans le nom de variable '{1}'
@@ -39,7 +39,7 @@
- Corrigez l'orthographe de '{0}' dans le nom d'assembly {1}
+ Corrigez l'orthographe de '{0}' dans le nom d'assembly '{1}'
@@ -49,37 +49,37 @@
- Corrigez l'orthographe de '{0}' dans le nom de type {1}
+ Corrigez l'orthographe de '{0}' dans le nom de type '{1}'
- Corrigez l'orthographe de '{0}' dans le nom de membre {1}, ou supprimez-le intégralement s'il représente une forme quelconque de notation hongroise
+ Corrigez l'orthographe de '{0}' dans le nom de membre '{1}', ou supprimez-le intégralement s'il représente une forme quelconque de notation hongroise
- Dans la méthode {0}, corrigez l'orthographe de '{1}' dans le nom de paramètre {2}, ou supprimez-le intégralement s'il représente une forme quelconque de notation hongroise
+ Dans la méthode '{0}', corrigez l'orthographe de '{1}' dans le nom de paramètre '{2}', ou supprimez-le intégralement s'il représente une forme quelconque de notation hongroise
- Dans le délégué {0}, corrigez l'orthographe de '{1}' dans le nom de paramètre {2}, ou supprimez-le intégralement s'il représente une forme quelconque de notation hongroise
+ Dans le délégué '{0}', corrigez l'orthographe de '{1}' dans le nom de paramètre '{2}', ou supprimez-le intégralement s'il représente une forme quelconque de notation hongroise
- Dans le type {0}, corrigez l'orthographe de '{1}' dans le nom de paramètre de type générique {2}
+ Dans le type '{0}', corrigez l'orthographe de '{1}' dans le nom de paramètre de type générique '{2}'
- Dans la méthode {0}, corrigez l'orthographe de '{1}' dans le nom de paramètre de type générique {2}
+ Dans la méthode '{0}', corrigez l'orthographe de '{1}' dans le nom de paramètre de type générique '{2}'
- Indiquez éventuellement un nom plus significatif que le nom d'assembly {0}
+ Envisagez de fournir un nom plus significatif que le nom d'assembly '{0}'
@@ -89,32 +89,32 @@
- Indiquez éventuellement un nom plus significatif que le nom de type {0}
+ Si possible, indiquez un nom plus significatif que le nom de type '{0}'
- Indiquez éventuellement un nom plus significatif que le nom de membre {0}
+ Si possible, indiquez un nom plus significatif que le nom de membre '{0}'
- Dans la méthode {0}, indiquez éventuellement un nom plus significatif que le nom de paramètre {1}
+ Dans la méthode '{0}', si possible, indiquez un nom plus significatif que le nom de paramètre '{1}'
- Dans le délégué {0}, indiquez éventuellement un nom plus significatif que le nom de paramètre {1}
+ Dans le délégué '{0}', si possible, indiquez un nom plus significatif que le nom de paramètre '{1}'
- Dans le type {0}, indiquez éventuellement un nom plus significatif que le nom de paramètre de type générique {1}
+ Dans le type '{0}', si possible, indiquez un nom plus significatif que le nom de paramètre de type générique '{1}'
- Dans la méthode {0}, indiquez éventuellement un nom plus significatif que le nom de paramètre de type générique {1}
+ Dans la méthode '{0}', si possible, indiquez un nom plus significatif que le nom de paramètre de type générique '{1}'
diff --git a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.it.xlf b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.it.xlf
index 35196938bf..833e1cc210 100644
--- a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.it.xlf
+++ b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.it.xlf
@@ -19,12 +19,12 @@
- Error parsing dictionary '{0}': {1}
+ Si è verificato un errore durante l'analisi del dizionario '{0}': {1}
- Correct the spelling of '{0}' in variable name '{1}'
+ Correggere l'ortografia di '{0}' nel nome di variabile '{1}'
@@ -39,7 +39,7 @@
- Correggere l'ortografia di '{0}' nel nome di assembly {1}
+ Correggere l'ortografia di '{0}' nel nome di assembly '{1}'
@@ -49,37 +49,37 @@
- Correggere l'ortografia di '{0}' nel nome di tipo {1}
+ Correggere l'ortografia di '{0}' nel nome di tipo '{1}'
- Correggere l'ortografia di '{0}' nel nome di membro {1} oppure rimuoverlo completamente se rappresenta un qualsiasi tipo di notazione ungherese
+ Correggere l'ortografia di '{0}' nel nome di membro '{1}' oppure rimuoverlo completamente se rappresenta un qualsiasi tipo di notazione ungherese
- Nel metodo {0} correggere l'ortografia di '{1}' nel nome di parametro {2} oppure rimuoverlo completamente se rappresenta un qualsiasi tipo di notazione ungherese
+ Nel metodo '{0}' correggere l'ortografia di '{1}' nel nome di parametro '{2}' oppure rimuoverlo completamente se rappresenta un qualsiasi tipo di notazione ungherese
- Nel delegato {0} correggere l'ortografia di '{1}' nel nome di parametro {2} oppure rimuoverlo completamente se rappresenta un qualsiasi tipo di notazione ungherese
+ Nel delegato '{0}' correggere l'ortografia di '{1}' nel nome di parametro '{2}' oppure rimuoverlo completamente se rappresenta un qualsiasi tipo di notazione ungherese
- Nel tipo {0} correggere l'ortografia di '{1}' nel nome di parametro di tipo generico {2}
+ Nel tipo '{0}' correggere l'ortografia di '{1}' nel nome di parametro di tipo generico '{2}'
- Nel metodo {0} correggere l'ortografia di '{1}' nel nome di parametro di tipo generico {2}
+ Nel metodo '{0}' correggere l'ortografia di '{1}' nel nome di parametro di tipo generico '{2}'
- Provare a specificare un nome più significativo del nome di assembly {0}
+ Provare a specificare un nome più significativo del nome di assembly '{0}'
@@ -89,32 +89,32 @@
- Provare a specificare un nome più significativo del nome di tipo {0}
+ Provare a specificare un nome più significativo del nome di tipo '{0}'
- Provare a specificare un nome più significativo del nome di membro {0}
+ Provare a specificare un nome più significativo del nome di membro '{0}'
- Nel metodo {0} provare a specificare un nome più significativo del nome di parametro {1}
+ Nel metodo '{0}' provare a specificare un nome più significativo del nome di parametro '{1}'
- Nel delegato {0} provare a specificare un nome più significativo del nome di parametro {1}
+ Nel delegato '{0}' provare a specificare un nome più significativo del nome di parametro '{1}'
- Nel tipo {0} provare a specificare un nome più significativo del nome di parametro di tipo generico {1}
+ Nel tipo '{0}' provare a specificare un nome più significativo del nome di parametro di tipo generico '{1}'
- Nel metodo {0} provare a specificare un nome più significativo del nome di parametro di tipo generico {1}
+ Nel metodo '{0}' provare a specificare un nome più significativo del nome di parametro di tipo generico '{1}'
diff --git a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.ja.xlf b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.ja.xlf
index aa6f57a381..eb6d7b82d1 100644
--- a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.ja.xlf
+++ b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.ja.xlf
@@ -19,12 +19,12 @@
- Error parsing dictionary '{0}': {1}
+ ディクショナリ '{0}' の解析でエラーが発生しました: {1}
- Correct the spelling of '{0}' in variable name '{1}'
+ 変数名 '{1}' の '{0}' のスペルを訂正してください
@@ -39,7 +39,7 @@
- アセンブリ名 {1} の '{0}' のスペルを訂正してください
+ アセンブリ名 '{1}' の '{0}' のスペルを訂正してください
@@ -49,37 +49,37 @@
- 型名 {1} の '{0}' のスペルを訂正してください
+ 型名 '{1}' の '{0}' のスペルを訂正してください
- メンバー名 {1} の '{0}' のスペルを訂正するか、または、それがハンガリアン記法を表記する場合はその全体を削除してください
+ メンバー名 '{1}' の '{0}' のスペルを訂正するか、または、それが何らかのハンガリアン記法を表す場合はその全体を削除してください
- メソッド {0} で、パラメーター名 {2} の '{1}' のスペルを訂正するか、または、それがハンガリアン記法を表記する場合はその全体を削除してください
+ メソッド '{0}' で、パラメーター名 '{2}' の '{1}' のスペルを訂正するか、または、それが何らかのハンガリアン記法を表す場合はその全体を削除してください
- デリゲート {0} で、パラメーター名 {2} の '{1}' のスペルを訂正するか、または、それがハンガリアン記法を表記する場合はその全体を削除してください
+ デリゲート '{0}' で、パラメーター名 '{2}' の '{1}' のスペルを訂正するか、または、それが何らかのハンガリアン記法を表す場合はその全体を削除してください
- 型 {0} で、ジェネリック型パラメーター名 {2} の '{1}' のスペルを訂正してください
+ 型 '{0}' で、ジェネリック型パラメーター名 '{2}' の '{1}' のスペルを訂正してください
- メソッド {0} で、ジェネリック型パラメーター名 {2} の '{1}' のスペルを訂正してください
+ メソッド '{0}' で、ジェネリック型パラメーター名 '{2}' の '{1}' のスペルを訂正してください
- アセンブリ名 {0} よりも意味のある名前を指定することを検討してください
+ アセンブリ名 '{0}' よりも意味のある名前を指定することを検討してください
@@ -89,32 +89,32 @@
- 型名 {0} よりも意味のある名前を指定することを検討してください
+ 型名 '{0}' よりも意味のある名前を指定することを検討してください
- メンバー名 {0} よりも意味のある名前を指定することを検討してください
+ メンバー名 '{0}' よりも意味のある名前を指定することを検討してください
- メソッド {0} で、パラメーター名 {1} よりも意味のある名前を指定することを検討してください
+ メソッド '{0}' で、パラメーター名 '{1}' よりも意味のある名前を指定することを検討してください
- デリゲート {0} で、パラメーター名 {1} よりも意味のある名前を指定することを検討してください
+ デリゲート '{0}' で、パラメーター名 '{1}' よりも意味のある名前を指定することを検討してください
- 型 {0} で、ジェネリック型パラメーター名 {1} よりも意味のある名前を指定することを検討してください
+ 型 '{0}' で、ジェネリック型パラメーター名 '{1}' よりも意味のある名前を指定することを検討してください
- メソッド {0} で、ジェネリック型パラメーター名 {1} よりも意味のある名前を指定することを検討してください
+ メソッド '{0}' で、ジェネリック型パラメーター名 '{1}' よりも意味のある名前を指定することを検討してください
diff --git a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.ko.xlf b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.ko.xlf
index c3d72bbfde..9bc9b58a84 100644
--- a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.ko.xlf
+++ b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.ko.xlf
@@ -19,12 +19,12 @@
- Error parsing dictionary '{0}': {1}
+ 사전 '{0}'을(를) 구문 분석하는 동안 오류 발생: {1}
- Correct the spelling of '{0}' in variable name '{1}'
+ 변수 이름 '{1}'에서 '{0}'의 맞춤법을 수정하세요.
@@ -39,7 +39,7 @@
- 어셈블리 이름 {1}에서 '{0}'의 맞춤법을 수정하세요.
+ 어셈블리 이름 '{1}'에서 '{0}'의 맞춤법을 수정하세요.
@@ -49,37 +49,37 @@
- 형식 이름 {1}에서 '{0}'의 맞춤법을 수정하세요.
+ 형식 이름 '{1}'에서 '{0}'의 맞춤법을 수정하세요.
- 멤버 이름 {1}에서 '{0}'의 맞춤법을 수정하거나, 헝가리 표기법을 나타내는 경우 완전히 제거하세요.
+ 멤버 이름 '{1}'에서 '{0}'의 맞춤법을 수정하거나, 헝가리 표기법을 나타내는 경우 완전히 제거하세요.
- {0} 메서드의 매개 변수 이름 {2}에서 '{1}'의 맞춤법을 수정하거나, 헝가리 표기법을 나타내는 경우 완전히 제거하세요.
+ 메서드 '{0}'의 매개 변수 이름 '{2}'에서 '{1}'의 맞춤법을 수정하거나, 헝가리 표기법을 나타내는 경우 완전히 제거하세요.
- {0} 대리자의 매개 변수 이름 {2}에서 '{1}'의 맞춤법을 수정하거나, 헝가리 표기법을 나타내는 경우 완전히 제거하세요.
+ 대리자 '{0}'의 매개 변수 이름 '{2}'에서 '{1}'의 맞춤법을 수정하거나, 헝가리 표기법을 나타내는 경우 완전히 제거하세요.
- {0} 형식의 제네릭 형식 매개 변수 이름 {2}에서 '{1}'의 맞춤법을 수정하세요.
+ 형식 '{0}'의 제네릭 형식 매개 변수 이름 '{2}'에서 '{1}'의 맞춤법을 수정하세요.
- {0} 메서드의 제네릭 형식 매개 변수 이름 {2}에서 '{1}'의 맞춤법을 수정하세요.
+ 메서드 '{0}'의 제네릭 형식 매개 변수 이름 '{2}'에서 '{1}'의 맞춤법을 수정하세요.
- 어셈블리 이름 {0}보다 더 의미 있는 이름을 제공하는 것이 좋습니다.
+ 어셈블리 이름 '{0}'보다 더 의미 있는 이름을 제공하는 것이 좋습니다.
@@ -89,32 +89,32 @@
- 형식 이름 {0}보다 더 의미 있는 이름을 제공하는 것이 좋습니다.
+ 형식 이름 '{0}'보다 더 의미 있는 이름을 제공하는 것이 좋습니다.
- 멤버 이름 {0}보다 더 의미 있는 이름을 제공하는 것이 좋습니다.
+ 멤버 이름 '{0}'보다 더 의미 있는 이름을 제공하는 것이 좋습니다.
- {0} 메서드에서 매개 변수 이름 {1}보다 더 의미 있는 이름을 제공하는 것이 좋습니다.
+ 메서드 '{0}'에서 매개 변수 이름 '{1}'보다 더 의미 있는 이름을 제공하는 것이 좋습니다.
- {0} 대리자에서 매개 변수 이름 {1}보다 더 의미 있는 이름을 제공하는 것이 좋습니다.
+ 대리자 '{0}'에서 매개 변수 이름 '{1}'보다 더 의미 있는 이름을 제공하는 것이 좋습니다.
- {0} 형식에서 제네릭 형식 매개 변수 이름 {1}보다 더 의미 있는 이름을 제공하는 것이 좋습니다.
+ 형식 '{0}'에서 제네릭 형식 매개 변수 이름 '{1}'보다 더 의미 있는 이름을 제공하는 것이 좋습니다.
- {0} 메서드에서 제네릭 형식 매개 변수 이름 {1}보다 더 의미 있는 이름을 제공하는 것이 좋습니다.
+ 메서드 '{0}'에서 제네릭 형식 매개 변수 이름 '{1}'보다 더 의미 있는 이름을 제공하는 것이 좋습니다.
diff --git a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.pl.xlf b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.pl.xlf
index 1da77ce0b2..7a11e4cacc 100644
--- a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.pl.xlf
+++ b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.pl.xlf
@@ -19,12 +19,12 @@
- Error parsing dictionary '{0}': {1}
+ Wystąpił błąd podczas analizowania słownika „{0}”: {1}
- Correct the spelling of '{0}' in variable name '{1}'
+ Popraw pisownię wyrazu „{0}” w nazwie zmiennej „{1}”
@@ -39,7 +39,7 @@
- Popraw pisownię wyrazu „{0}” w nazwie zespołu {1}
+ Popraw pisownię wyrazu „{0}” w nazwie zestawu „{1}”
@@ -49,37 +49,37 @@
- Popraw pisownię wyrazu „{0}” w nazwie typu {1}
+ Popraw pisownię wyrazu „{0}” w nazwie typu „{1}”
- Popraw pisownię wyrazu „{0}” w nazwie składowej {1} lub usuń go całkowicie, jeśli reprezentuje dowolny rodzaj notacji węgierskiej
+ Popraw pisownię wyrazu „{0}” w nazwie składowej „{1}” lub usuń go całkowicie, jeśli reprezentuje dowolny rodzaj notacji węgierskiej
- W metodzie {0} popraw pisownię wyrazu „{1}” w nazwie parametru {2} lub usuń go całkowicie, jeśli reprezentuje dowolny rodzaj notacji węgierskiej
+ W metodzie „{0}” popraw pisownię wyrazu „{1}” w nazwie parametru „{2}” lub usuń go całkowicie, jeśli reprezentuje dowolny rodzaj notacji węgierskiej
- W delegacie {0} popraw pisownię wyrazu {1} w nazwie parametru {2} lub usuń go całkowicie, jeśli reprezentuje dowolny rodzaj notacji węgierskiej
+ W delegacie „{0}” popraw pisownię wyrazu „{1}” w nazwie parametru „{2}” lub usuń go całkowicie, jeśli reprezentuje dowolny rodzaj notacji węgierskiej
- W typie {0} popraw pisownię wyrazu „{1}” w nazwie parametru typu ogólnego {2}
+ W typie „{0}” popraw pisownię wyrazu „{1}” w nazwie parametru typu ogólnego „{2}”
- W metodzie {0} popraw pisownię wyrazu „{1}” w nazwie parametru typu ogólnego {2}
+ W metodzie {0} popraw pisownię wyrazu „{1}” w nazwie parametru typu ogólnego „{2}”
- Rozważ podanie bardziej zrozumiałej nazwy niż nazwa zestawu {0}
+ Rozważ podanie bardziej zrozumiałej nazwy niż nazwa zestawu „{0}”
@@ -89,32 +89,32 @@
- Rozważ podanie bardziej zrozumiałej nazwy niż nazwa typu {0}
+ Rozważ podanie bardziej zrozumiałej nazwy niż nazwa typu „{0}”
- Rozważ podanie bardziej zrozumiałej nazwy niż nazwa składowej {0}
+ Rozważ podanie bardziej zrozumiałej nazwy niż nazwa składowej „{0}”
- W metodzie {0} rozważ podanie bardziej zrozumiałej nazwy niż nazwa parametru {1}
+ W metodzie „{0}” rozważ podanie bardziej zrozumiałej nazwy niż nazwa parametru „{1}”
- W delegacie {0} rozważ podanie bardziej zrozumiałej nazwy niż nazwa parametru {1}
+ W delegacie „{0}” rozważ podanie bardziej zrozumiałej nazwy niż nazwa parametru „{1}”
- W typie {0} rozważ podanie bardziej zrozumiałej nazwy niż nazwa parametru typu ogólnego {1}
+ W typie „{0}” rozważ podanie bardziej zrozumiałej nazwy niż nazwa parametru typu ogólnego „{1}”
- W metodzie {0} rozważ podanie bardziej zrozumiałej nazwy niż nazwa parametru typu ogólnego {1}
+ W metodzie „{0}” rozważ podanie bardziej zrozumiałej nazwy niż nazwa parametru typu ogólnego „{1}”
diff --git a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.pt-BR.xlf b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.pt-BR.xlf
index 8a0bf1a8d9..d4c4b9952f 100644
--- a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.pt-BR.xlf
+++ b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.pt-BR.xlf
@@ -19,12 +19,12 @@
- Error parsing dictionary '{0}': {1}
+ Erro ao analisar o dicionário '{0}': {1}
- Correct the spelling of '{0}' in variable name '{1}'
+ Corrija a ortografia de '{0}' no nome da variável '{1}'
@@ -39,7 +39,7 @@
- Corrija a ortografia de '{0}' no nome do assembly {1}
+ Corrija a ortografia de '{0}' no nome do assembly '{1}'
@@ -49,37 +49,37 @@
- Corrija a ortografia de '{0}' no nome de tipo {1}
+ Corrija a ortografia de '{0}' no nome do tipo '{1}'
- Corrija a ortografia de '{0}' no nome de membro {1} ou remova-o inteiramente caso ele represente qualquer tipo de notação húngara
+ Corrija a ortografia de '{0}' no nome do membro '{1}' ou remova-o inteiramente caso ele represente algum tipo de notação húngara
- No método {0}, corrija a ortografia de '{1}' no nome de parâmetro {2} ou remova-o inteiramente caso ele represente qualquer tipo de notação húngara
+ No método '{0}', corrija a ortografia de '{1}' no nome do parâmetro '{2}' ou remova-o inteiramente caso ele represente algum tipo de notação húngara
- No delegado {0}, corrija a ortografia de '{1}' no nome de parâmetro {2} ou remova-o inteiramente caso ele represente qualquer tipo de notação húngara
+ No delegado '{0}', corrija a ortografia de '{1}' no nome do parâmetro '{2}' ou remova-o inteiramente caso ele represente algum tipo de notação húngara
- No tipo {0}, corrija a ortografia de '{1}' no nome de parâmetro de tipo genérico {2}
+ No tipo '{0}', corrija a ortografia de '{1}' no nome do parâmetro de tipo genérico '{2}'
- No método {0}, corrija a ortografia de '{1}' no nome de parâmetro de tipo genérico {2}
+ No método '{0}', corrija a ortografia de '{1}' no nome do parâmetro de tipo genérico '{2}'
- Considere fornecer um nome mais relevante do que o nome de assembly {0}
+ Considere fornecer um nome mais significativo do que o nome do assembly '{0}'
@@ -89,32 +89,32 @@
- Considere fornecer um nome mais relevante do que o nome de tipo {0}
+ Considere fornecer um nome mais significativo do que o nome do tipo '{0}'
- Considere fornecer um nome mais relevante do que o nome de membro {0}
+ Considere fornecer um nome mais significativo do que o nome do membro '{0}'
- No método {0}, considere fornecer um nome mais relevante do que o nome de parâmetro {1}
+ No método '{0}', considere fornecer um nome mais significativo do que o nome do parâmetro '{1}'
- No delegado {0}, considere fornecer um nome mais relevante do que o nome de parâmetro {1}
+ No delegado '{0}', considere fornecer um nome mais significativo do que o nome do parâmetro '{1}'
- No tipo {0}, considere fornecer um nome mais significativo do que o nome de parâmetro de tipo genérico {1}
+ No tipo '{0}', considere fornecer um nome mais significativo do que o nome do parâmetro de tipo genérico '{1}'
- No método {0}, considere fornecer um nome mais significativo do que o nome de parâmetro de tipo genérico {1}
+ No método '{0}', considere fornecer um nome mais significativo do que o nome do parâmetro de tipo genérico '{1}'
diff --git a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.ru.xlf b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.ru.xlf
index c61e010ef3..e5d42164d8 100644
--- a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.ru.xlf
+++ b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.ru.xlf
@@ -19,12 +19,12 @@
- Error parsing dictionary '{0}': {1}
+ Ошибка при синтаксическом анализе словаря "{0}": {1}
- Correct the spelling of '{0}' in variable name '{1}'
+ Исправьте написание "{0}" в имени переменной "{1}".
@@ -39,7 +39,7 @@
- Исправьте правописание "{0}" в имени сборки {1}.
+ Исправьте написание "{0}" в имени сборки "{1}".
@@ -49,37 +49,37 @@
- Исправьте правописание "{0}" в имени типа {1}.
+ Исправьте написание "{0}" в имени типа "{1}".
- Исправьте правописание "{0}" в имени элемента {1} или удалите его целиком, если используется венгерская нотация.
+ Исправьте написание "{0}" в имени элемента "{1}" или удалите его целиком, если используется венгерская нотация.
- В методе {0} исправьте правописание "{1}" в имени параметра {2} или удалите его целиком, если используется венгерская нотация.
+ В методе "{0}" исправьте написание "{1}" в имени параметра "{2}" или удалите его целиком, если используется венгерская нотация.
- В делегате {0} исправьте правописание "{1}" в имени параметра {2} или удалите его целиком, если используется венгерская нотация.
+ В делегате "{0}" исправьте написание "{1}" в имени параметра "{2}" или удалите его целиком, если используется венгерская нотация.
- В типе {0} исправьте правописание "{1}" в имени параметра универсального типа {2}.
+ В типе "{0}" исправьте написание "{1}" в имени параметра универсального типа "{2}".
- В методе {0} исправьте правописание "{1}" в имени параметра универсального типа {2}.
+ В методе "{0}" исправьте написание "{1}" в имени параметра универсального типа "{2}".
- Подберите более значимое имя для сборки {0}.
+ Подберите более осмысленное имя для сборки "{0}".
@@ -89,32 +89,32 @@
- Подберите более значимое имя для типа {0}.
+ Подберите более осмысленное имя для типа "{0}".
- Подберите более значимое имя для элемента {0}.
+ Подберите более осмысленное имя для элемента "{0}".
- В методе {0} подберите более значимое имя для параметра {1}.
+ В методе "{0}" подберите более осмысленное имя для параметра "{1}".
- В делегате {0} подберите более значимое имя для параметра {1}.
+ В делегате "{0}" подберите более осмысленное имя для параметра "{1}".
- В типе {0} подберите более значимое имя для параметра универсального типа {1}.
+ В типе "{0}" подберите более осмысленное имя для параметра универсального типа "{1}".
- В методе {0} подберите более значимое имя для параметра универсального типа {1}.
+ В методе "{0}" подберите более осмысленное имя для параметра универсального типа "{1}".
diff --git a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.tr.xlf b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.tr.xlf
index 725015bc7b..651f159829 100644
--- a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.tr.xlf
+++ b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.tr.xlf
@@ -19,12 +19,12 @@
- Error parsing dictionary '{0}': {1}
+ '{0}' sözlüğünü ayrıştırma hatası: {1}
- Correct the spelling of '{0}' in variable name '{1}'
+ '{1}' bütünleştirilmiş kod adındaki '{0}' yazımını düzeltin
@@ -39,7 +39,7 @@
- {1} bütünleştirilmiş kod adındaki '{0}' yazımını düzeltin
+ '{1}' bütünleştirilmiş kod adındaki '{0}' yazımını düzeltin
@@ -49,37 +49,37 @@
- {1} tür adındaki '{0}' yazımını düzeltin
+ '{1}' tür adındaki '{0}' yazımını düzeltin
- {1} üye adındaki '{0}' yazımını düzeltin ya da herhangi bir Macar gösterimini temsil ediyorsa tamamen kaldırın
+ '{1}' üye adındaki '{0}' yazımını düzeltin ya da herhangi bir Macar gösterimini temsil ediyorsa tamamen kaldırın
- {0} metodunda, {2} parametre adındaki '{1}' yazımını düzeltin ya da herhangi bir Macar gösterimini temsil ediyorsa tamamen kaldırın
+ '{0}' metodunda, '{2}' parametre adındaki '{1}' yazımını düzeltin ya da herhangi bir Macar gösterimini temsil ediyorsa tamamen kaldırın
- {0} temsilcisinde, {2} parametre adındaki '{1}' yazımını düzeltin ya da herhangi bir Macar gösterimini temsil ediyorsa tamamen kaldırın
+ '{0}' temsilcisinde, '{2}' parametre adındaki '{1}' yazımını düzeltin ya da herhangi bir Macar gösterimini temsil ediyorsa tamamen kaldırın
- {0} türünde, {2} genel tür parametre adındaki '{1}' yazımını düzeltin
+ '{0}' türünde, '{2}' genel tür parametre adındaki '{1}' yazımını düzeltin
- {0} metodunda, {2} genel tür parametre adındaki '{1}' yazımını düzeltin
+ '{0}' metodunda, '{2}' genel tür parametre adındaki '{1}' yazımını düzeltin
- {0} bütünleştirilmiş kod adı yerine daha anlamlı bir ad sağlamayı deneyin
+ '{0}' bütünleştirilmiş kod adı yerine daha anlamlı bir ad sağlamayı deneyin
@@ -89,32 +89,32 @@
- {0} tür adı yerine daha anlamlı bir ad sağlamayı deneyin
+ '{0}' tür adı yerine daha anlamlı bir ad sağlamayı deneyin
- {0} üye adı yerine daha anlamlı bir ad sağlamayı deneyin
+ '{0}' üye adı yerine daha anlamlı bir ad sağlamayı deneyin
- {0} metodunda, {1} parametre adı yerine daha anlamlı bir ad sağlamayı deneyin
+ '{0}' metodunda, '{1}' parametre adı yerine daha anlamlı bir ad sağlamayı deneyin
- {0} temsilcisinde, {1} parametre adı yerine daha anlamlı bir ad sağlamayı deneyin
+ '{0}' temsilcisinde, '{1}' parametre adı yerine daha anlamlı bir ad sağlamayı deneyin
- {0} türünde, {1} genel tür parametre adı yerine daha anlamlı bir ad sağlamayı deneyin
+ '{0}' türünde, '{1}' genel tür parametre adı yerine daha anlamlı bir ad sağlamayı deneyin
- {0} metodunda, {1} genel tür parametre adı yerine daha anlamlı bir ad sağlamayı deneyin
+ '{0}' metodunda, '{1}' genel tür parametre adı yerine daha anlamlı bir ad sağlamayı deneyin
diff --git a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.zh-Hans.xlf b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.zh-Hans.xlf
index 99238c9ef0..b59f99e071 100644
--- a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.zh-Hans.xlf
+++ b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.zh-Hans.xlf
@@ -19,12 +19,12 @@
- Error parsing dictionary '{0}': {1}
+ 分析目录“{0}”时出错: {1}
- Correct the spelling of '{0}' in variable name '{1}'
+ 更正变量名称“{1}”中“{0}”的拼写
@@ -39,7 +39,7 @@
- 更正程序集名称 {1} 中“{0}”的拼写
+ 更正程序集名称“{1}”中“{0}”的拼写
@@ -49,37 +49,37 @@
- 更正类型名称 {1} 中“{0}”的拼写
+ 更正类型名称“{1}”中“{0}”的拼写
- 更正成员名称 {1} 中“{0}”的拼写;如果它表示任何类型的匈牙利表示法,可完全删除它
+ 更正成员名称“{1}”中“{0}”的拼写;如果它表示任何类型的匈牙利表示法,可完全删除它
- 在方法 {0} 中,更正参数名称 {2} 中“{1}”的拼写;如果它代表任何类型的匈牙利表示法,可完全删除它
+ 在方法“{0}”中,更正参数名称“{2}”中“{1}”的拼写;如果它表示任何类型的匈牙利表示法,可完全删除它
- 在委托 {0} 中,更正参数名称 {2} 中“{1}”的拼写;如果它代表任何类型的匈牙利表示法,可完全删除它
+ 在委托“{0}”中,更正参数名称“{2}”中“{1}”的拼写;如果它表示任何类型的匈牙利表示法,可完全删除它
- 在类型 {0} 中,更正泛型类型参数名称 {2} 中“{1}”的拼写
+ 在类型“{0}”中,更正泛型类型参数名称“{2}”中“{1}”的拼写
- 在方法 {0} 中,更正泛型类型参数名称 {2} 中“{1}”的拼写
+ 在方法“{0}”中,更正泛型类型参数名称“{2}”中“{1}”的拼写
- 请考虑将程序集名称 {0} 改为一个意义更明确的名称
+ 请考虑将程序集名称“{0}”改为一个意义更明确的名称
@@ -89,32 +89,32 @@
- 请考虑将类型名称 {0} 改为一个意义更明确的名称
+ 请考虑将类型名称“{0}”改为一个意义更明确的名称
- 请考虑将成员名称 {0} 改为一个意义更明确的名称
+ 请考虑将成员名称“{0}”改为一个意义更明确的名称
- 在方法 {0} 中,请考虑将参数名称 {1} 改为一个意义更明确的名称
+ 在方法“{0}”中,请考虑将参数名称“{1}”改为一个意义更明确的名称
- 在委托 {0} 中,请考虑将参数名称 {1} 改为一个意义更明确的名称
+ 在委托“{0}”中,请考虑将参数名称“{1}”改为一个意义更明确的名称
- 在类型 {0} 中,请考虑将泛型类型参数名称 {1} 改为一个意义更明确的名称
+ 在类型“{0}”中,请考虑将泛型类型参数名称“{1}”改为一个意义更明确的名称
- 在方法 {0} 中,请考虑将泛型类型参数名称 {1} 改为一个意义更明确的名称
+ 在方法“{0}”中,请考虑将泛型类型参数名称“{1}”改为一个意义更明确的名称
diff --git a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.zh-Hant.xlf b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.zh-Hant.xlf
index 62f281109d..4ec110af63 100644
--- a/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.zh-Hant.xlf
+++ b/src/Text.Analyzers/Core/xlf/TextAnalyzersResources.zh-Hant.xlf
@@ -19,12 +19,12 @@
- Error parsing dictionary '{0}': {1}
+ 剖析字典 '{0}' 時發生錯誤: {1}
- Correct the spelling of '{0}' in variable name '{1}'
+ 更正變數名稱 '{1}' 中 '{0}' 的拼字
@@ -39,7 +39,7 @@
- 更正組件名稱 {1} 中 '{0}' 的拼字
+ 更正組件名稱 '{1}' 中 '{0}' 的拼字
@@ -49,37 +49,37 @@
- 更正型別名稱 {1} 中 '{0}' 的拼字
+ 更正型別名稱 '{1}' 中 '{0}' 的拼字
- 更正成員名稱 {1} 中 '{0}' 的拼字,或是如果其代表任何類型的匈牙利標記法,則整個移除
+ 更正成員名稱 '{1}' 中 '{0}' 的拼字,或是如果其代表任何類型的匈牙利標記法,則整個移除
- 在方法 {0} 中,更正參數名稱 {2} 中 '{1}' 的拼字,或是如果其代表任何類型的匈牙利標記法,則整個移除
+ 在方法 '{0}' 中,更正參數名稱 '{2}' 中 '{1}' 的拼字,或是如果其代表任何類型的匈牙利標記法,則整個移除
- 在委派 {0} 中,更正參數名稱 {2} 中 '{1}' 的拼字,或是如果其代表任何類型的匈牙利標記法,則整個移除
+ 在委派 '{0}' 中,更正參數名稱 '{2}' 中 '{1}' 的拼字,或是如果其代表任何類型的匈牙利標記法,則整個移除
- 在型別 {0} 上更正泛型型別參數名稱 {2} 中 '{1}' 的拼字
+ 在型別 '{0}' 中,更正泛型型別參數名稱 '{2}' 中 '{1}' 的拼字
- 在方法 {0} 上更正泛型型別參數名稱 {2} 中 '{1}' 的拼字
+ 在方法 '{0}' 中,更正泛型型別參數名稱 '{2}' 中 '{1}' 的拼字
- 請考慮提供較組件名稱 {0} 更具意義的名稱
+ 請考慮提供較組件名稱 '{0}' 更具意義的名稱
@@ -89,32 +89,32 @@
- 請考慮提供較型別名稱 {0} 更具意義的名稱
+ 請考慮提供較型別名稱 '{0}' 更具意義的名稱
- 請考慮提供較成員名稱 {0} 更具意義的名稱
+ 請考慮提供較成員名稱 '{0}' 更具意義的名稱
- 請考慮在方法 {0} 中提供較參數名稱 {1} 更具意義的名稱
+ 請考慮在方法 '{0}' 中提供較參數名稱 '{1}' 更具意義的名稱
- 請考慮在委派 {0} 中提供較參數名稱 {1} 更具意義的名稱
+ 請考慮在委派 '{0}' 中提供較參數名稱 '{1}' 更具意義的名稱
- 請考慮在型別 {0} 上提供較泛型型別參數名稱 {1} 更具意義的名稱
+ 請考慮在型別 '{0}' 中提供較泛型型別參數名稱 '{1}' 更具意義的名稱
- 請考慮在方法 {0} 上提供較泛型型別參數名稱 {1} 更具意義的名稱
+ 請考慮在方法 '{0}' 中提供較泛型型別參數名稱 '{1}' 更具意義的名稱
diff --git a/src/Utilities.UnitTests/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysisTests.cs b/src/Utilities.UnitTests/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysisTests.cs
index 504bfeae5c..8f002b0748 100644
--- a/src/Utilities.UnitTests/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysisTests.cs
+++ b/src/Utilities.UnitTests/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysisTests.cs
@@ -241,7 +241,7 @@ public static void StaticMethod(TestTypeToTrack staticMethodParameter)
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
// With only one property being tracked, this is straightforward.
- return (abstractValue[0]) switch
+ return abstractValue[0] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
PropertySetAbstractValueKind.MaybeFlagged => HazardousUsageEvaluationResult.MaybeFlagged,
@@ -258,7 +258,7 @@ public static void StaticMethod(TestTypeToTrack staticMethodParameter)
// With only one property being tracked, this is straightforward.
- return (abstractValue[0]) switch
+ return abstractValue[0] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
PropertySetAbstractValueKind.MaybeFlagged => HazardousUsageEvaluationResult.MaybeFlagged,
@@ -275,7 +275,7 @@ public static void StaticMethod(TestTypeToTrack staticMethodParameter)
// With only one property being tracked, this is straightforward.
- return (abstractValue[0]) switch
+ return abstractValue[0] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
PropertySetAbstractValueKind.MaybeFlagged => HazardousUsageEvaluationResult.MaybeFlagged,
@@ -437,7 +437,7 @@ void TestMethod()
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
// With only one property being tracked, this is straightforward.
- return (abstractValue[0]) switch
+ return abstractValue[0] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
PropertySetAbstractValueKind.MaybeFlagged => HazardousUsageEvaluationResult.MaybeFlagged,
@@ -536,7 +536,7 @@ void TestMethod()
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
// With only one property being tracked, this is straightforward.
- return (abstractValue[0]) switch
+ return abstractValue[0] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
PropertySetAbstractValueKind.MaybeFlagged => HazardousUsageEvaluationResult.MaybeFlagged,
@@ -609,7 +609,7 @@ void TestMethod()
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
// With only one property being tracked, this is straightforward.
- return (abstractValue[0]) switch
+ return abstractValue[0] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
PropertySetAbstractValueKind.MaybeFlagged => HazardousUsageEvaluationResult.MaybeFlagged,
@@ -869,7 +869,7 @@ void TestMethod()
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
// With only one property being tracked, this is straightforward.
- return (abstractValue[0]) switch
+ return abstractValue[0] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
PropertySetAbstractValueKind.MaybeFlagged => HazardousUsageEvaluationResult.MaybeFlagged,
@@ -973,7 +973,7 @@ void TestMethod()
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
// With only one property being tracked, this is straightforward.
- return (abstractValue[0]) switch
+ return abstractValue[0] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
PropertySetAbstractValueKind.MaybeFlagged => HazardousUsageEvaluationResult.MaybeFlagged,
@@ -1053,7 +1053,7 @@ TestTypeToTrackWithConstructor GetTestType()
(PropertySetAbstractValue abstractValue) =>
{
// With only one property being tracked, this is straightforward.
- return (abstractValue[0]) switch
+ return abstractValue[0] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
PropertySetAbstractValueKind.MaybeFlagged => HazardousUsageEvaluationResult.MaybeFlagged,
@@ -1173,7 +1173,7 @@ object TestMethod()
// When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments.
// With only underlying value (from the two "aliased" properties) being tracked, this is straightforward.
- return (abstractValue[0]) switch
+ return abstractValue[0] switch
{
PropertySetAbstractValueKind.Flagged => HazardousUsageEvaluationResult.Flagged,
PropertySetAbstractValueKind.MaybeFlagged => HazardousUsageEvaluationResult.MaybeFlagged,
diff --git a/src/Utilities/Compiler/CodeMetrics/CodeAnalysisMetricData.cs b/src/Utilities/Compiler/CodeMetrics/CodeAnalysisMetricData.cs
index 0d9aae3776..30b5572b95 100644
--- a/src/Utilities/Compiler/CodeMetrics/CodeAnalysisMetricData.cs
+++ b/src/Utilities/Compiler/CodeMetrics/CodeAnalysisMetricData.cs
@@ -162,7 +162,7 @@ public sealed override string ToString()
builder.Append($", DepthInherit: {DepthOfInheritance}");
}
- builder.Append($")");
+ builder.Append(')');
appendChildren(indent: " ");
return builder.ToString();
diff --git a/src/Utilities/Compiler/Lightup/LightupHelpers.cs b/src/Utilities/Compiler/Lightup/LightupHelpers.cs
index b88585f7d9..8d02857b30 100644
--- a/src/Utilities/Compiler/Lightup/LightupHelpers.cs
+++ b/src/Utilities/Compiler/Lightup/LightupHelpers.cs
@@ -63,7 +63,7 @@ private static Func CreatePropertyAccessor(Type? typ
var parameter = Expression.Parameter(typeof(T), parameterName);
Expression instance =
type.GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo())
- ? (Expression)parameter
+ ? parameter
: Expression.Convert(parameter, type);
Expression result = Expression.Call(instance, property.GetMethod);
@@ -115,11 +115,11 @@ private static Func CreateWithPropertyAccessor(Ty
var valueParameter = Expression.Parameter(typeof(TProperty), methodInfo.GetParameters()[0].Name);
Expression instance =
type.GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo())
- ? (Expression)parameter
+ ? parameter
: Expression.Convert(parameter, type);
Expression value =
property.PropertyType.GetTypeInfo().IsAssignableFrom(typeof(TProperty).GetTypeInfo())
- ? (Expression)valueParameter
+ ? valueParameter
: Expression.Convert(valueParameter, property.PropertyType);
Expression> expression =
@@ -159,11 +159,11 @@ internal static Func CreateAccessorWithArgument : IEnumerable>
where K : notnull
{
private AvlNode? _root;
-
public readonly IEqualityComparer Comparer;
// https://github.com/dotnet/roslyn/issues/40344
@@ -210,7 +209,7 @@ public V this[K key]
public bool ContainsKey(K key)
{
- return TryGetValue(key, out V _);
+ return TryGetValue(key, out _);
}
#pragma warning disable CA1822
@@ -623,9 +622,9 @@ public KeyCollection(SmallDictionary dict)
public struct Enumerator
{
- private readonly Stack _stack;
+ private readonly Stack? _stack;
private Node? _next;
- private Node _current;
+ private Node? _current;
public Enumerator(SmallDictionary dict)
: this()
@@ -646,7 +645,7 @@ public Enumerator(SmallDictionary dict)
}
}
- public K Current => _current.Key;
+ public K Current => _current!.Key;
public bool MoveNext()
{
@@ -676,7 +675,7 @@ private void PushIfNotNull(AvlNode? child)
{
if (child != null)
{
- _stack.Push(child);
+ _stack!.Push(child);
}
}
}
@@ -739,9 +738,9 @@ public ValueCollection(SmallDictionary dict)
public struct Enumerator
{
- private readonly Stack _stack;
+ private readonly Stack? _stack;
private Node? _next;
- private Node _current;
+ private Node? _current;
public Enumerator(SmallDictionary dict)
: this()
@@ -764,7 +763,7 @@ public Enumerator(SmallDictionary dict)
}
}
- public V Current => _current.Value;
+ public V Current => _current!.Value;
public bool MoveNext()
{
@@ -794,7 +793,7 @@ private void PushIfNotNull(AvlNode? child)
{
if (child != null)
{
- _stack.Push(child);
+ _stack!.Push(child);
}
}
}
@@ -845,9 +844,9 @@ IEnumerator IEnumerable.GetEnumerator()
public struct Enumerator
{
- private readonly Stack _stack;
+ private readonly Stack? _stack;
private Node? _next;
- private Node _current;
+ private Node? _current;
public Enumerator(SmallDictionary dict)
: this()
@@ -870,7 +869,7 @@ public Enumerator(SmallDictionary dict)
}
}
- public KeyValuePair Current => new(_current.Key, _current.Value);
+ public KeyValuePair Current => new(_current!.Key, _current!.Value);
public bool MoveNext()
{
@@ -900,7 +899,7 @@ private void PushIfNotNull(AvlNode? child)
{
if (child != null)
{
- _stack.Push(child);
+ _stack!.Push(child);
}
}
}
diff --git a/src/Utilities/Compiler/SymbolDisplayStringCache.cs b/src/Utilities/Compiler/SymbolDisplayStringCache.cs
index 8dea13c788..b6ba262d12 100644
--- a/src/Utilities/Compiler/SymbolDisplayStringCache.cs
+++ b/src/Utilities/Compiler/SymbolDisplayStringCache.cs
@@ -19,7 +19,7 @@ internal sealed class SymbolDisplayStringCache
///
/// ConcurrentDictionary key for a null SymbolDisplayFormat.
///
- private static readonly SymbolDisplayFormat NullSymbolDisplayFormat = new SymbolDisplayFormat();
+ private static readonly SymbolDisplayFormat NullSymbolDisplayFormat = new();
///
/// Mapping of a symbol to its ToDisplayString().
diff --git a/src/Utilities/FlowAnalysis/FlowAnalysis/Analysis/GlobalFlowStateAnalysis/GlobalFlowStateAnalysisValueSet.cs b/src/Utilities/FlowAnalysis/FlowAnalysis/Analysis/GlobalFlowStateAnalysis/GlobalFlowStateAnalysisValueSet.cs
index c5fd97f54f..d32cd504d7 100644
--- a/src/Utilities/FlowAnalysis/FlowAnalysis/Analysis/GlobalFlowStateAnalysis/GlobalFlowStateAnalysisValueSet.cs
+++ b/src/Utilities/FlowAnalysis/FlowAnalysis/Analysis/GlobalFlowStateAnalysis/GlobalFlowStateAnalysisValueSet.cs
@@ -14,11 +14,11 @@ namespace Microsoft.CodeAnalysis.FlowAnalysis.DataFlow.GlobalFlowStateAnalysis
{
internal sealed class GlobalFlowStateAnalysisValueSet : CacheBasedEquatable
{
- public static readonly GlobalFlowStateAnalysisValueSet Unset = new GlobalFlowStateAnalysisValueSet(
+ public static readonly GlobalFlowStateAnalysisValueSet Unset = new(
ImmutableHashSet.Empty, ImmutableHashSet.Empty, 0, GlobalFlowStateAnalysisValueSetKind.Unset);
- public static readonly GlobalFlowStateAnalysisValueSet Empty = new GlobalFlowStateAnalysisValueSet(
+ public static readonly GlobalFlowStateAnalysisValueSet Empty = new(
ImmutableHashSet.Empty, ImmutableHashSet.Empty, 0, GlobalFlowStateAnalysisValueSetKind.Empty);
- public static readonly GlobalFlowStateAnalysisValueSet Unknown = new GlobalFlowStateAnalysisValueSet(
+ public static readonly GlobalFlowStateAnalysisValueSet Unknown = new(
ImmutableHashSet.Empty, ImmutableHashSet.Empty, 0, GlobalFlowStateAnalysisValueSetKind.Unknown);
private GlobalFlowStateAnalysisValueSet(
diff --git a/src/Utilities/FlowAnalysis/FlowAnalysis/Analysis/ValueContentAnalysis/ValueContentAnalysis.ValueContentDataFlowOperationVisitor.cs b/src/Utilities/FlowAnalysis/FlowAnalysis/Analysis/ValueContentAnalysis/ValueContentAnalysis.ValueContentDataFlowOperationVisitor.cs
index 64236b89f4..85ff1114b2 100644
--- a/src/Utilities/FlowAnalysis/FlowAnalysis/Analysis/ValueContentAnalysis/ValueContentAnalysis.ValueContentDataFlowOperationVisitor.cs
+++ b/src/Utilities/FlowAnalysis/FlowAnalysis/Analysis/ValueContentAnalysis/ValueContentAnalysis.ValueContentDataFlowOperationVisitor.cs
@@ -192,7 +192,7 @@ public override ValueContentAbstractValue DefaultVisit(IOperation operation, obj
}
else
{
- return (GetNullAbstractValue(operation)) switch
+ return GetNullAbstractValue(operation) switch
{
PointsToAnalysis.NullAbstractValue.Invalid => ValueContentAbstractValue.InvalidState,
diff --git a/src/Utilities/FlowAnalysis/FlowAnalysis/Framework/DataFlow/DataFlowOperationVisitor.cs b/src/Utilities/FlowAnalysis/FlowAnalysis/Framework/DataFlow/DataFlowOperationVisitor.cs
index d8fc5744aa..519523f91a 100644
--- a/src/Utilities/FlowAnalysis/FlowAnalysis/Framework/DataFlow/DataFlowOperationVisitor.cs
+++ b/src/Utilities/FlowAnalysis/FlowAnalysis/Framework/DataFlow/DataFlowOperationVisitor.cs
@@ -321,7 +321,7 @@ protected DataFlowOperationVisitor(TAnalysisContext analysisContext)
DataFlowAnalysisContext.WellKnownTypeProvider,
getPointsToAbstractValue: HasPointsToAnalysisResult ?
GetPointsToAbstractValue :
- (Func?)null,
+ null,
getIsInsideAnonymousObjectInitializer: () => IsInsideAnonymousObjectInitializer,
getIsLValueFlowCapture: IsLValueFlowCapture,
containingTypeSymbol: analysisContext.OwningSymbol.ContainingType,