Skip to content

dimitrietataru/csharp-coding-standards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

C# Coding Standards

An opinionated C# .editorconfig
Compatible with Visual Studio 2022, and 2019*.

Table of contents

Visual Studio options

Advanced | Using directives

Description _________________________________________________________________________ Value
Place System directives first when sorting usings ☐
Separate using directive groups ☐
.editorconfig
dotnet_sort_system_directives_first = false
dotnet_separate_import_directive_groups = false

Code Style | General | this. preferences

Description _______________________________________________ Code Preference ____________ !! Severity !!
Qualify field access with this. IDE0003 Do not prefer this ⚠ Warning
Qualify property access with this. IDE0003 Do not prefer this ⚠ Warning
Qualify method access with this. IDE0003 Do not prefer this ⚠ Warning
Qualify event access with this. IDE0003 Do not prefer this ⚠ Warning
.editorconfig
dotnet_style_qualification_for_event = false:warning
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_property = false:warning

Code Style | General | Predefined type preferences

Description _______________________________________________ Code Preference ____________ !! Severity !!
For locals, parameters, and members IDE0049 Prefer predefined type ⚠ Warning
For member access expressions IDE0049 Prefer predefined type ⚠ Warning
.editorconfig
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
dotnet_style_predefined_type_for_member_access = true:warning

Code Style | General | var preferences

Description _______________________________________________ Code Preference ____________ !! Severity !!
For built-in types IDE0008 Prefer explicit type πŸ›ˆ Suggestion
When variable type is apparent IDE0007 Prefer var ⚠ Warning
Elsewhere IDE0007 Prefer var πŸ›ˆ Suggestion
.editorconfig
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = true:warning
csharp_style_var_elsewhere = true:suggestion

Code Style | General | Code block preferences

Description _______________________________________________ Code Preference ____________ !! Severity !!
Prefer braces IDE0011 Yes ⚠ Warning
Prefer auto properties IDE0032 Yes πŸž… Refactoring
Prefer simple using statement IDE0063 Yes πŸ›ˆ Suggestion
Prefer System.HashCode in 'GetHashCode' IDE0070 Yes πŸ›ˆ Suggestion
Namespace declarations IDE0161 File scoped πŸ›ˆ Suggestion
Prefer method group conversion IDE0200 Yes πŸ›ˆ Suggestion
Prefer top-level statements IDE0210 Yes πŸ›ˆ Suggestion
Prefer primary constructors IDE0290 No ⚠ Warning
.editorconfig
csharp_prefer_braces = true:warning
dotnet_style_prefer_auto_properties = true:silent
csharp_prefer_simple_using_statement = true:suggestion
# Missing: Prefer _System.HashCode_ in 'GetHashCode'
csharp_style_namespace_declarations = file_scoped:suggestion
csharp_style_prefer_method_group_conversion = true:suggestion
csharp_style_prefer_top_level_statements = true:suggestion
csharp_style_prefer_primary_constructors = false:warning

Code Style | General | Parentheses preferences

Description _______________________________________________ Code Preference ____________ !! Severity !!
In arithmetic operators: * / % + - << >> & ^ IDE0048 Always for clarity πŸ›ˆ Suggestion
In other binary operators: && ?? and or IDE0048 Always for clarity πŸ›ˆ Suggestion
In relational operators: < > <= >= is as == != IDE0048 Always for clarity πŸ›ˆ Suggestion
In other operators IDE0047 Never if unnecessary ⚠ Warning
.editorconfig
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning

Code Style | General | Expression preferences

Description _______________________________________________ Code Preference ____________ !! Severity !!
Prefer object initializer IDE0017 Yes πŸ›ˆ Suggestion
Prefer collection initializer IDE0028 Yes πŸ›ˆ Suggestion
Prefer explicit tuple name IDE0033 Yes πŸ›ˆ Suggestion
Prefer simple 'default' expression IDE0034 Yes ⚠ Warning
Prefer inferred tuple element names IDE0037 No πŸ›ˆ Suggestion
Prefer inferred anonymous type member names IDE0037 Yes πŸž… Refactoring
Prefer local function over anonymous function IDE0039 Yes ⚠ Warning
Prefer conditional expression over if with assignments IDE0045 Yes πŸž… Refactoring
Prefer conditional expression over if with returns IDE0046 No πŸž… Refactoring
Prefer compound assignments IDE0054 Yes ⚠ Warning
Prefer index operator IDE0056 Yes πŸ›ˆ Suggestion
Prefer range operator IDE0057 Yes πŸ›ˆ Suggestion
Avoid expression statements that implicitly ignore value IDE0058 Discard πŸž… Refactoring
Avoid unused value assignments IDE0059 Discard πŸž… Refactoring
Prefer switch expression IDE0066 Yes πŸ›ˆ Suggestion
Prefer simplified interpolation IDE0071 Yes ⚠ Warning
Prefer simplified boolean expressions IDE0075 Yes ⚠ Warning
Prefer implicit object creation when type is aparent IDE0090 Yes πŸ›ˆ Suggestion
Prefer namespace and folder match structure IDE0130 Yes πŸ›ˆ Suggestion
Prefer tuple swap IDE0180 Yes πŸ›ˆ Suggestion
Prefer UTF-8 string literals IDE0230 Yes πŸ›ˆ Suggestion
Prefer collection expression IDE0300 Yes πŸ›ˆ Suggestion
Operator placement when wrapping Beginning of line
.editorconfig
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
csharp_prefer_simple_default_expression = true:warning
dotnet_style_prefer_inferred_tuple_names = false:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = false:suggestion
csharp_style_prefer_local_over_anonymous_function = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = false:silent
dotnet_style_prefer_compound_assignment = true:warning
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_style_unused_value_assignment_preference = discard_variable:silent
csharp_style_prefer_switch_expression = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:warning
dotnet_style_prefer_simplified_boolean_expressions = true:warning
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
dotnet_style_namespace_match_folder = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
dotnet_style_prefer_collection_expression = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line

Code Style | General | Expression-bodied members

Description _______________________________________________ Code Preference ____________ !! Severity !!
Use expression body for constructors IDE0021 Never πŸž… Refactoring
Use expression body for methods IDE0022 Never πŸž… Refactoring
Use expression body for operators IDE0024 Never πŸž… Refactoring
Use expression body for properties IDE0025 When possible πŸ›ˆ Suggestion
Use expression body for indexers IDE0026 When possible πŸ›ˆ Suggestion
Use expression body for accessors IDE0027 When possible πŸ›ˆ Suggestion
Use expression body for lambdas IDE0053 When possible πŸž… Refactoring
Use expression body for local functions IDE0061 Never πŸ›ˆ Suggestion
.editorconfig
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_indexers = true:suggestion
csharp_style_expression_bodied_accessors = true:suggestion
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:suggestion

Code Style | General | Pattern matching preferences

Description _______________________________________________ Code Preference ____________ !! Severity !!
Prefer pattern matching IDE0078 Yes πŸ›ˆ Suggestion
Prefer pattern matching over as with null check IDE0019 Yes ⚠ Warning
Prefer pattern matching over is with cast check IDE0020 Yes ⚠ Warning
Prefer pattern matching over mixed type check IDE0083 Yes ⚠ Warning
Prefer extended property pattern IDE0170 Yes ⚠ Warning
.editorconfig
csharp_style_prefer_pattern_matching = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:warning
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
csharp_style_prefer_not_pattern = true:warning
csharp_style_prefer_extended_property_pattern = true:warning

Code Style | General | Variable preferences

Description _______________________________________________ Code Preference ____________ !! Severity !!
Prefer inlined variable declaration IDE0018 Yes ⚠ Warning
Prefer deconstructed variable declaration IDE0042 Yes πŸ›ˆ Suggestion
.editorconfig
csharp_style_inlined_variable_declaration = true:warning
csharp_style_deconstructed_variable_declaration = true:suggestion

Code Style | General | null checking

Description _______________________________________________ Code Preference ____________ !! Severity !!
Prefer throw-expression IDE0016 Yes πŸ›ˆ Suggestion
Prefer coalesce expression IDE0029 Yes ⚠ Warning
Prefer null propagation IDE0031 Yes ⚠ Warning
Prefer is null for reference equality checks IDE0041 Yes ⚠ Warning
Prefer null check over type check IDE0150 Yes πŸ›ˆ Suggestion
Prefer conditional delegate call IDE1005 Yes πŸ›ˆ Suggestion
.editorconfig
csharp_style_throw_expression = true:suggestion
dotnet_style_coalesce_expression = true:warning
dotnet_style_null_propagation = true:warning
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

Code Style | General | using preferences

Description _______________________________________________ Code Preference ____________ !! Severity !!
Preferred using directive placement IDE0065 Outside namespace β›” Error
.editorconfig
csharp_using_directive_placement = outside_namespace:error

Code Style | General | Modifier preferences

Description _______________________________________________ Code Preference ____________ !! Severity !!
Require accesibility modifiers IDE0040 Yes ⚠ Warning
Prefer readonly fields IDE0044 Yes ⚠ Warning
Prefer static local functions IDE0062 Yes ⚠ Warning
Prefer readonly struct IDE0250 Yes πŸ›ˆ Suggestion
Prefer readonly struct member IDE0251 Yes πŸ›ˆ Suggestion
.editorconfig
dotnet_style_require_accessibility_modifiers = true:warning
dotnet_style_readonly_field = true:warning
csharp_prefer_static_local_function = true:warning
csharp_style_prefer_readonly_struct = true:suggestion
csharp_style_prefer_readonly_struct_member = true:suggestion

Code Style | General | Parameter preferences

Description _______________________________________________ Code Preference ____________ !! Severity !!
Avoid unused parameters IDE0060 Non-public methods ⚠ Warning
.editorconfig
dotnet_code_quality_unused_parameters = non_public:warning

Code Style | General | New line preferences

Description _______________________________________________ Code Preference ____________ !! Severity !!
Allow multiple blank lines IDE2000 No ⚠ Warning
Allow embeded statements on same line IDE2001 No ⚠ Warning
Allow blank lines between consecutive braces IDE2002 No ⚠ Warning
Allow statement immediately after block IDE2003 No ⚠ Warning
Allow blank line after colon in constructor initializer IDE2004 No β›” Error
Allow blank line after token in conditional expression IDE2005 No β›” Error
Allow blank line after token in arrow expression clause IDE2006 Yes πŸ›ˆ Suggestion
.editorconfig
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
csharp_style_allow_embedded_statements_on_same_line_experimental = false:warning
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:warning
dotnet_style_allow_statement_immediately_after_block_experimental = false:warning
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false:error
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false:error
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:suggestion

Code Style | Formatting | General

Description _________________________________________________________________________ Value
Automatically format when typing πŸ—Ή
Automatically format statement on ; πŸ—Ή
Automatically format block on } πŸ—Ή
Automatically format on return πŸ—Ή
Automatically format on paste πŸ—Ή
.editorconfig
# Configurable at VS level

Code Style | Formatting | Indentation | General

Description _________________________________________________________________________ Value
Indent code blocks πŸ—Ή
Indent open and close braces ☐
Indent case contents πŸ—Ή
Indent case contents (when block) ☐
Indent case labels πŸ—Ή
.editorconfig
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = false
csharp_indent_switch_labels = true

Code Style | Formatting | Indentation | Label Indentation

Description _________________________________________________________________________ Value
Place goto labels in leftmost column ☐
Indent labels normally ☐
Place goto labels one indent less than content πŸ—Ή
.editorconfig
csharp_indent_labels = one_less_than_current

Code Style | Formatting | New Lines | New line options for braces

Description _________________________________________________________________________ Value
Place open brace on new line for types πŸ—Ή
Place open brace on new line for methods and local functions πŸ—Ή
Place open brace on new line for properties, indexers, and events πŸ—Ή
Place open brace on new line for property, indexer, and event accessors πŸ—Ή
Place open brace on new line for anonymous methods πŸ—Ή
Place open brace on new line for control blocks πŸ—Ή
Place open brace on new line for anonymous types πŸ—Ή
Place open brace on new line for object, collection, array, and with initializers πŸ—Ή
Place open brace on new line for lambda expression πŸ—Ή
.editorconfig
csharp_new_line_before_open_brace = all

Code Style | Formatting | New Lines | New line options for keywords

Description _________________________________________________________________________ Value
Place else on new line πŸ—Ή
Place catch on new line πŸ—Ή
Place finally on new line πŸ—Ή
.editorconfig
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true

Code Style | Formatting | New Lines | New line options for expressions

Description _________________________________________________________________________ Value
Place members in object initializers on new line πŸ—Ή
Place members in anonymous types on new line πŸ—Ή
Place query expression clauses on new line πŸ—Ή
.editorconfig
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true

Code Style | Formatting | Spacing | Set spacing for method declarations

Description _________________________________________________________________________ Value
Insert space between method name and its opening parenthesis ☐
Insert space within parameter list parentheses ☐
Insert space within empty parameter list parentheses ☐
.editorconfig
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false

Code Style | Formatting | Spacing | Set spacing for method calls

Description _________________________________________________________________________ Value
Insert space between method name and its opening parenthesis ☐
Insert space within argument list parentheses ☐
Insert space within empty argument list parentheses ☐
.editorconfig
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false

Code Style | Formatting | Spacing | Set other spacing options

Description _________________________________________________________________________ Value
Insert space after keywords in control flow statements πŸ—Ή
Insert space within parentheses of expressions ☐
Insert space within parentheses of type casts ☐
Insert space within parentheses of control flow statements ☐
Insert space after cast ☐
Insert space in declaration statements ☐
.editorconfig
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_parentheses = false
csharp_space_after_cast = false
csharp_space_around_declaration_statements = false

Code Style | Formatting | Spacing | Set spacing for brackets

Description _________________________________________________________________________ Value
Insert space before open square bracket ☐
Insert space within empty square brackets ☐
Insert space within square brackets ☐
.editorconfig
csharp_space_before_open_square_brackets = false
csharp_space_between_square_brackets = false
csharp_space_between_empty_square_brackets = false

Code Style | Formatting | Spacing | Set spacing for delimiters

Description _________________________________________________________________________ Value
Insert space before colon for base or interface in type declarations πŸ—Ή
Insert space after colon for base or interface in type declarations πŸ—Ή
Insert space before comma ☐
Insert space after comma πŸ—Ή
Insert space before dot ☐
Insert space after dot ☐
Insert space before semicolon in for statement ☐
Insert space after semicolon in for statement πŸ—Ή
.editorconfig
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_after_comma = true
csharp_space_before_dot = false
csharp_space_after_dot = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_after_semicolon_in_for_statement = true

Code Style | Formatting | Spacing | Set spacing for operators

Description _________________________________________________________________________ Value
Ignore spaces around binary operators ☐
Remove spaces before and after binary operators ☐
Insert space before and after binary operators πŸ—Ή
.editorconfig
csharp_space_around_binary_operators = before_and_after

Code Style | Formatting | Wrapping

Description _________________________________________________________________________ Value
Leave block on single line πŸ—Ή
Leave statements and member declarations on the same line ☐
.editorconfig
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false

Microsoft.CodeAnalysis.NetAnalyzers

Microsoft.CodeAnalysis.NetAnalyzers | Design

Code Description ___________________________________________________________________________ !! Severity !!
CA1000 Do not declare static members on generic types ⚠ Warning
CA1001 Types that own disposable fields should be disposable ⚠ Warning
CA1002 Do not expose generic lists ⚠ Warning
CA1003 Use generic event handler instances πŸž… None
CA1005 Avoid excessive parameters on generic types ⚠ Warning
CA1008 Enums should have zero value ⚠ Warning
CA1010 Collections should implement generic interface πŸ›ˆ Suggestion
CA1012 Abstract types should not have public constructors ⚠ Warning
CA1014 Mark assemblies with CLSCompliantAttribute πŸž… None
CA1016 Mark assemblies with AssemblyVersionAttribute πŸž… None
CA1017 Mark assemblies with ComVisibleAttribute πŸž… None
CA1018 Mark attributes with AttributeUsageAttribute ⚠ Warning
CA1019 Define accessors for attribute arguments πŸ›ˆ Suggestion
CA1021 Avoid out parameters πŸ›ˆ Suggestion
CA1024 Use properties where appropriate πŸ›ˆ Suggestion
CA1027 Mark enums with FlagsAttribute πŸ›ˆ Suggestion
CA1028 Enum storage should be Int32 ⚠ Warning
CA1030 Use events where appropriate πŸž… None
CA1031 Do not catch general exception types πŸ›ˆ Suggestion
CA1032 Implement standard exception constructors ⚠ Warning
CA1033 Interface methods should be callable by child types ⚠ Warning
CA1034 Nested types should not be visible ⚠ Warning
CA1036 Override methods on comparable types πŸ›ˆ Suggestion
CA1040 Avoid empty interfaces πŸž… None
CA1041 Provide ObsoleteAttribute message β›” Error
CA1043 Use integral or string argument for indexers ⚠ Warning
CA1044 Properties should not be write only πŸž… None
CA1045 Do not pass types by reference ⚠ Warning
CA1046 Do not overload operator equals on reference types ⚠ Warning
CA1047 Do not declare protected members in sealed types πŸž… None
CA1050 Declare types in namespaces ⚠ Warning
CA1051 Do not declare visible instance fields πŸž… None
CA1052 Static holder types should be Static or NotInheritable β›” Error
CA1053 Static holder types should not have default constructors -
CA1054 URI parameters should not be strings ⚠ Warning
CA1055 URI return values should not be strings ⚠ Warning
CA1056 URI properties should not be strings ⚠ Warning
CA1058 Types should not extend certain base types ⚠ Warning
CA1060 Move P/Invokes to NativeMethods class πŸž… None
CA1061 Do not hide base class methods ⚠ Warning
CA1062 Validate arguments of public methods πŸž… None
CA1063 Implement IDisposable correctly ⚠ Warning
CA1064 Exceptions should be public β›” Error
CA1065 Do not raise exceptions in unexpected locations β›” Error
CA1066 Implement IEquatable when overriding Equals ⚠ Warning
CA1067 Override Equals when implementing IEquatable ⚠ Warning
CA1068 CancellationToken parameters must come last ⚠ Warning
CA1069 Enums should not have duplicate values ⚠ Warning
CA1070 Do not declare event fields as virtual πŸ›ˆ Suggestion
.editorconfig
dotnet_diagnostic.CA1000.severity = warning
dotnet_diagnostic.CA1001.severity = warning
dotnet_diagnostic.CA1002.severity = warning
dotnet_diagnostic.CA1003.severity = none
dotnet_diagnostic.CA1005.severity = warning
dotnet_diagnostic.CA1008.severity = warning
dotnet_diagnostic.CA1010.severity = suggestion
dotnet_diagnostic.CA1012.severity = warning
dotnet_diagnostic.CA1014.severity = none
dotnet_diagnostic.CA1016.severity = none
dotnet_diagnostic.CA1017.severity = none
dotnet_diagnostic.CA1018.severity = warning
dotnet_diagnostic.CA1019.severity = suggestion
dotnet_diagnostic.CA1021.severity = suggestion
dotnet_diagnostic.CA1024.severity = suggestion
dotnet_diagnostic.CA1027.severity = suggestion
dotnet_diagnostic.CA1028.severity = warning
dotnet_diagnostic.CA1030.severity = none
dotnet_diagnostic.CA1031.severity = suggestion
dotnet_diagnostic.CA1032.severity = warning
dotnet_diagnostic.CA1033.severity = warning
dotnet_diagnostic.CA1034.severity = warning
dotnet_diagnostic.CA1036.severity = suggestion
dotnet_diagnostic.CA1040.severity = none
dotnet_diagnostic.CA1041.severity = error
dotnet_diagnostic.CA1043.severity = warning
dotnet_diagnostic.CA1044.severity = none
dotnet_diagnostic.CA1045.severity = warning
dotnet_diagnostic.CA1046.severity = warning
dotnet_diagnostic.CA1047.severity = none
dotnet_diagnostic.CA1050.severity = warning
dotnet_diagnostic.CA1051.severity = error
dotnet_diagnostic.CA1052.severity = error
#dotnet_diagnostic.CA1053.severity = warning
dotnet_diagnostic.CA1054.severity = warning
dotnet_diagnostic.CA1055.severity = warning
dotnet_diagnostic.CA1056.severity = warning
dotnet_diagnostic.CA1058.severity = warning
dotnet_diagnostic.CA1060.severity = none
dotnet_diagnostic.CA1061.severity = warning
dotnet_diagnostic.CA1062.severity = none
dotnet_diagnostic.CA1063.severity = warning
dotnet_diagnostic.CA1064.severity = error
dotnet_diagnostic.CA1065.severity = error
dotnet_diagnostic.CA1066.severity = warning
dotnet_diagnostic.CA1067.severity = warning
dotnet_diagnostic.CA1068.severity = warning
dotnet_diagnostic.CA1069.severity = warning
dotnet_diagnostic.CA1070.severity = suggestion

Microsoft.CodeAnalysis.NetAnalyzers | Documentation

Code Description ___________________________________________________________________________ !! Severity !!
CA1200 Avoid using cref tags with a prefix πŸž… None
.editorconfig
dotnet_diagnostic.CA1200.severity = none

Microsoft.CodeAnalysis.NetAnalyzers | Globalization

Code Description ___________________________________________________________________________ !! Severity !!
CA1303 Do not pass literals as localized parameters ⚠ Warning
CA1304 Specify CultureInfo ⚠ Warning
CA1305 Specify IFormatProvider ⚠ Warning
CA1307 Specify StringComparison for clarity ⚠ Warning
CA1308 Normalize strings to uppercase πŸ›ˆ Suggestion
CA1309 Use ordinal StringComparison ⚠ Warning
CA1310 Specify StringComparison for correctness ⚠ Warning
CA1311 Specify a culture or use an invariant version ⚠ Warning
CA2101 Specify marshalling for P/Invoke string arguments πŸ›ˆ Suggestion
.editorconfig
dotnet_diagnostic.CA1303.severity = warning
dotnet_diagnostic.CA1304.severity = warning
dotnet_diagnostic.CA1305.severity = warning
dotnet_diagnostic.CA1307.severity = warning
dotnet_diagnostic.CA1308.severity = suggestion
dotnet_diagnostic.CA1309.severity = warning
dotnet_diagnostic.CA1310.severity = warning
dotnet_diagnostic.CA1311.severity = warning
dotnet_diagnostic.CA2101.severity = suggestion

Microsoft.CodeAnalysis.NetAnalyzers | Interoperability

Code Description ___________________________________________________________________________ !! Severity !!
CA1401 P/Invokes should not be visible πŸ›ˆ Suggestion
CA1416 Validate platform compatibility ⚠ Warning
CA1417 Do not use OutAttribute on string parameters for P/Invokes ⚠ Warning
CA1418 Validate platform compatibility ⚠ Warning
CA1419 Provide a parameterless ctor for types derived from
System.Runtime.InteropServices.SafeHandle
πŸ›ˆ Suggestion
CA1420 Property, type, or attribute requires runtime marshalling ⚠ Warning
CA1421 Method uses runtime marshalling when DisableRuntimeMarshalling is applied πŸ›ˆ Suggestion
CA1422 Validate platform compatibility - Obsoleted APIs ⚠ Warning
.editorconfig
dotnet_diagnostic.CA1401.severity = suggestion
dotnet_diagnostic.CA1416.severity = warning
dotnet_diagnostic.CA1417.severity = warning
dotnet_diagnostic.CA1418.severity = warning
dotnet_diagnostic.CA1419.severity = suggestion
dotnet_diagnostic.CA1420.severity = warning
dotnet_diagnostic.CA1421.severity = suggestion
dotnet_diagnostic.CA1422.severity = warning

Microsoft.CodeAnalysis.NetAnalyzers | Maintainability

Code Description ___________________________________________________________________________ !! Severity !!
CA1501 Avoid excessive inheritance ⚠ Warning
CA1502 Avoid excessive complexity ⚠ Warning
CA1505 Avoid unmaintainable code ⚠ Warning
CA1506 Avoid excessive class coupling ⚠ Warning
CA1507 Use nameof in place of string ⚠ Warning
CA1508 Avoid dead conditional code ⚠ Warning
CA1509 Invalid entry in code metrics configuration file β›” Error
CA1510 Use ArgumentNullException throw helper ⚠ Warning
CA1511 Use ArgumentException throw helper ⚠ Warning
CA1512 Use ArgumentOutOfRangeException throw helper ⚠ Warning
CA1513 Use ObjectDisposedException throw helper ⚠ Warning
.editorconfig
dotnet_diagnostic.CA1501.severity = warning
dotnet_diagnostic.CA1502.severity = warning
dotnet_diagnostic.CA1505.severity = warning
dotnet_diagnostic.CA1506.severity = warning
dotnet_diagnostic.CA1507.severity = warning
dotnet_diagnostic.CA1508.severity = warning
dotnet_diagnostic.CA1509.severity = error
dotnet_diagnostic.CA1510.severity = warning
dotnet_diagnostic.CA1511.severity = warning
dotnet_diagnostic.CA1512.severity = warning
dotnet_diagnostic.CA1513.severity = warning

Microsoft.CodeAnalysis.NetAnalyzers | Naming

Code Description ___________________________________________________________________________ !! Severity !!
CA1700 Do not name enum values Reserved πŸ›ˆ Suggestion
CA1707 Identifiers should not contain underscores β›” Error
CA1708 Identifiers should differ by more than case πŸ›ˆ Suggestion
CA1710 Identifiers should have correct suffix ⚠ Warning
CA1711 Identifiers should not have incorrect suffix ⚠ Warning
CA1712 Do not prefix enum values with type name β›” Error
CA1713 Events should not have before or after prefix ⚠ Warning
CA1714 Flags enums should have plural names ⚠ Warning
CA1715 Identifiers should have correct prefix ⚠ Warning
CA1716 Identifiers should not match keywords ⚠ Warning
CA1717 Only FlagsAttribute enums should have plural names πŸ›ˆ Suggestion
CA1721 Property names should not match get methods ⚠ Warning
CA1720 Identifiers should not contain type names ⚠ Warning
CA1724 Type names should not match namespaces ⚠ Warning
CA1725 Parameter names should match base declaration ⚠ Warning
CA1727 Use PascalCase for named placeholders ⚠ Warning
.editorconfig
dotnet_diagnostic.CA1700.severity = suggestion
dotnet_diagnostic.CA1707.severity = error
dotnet_diagnostic.CA1708.severity = suggestion
dotnet_diagnostic.CA1710.severity = warning
dotnet_diagnostic.CA1711.severity = warning
dotnet_diagnostic.CA1712.severity = error
dotnet_diagnostic.CA1713.severity = warning
dotnet_diagnostic.CA1714.severity = warning
dotnet_diagnostic.CA1715.severity = warning
dotnet_diagnostic.CA1716.severity = warning
dotnet_diagnostic.CA1717.severity = suggestion
dotnet_diagnostic.CA1720.severity = warning
dotnet_diagnostic.CA1721.severity = warning
dotnet_diagnostic.CA1724.severity = warning
dotnet_diagnostic.CA1725.severity = warning
dotnet_diagnostic.CA1727.severity = warning

Microsoft.CodeAnalysis.NetAnalyzers | Performance

Code Description ___________________________________________________________________________ !! Severity !!
CA1802 Use literals where appropriate ⚠ Warning
CA1805 Do not initialize unnecessarily ⚠ Warning
CA1806 Do not ignore method results ⚠ Warning
CA1810 Initialize reference type static fields inline ⚠ Warning
CA1812 Avoid uninstantiated internal classes ⚠ Warning
CA1813 Avoid unsealed attributes β›” Error
CA1814 Prefer jagged arrays over multidimensional πŸ›ˆ Suggestion
CA1815 Override equals and operator equals on value types ⚠ Warning
CA1819 Properties should not return arrays ⚠ Warning
CA1820 Test for empty strings using string length ⚠ Warning
CA1821 Remove empty finalizers ⚠ Warning
CA1822 Mark members as static ⚠ Warning
CA1823 Avoid unused private fields ⚠ Warning
CA1824 Mark assemblies with NeutralResourcesLanguageAttribute πŸž… None
CA1825 Avoid zero-length array allocations ⚠ Warning
CA1826 Use property instead of Linq Enumerable method ⚠ Warning
CA1827 Do not use Count/LongCount when Any can be used ⚠ Warning
CA1828 Do not use CountAsync/LongCountAsync when AnyAsync can be used ⚠ Warning
CA1829 Use Length/Count property instead of Enumerable.Count method ⚠ Warning
CA1830 Prefer strongly-typed Append and Insert method overloads on StringBuilder ⚠ Warning
CA1831 Use AsSpan instead of Range-based indexers for string when appropriate πŸ›ˆ Suggestion
CA1832 Use AsSpan or AsMemory instead of Range-based indexers for getting
ReadOnlySpan or ReadOnlyMemory [..]
πŸ›ˆ Suggestion
CA1833 Use AsSpan or AsMemory instead of Range-based indexers for getting
Span or Memory [..]
πŸ›ˆ Suggestion
CA1834 Use StringBuilder.Append(char) for single character strings ⚠ Warning
CA1835 Prefer the memory-based overloads of ReadAsync/WriteAsync methods [..] πŸ›ˆ Suggestion
CA1836 Prefer IsEmpty over Count when available ⚠ Warning
CA1837 Use Environment.ProcessId instead of Process.GetCurrentProcess().Id πŸ›ˆ Suggestion
CA1838 Avoid StringBuilder parameters for P/Invokes πŸ›ˆ Suggestion
CA1839 Use Environment.ProcessPath [..] πŸ›ˆ Suggestion
CA1840 Use Environment.CurrentManagedThreadId [..] πŸ›ˆ Suggestion
CA1841 Prefer Dictionary Contains methods ⚠ Warning
CA1842 Do not use WhenAll with a single task β›” Error
CA1843 Do not use WaitAll with a single task β›” Error
CA1844 Provide memory-based overrides of async methods when subclassing Stream ⚠ Warning
CA1845 Use span-based string.Concat ⚠ Warning
CA1846 Prefer AsSpan over Substring ⚠ Warning
CA1847 Use string.Contains(char) instead of string.Contains(string) with single chars ⚠ Warning
CA1848 Use the LoggerMessage delegates πŸ›ˆ Suggestion
CA1849 Call async methods when in an async method ⚠ Warning
CA1850 Prefer static HashData method over ComputeHash πŸž… None
CA1851 Possible multiple enumerations of IEnumerable collection ⚠ Warning
CA1852 Seal internal types ⚠ Warning
CA1853 Unnecessary call to Dictionary.ContainsKey(key) ⚠ Warning
CA1854 Prefer the IDictionary.TryGetValue(TKey, out TValue) method πŸ›ˆ Suggestion
CA1855 Use Span[T].Clear() instead of Span[T].Fill() πŸ›ˆ Suggestion
CA1856 Incorrect usage of ConstantExpected attribute β›” Error
CA1857 The parameter expects a constant for optimal performance ⚠ Warning
CA1858 Use StartsWith instead of IndexOf ⚠ Warning
CA1859 Use concrete types when possible for improved performance πŸ›ˆ Suggestion
CA1860 Avoid using Enumerable.Any() extension method ⚠ Warning
CA1861 Avoid constant arrays as arguments ⚠ Warning
CA1862 Use the StringComparison method overloads for case-insensitive comparisons ⚠ Warning
CA1863 Use CompositeFormat πŸ›ˆ Suggestion
CA1864 Prefer the IDictionary.TryAdd(TKey, TValue) method ⚠ Warning
CA1865 Use string.Method(char) instead of string.Method(string) for string with one char ⚠ Warning
CA1866 Use string.Method(char) instead of string.Method(string) for string with one char ⚠ Warning
CA1867 Use string.Method(char) instead of string.Method(string) for string with one char πŸ›ˆ Suggestion
CA1868 Unnecessary call to Contains for sets ⚠ Warning
CA1869 Cache and reuse JsonSerializerOptions instances ⚠ Warning
CA1870 Use a cached SearchValues instance ⚠ Warning
.editorconfig
dotnet_diagnostic.CA1802.severity = warning
dotnet_diagnostic.CA1805.severity = warning
dotnet_diagnostic.CA1806.severity = warning
dotnet_diagnostic.CA1810.severity = warning
dotnet_diagnostic.CA1812.severity = warning
dotnet_diagnostic.CA1813.severity = error
dotnet_diagnostic.CA1814.severity = suggestion
dotnet_diagnostic.CA1815.severity = warning
dotnet_diagnostic.CA1819.severity = warning
dotnet_diagnostic.CA1820.severity = warning
dotnet_diagnostic.CA1821.severity = warning
dotnet_diagnostic.CA1822.severity = warning
dotnet_diagnostic.CA1823.severity = warning
dotnet_diagnostic.CA1824.severity = none
dotnet_diagnostic.CA1825.severity = warning
dotnet_diagnostic.CA1826.severity = warning
dotnet_diagnostic.CA1827.severity = warning
dotnet_diagnostic.CA1828.severity = warning
dotnet_diagnostic.CA1829.severity = warning
dotnet_diagnostic.CA1830.severity = warning
dotnet_diagnostic.CA1831.severity = suggestion
dotnet_diagnostic.CA1832.severity = suggestion
dotnet_diagnostic.CA1833.severity = suggestion
dotnet_diagnostic.CA1834.severity = warning
dotnet_diagnostic.CA1835.severity = suggestion
dotnet_diagnostic.CA1836.severity = warning
dotnet_diagnostic.CA1837.severity = suggestion
dotnet_diagnostic.CA1838.severity = suggestion
dotnet_diagnostic.CA1839.severity = suggestion
dotnet_diagnostic.CA1840.severity = suggestion
dotnet_diagnostic.CA1841.severity = warning
dotnet_diagnostic.CA1842.severity = error
dotnet_diagnostic.CA1843.severity = error
dotnet_diagnostic.CA1844.severity = warning
dotnet_diagnostic.CA1845.severity = warning
dotnet_diagnostic.CA1846.severity = warning
dotnet_diagnostic.CA1847.severity = warning
dotnet_diagnostic.CA1848.severity = suggestion
dotnet_diagnostic.CA1849.severity = warning
dotnet_diagnostic.CA1850.severity = none
dotnet_diagnostic.CA1851.severity = warning
dotnet_diagnostic.CA1852.severity = warning
dotnet_diagnostic.CA1853.severity = warning
dotnet_diagnostic.CA1854.severity = suggestion
dotnet_diagnostic.CA1855.severity = suggestion
dotnet_diagnostic.CA1856.severity = error
dotnet_diagnostic.CA1857.severity = warning
dotnet_diagnostic.CA1858.severity = warning
dotnet_diagnostic.CA1859.severity = suggestion
dotnet_diagnostic.CA1860.severity = warning
dotnet_diagnostic.CA1861.severity = warning
dotnet_diagnostic.CA1862.severity = warning
dotnet_diagnostic.CA1863.severity = suggestion
dotnet_diagnostic.CA1864.severity = warning
dotnet_diagnostic.CA1865.severity = warning
dotnet_diagnostic.CA1866.severity = warning
dotnet_diagnostic.CA1867.severity = suggestion
dotnet_diagnostic.CA1868.severity = warning
dotnet_diagnostic.CA1869.severity = warning
dotnet_diagnostic.CA1870.severity = warning

Microsoft.CodeAnalysis.NetAnalyzers | Reliability

Code Description ___________________________________________________________________________ !! Severity !!
CA2000 Dispose objects before losing scope πŸ›ˆ Suggestion
CA2002 Do not lock on objects with weak identity β›” Error
CA2007 Do not directly await a Task πŸž… None
CA2008 Do not create tasks without passing a TaskScheduler πŸ›ˆ Suggestion
CA2009 Do not call ToImmutableCollection on an ImmutableCollection value ⚠ Warning
CA2011 Do not assign property within its setter β›” Error
CA2012 Use ValueTasks correctly πŸ›ˆ Suggestion
CA2013 Do not use ReferenceEquals with value types ⚠ Warning
CA2014 Do not use stackalloc in loops ⚠ Warning
CA2015 Do not define finalizers for types derived from MemoryManager ⚠ Warning
CA2016 Forward the CancellationToken parameter to methods that take one ⚠ Warning
CA2017 Parameter count mismatch ⚠ Warning
CA2018 The count argument to Buffer.BlockCopy should specify the number of bytes [..] ⚠ Warning
CA2019 ThreadStatic fields should not use inline initialization πŸ›ˆ Suggestion
CA2020 Prevent behavioral change caused by built-in operators of IntPtr/UIntPtr πŸ›ˆ Suggestion
CA2021 Don't call Enumerable.Cast or Enumerable.OfType with incompatible types ⚠ Warning
.editorconfig
dotnet_diagnostic.CA2000.severity = suggestion
dotnet_diagnostic.CA2002.severity = error
dotnet_diagnostic.CA2007.severity = none
dotnet_diagnostic.CA2008.severity = suggestion
dotnet_diagnostic.CA2009.severity = warning
dotnet_diagnostic.CA2011.severity = error
dotnet_diagnostic.CA2012.severity = suggestion
dotnet_diagnostic.CA2013.severity = warning
dotnet_diagnostic.CA2014.severity = warning
dotnet_diagnostic.CA2015.severity = warning
dotnet_diagnostic.CA2016.severity = warning
dotnet_diagnostic.CA2017.severity = warning
dotnet_diagnostic.CA2018.severity = warning
dotnet_diagnostic.CA2019.severity = suggestion
dotnet_diagnostic.CA2020.severity = suggestion
dotnet_diagnostic.CA2021.severity = warning

Microsoft.CodeAnalysis.NetAnalyzers | Security

Code Description ___________________________________________________________________________ !! Severity !!
CA2100 Review SQL queries for security vulnerabilities ⚠ Warning
CA2109 Review visible event handlers ⚠ Warning
CA2119 Seal methods that satisfy private interfaces ⚠ Warning
CA2153 Avoid handling Corrupted State Exceptions ⚠ Warning
CA2300 Do not use insecure deserializer BinaryFormatter β›” Error
CA2301 Do not call BinaryFormatter.Deserialize without first setting BinaryFormatter.Binder πŸž… None
CA2302 Ensure BinaryFormatter.Binder is set before calling BinaryFormatter.Deserialize πŸž… None
CA2305 Do not use insecure deserializer LosFormatter β›” Error
CA2310 Do not use insecure deserializer NetDataContractSerializer β›” Error
CA2311 Do not deserialize without first setting NetDataContractSerializer.Binder πŸž… None
CA2312 Ensure NetDataContractSerializer.Binder is set before deserializing πŸž… None
CA2315 Do not use insecure deserializer ObjectStateFormatter β›” Error
CA2321 Do not deserialize with JavaScriptSerializer using a SimpleTypeResolver ⚠ Warning
CA2322 Ensure JavaScriptSerializer is not initialized with SimpleTypeResolver [..] ⚠ Warning
CA2326 Do not use TypeNameHandling values other than None ⚠ Warning
CA2327 Do not use insecure JsonSerializerSettings ⚠ Warning
CA2328 Ensure that JsonSerializerSettings are secure ⚠ Warning
CA2329 Do not deserialize with JsonSerializer using an insecure configuration ⚠ Warning
CA2330 Ensure that JsonSerializer has a secure configuration when deserializing ⚠ Warning
CA2350 Ensure DataTable.ReadXml()'s input is trusted ⚠ Warning
CA2351 Ensure DataSet.ReadXml()'s input is trusted ⚠ Warning
CA2352 Unsafe DataSet or DataTable in serializable type can be vulnerable to RCEA ⚠ Warning
CA2353 Unsafe DataSet or DataTable in serializable type ⚠ Warning
CA2354 Unsafe DataSet or DataTable in deserialized object graph can be vulnerable to RCEA ⚠ Warning
CA2355 Unsafe DataSet or DataTable in deserialized object graph ⚠ Warning
CA2356 Unsafe DataSet or DataTable type in web deserialized object graph ⚠ Warning
CA2361 Ensure autogen class with DataSet.ReadXml() is not used with untrusted data ⚠ Warning
CA2362 Unsafe DataSet or DataTable in autogen serializable type can be vulnerable to RCEA ⚠ Warning
CA3001 Review code for SQL injection vulnerabilities ⚠ Warning
CA3002 Review code for XSS vulnerabilities ⚠ Warning
CA3003 Review code for file path injection vulnerabilities ⚠ Warning
CA3004 Review code for information disclosure vulnerabilities ⚠ Warning
CA3005 Review code for LDAP injection vulnerabilities ⚠ Warning
CA3006 Review code for process command injection vulnerabilities ⚠ Warning
CA3007 Review code for open redirect vulnerabilities ⚠ Warning
CA3008 Review code for XPath injection vulnerabilities ⚠ Warning
CA3009 Review code for XML injection vulnerabilities ⚠ Warning
CA3010 Review code for XAML injection vulnerabilities ⚠ Warning
CA3011 Review code for DLL injection vulnerabilities ⚠ Warning
CA3012 Review code for regex injection vulnerabilities ⚠ Warning
CA3061 Do not add schema by URL ⚠ Warning
CA3075 Insecure DTD Processing ⚠ Warning
CA3076 Insecure XSLT Script Execution ⚠ Warning
CA3077 Insecure Processing in API Design, XML Document and XML Text Reader ⚠ Warning
CA3147 Mark verb handlers with ValidateAntiForgeryToken ⚠ Warning
CA5350 Do Not Use Weak Cryptographic Algorithms ⚠ Warning
CA5351 Do Not Use Broken Cryptographic Algorithms ⚠ Warning
CA5358 Do Not Use Unsafe Cipher Modes ⚠ Warning
CA5359 Do not disable certificate validation ⚠ Warning
CA5360 Do not call dangerous methods in deserialization ⚠ Warning
CA5361 Do not disable SChannel use of strong crypto ⚠ Warning
CA5362 Potential reference cycle in deserialized object graph πŸ›ˆ Suggestion
CA5363 Do not disable request validation ⚠ Warning
CA5364 Do not use deprecated security protocols ⚠ Warning
CA5365 Do Not Disable HTTP Header Checking ⚠ Warning
CA5366 Use XmlReader For DataSet Read XML ⚠ Warning
CA5367 Do not serialize types with pointer fields β›” Error
CA5368 Set ViewStateUserKey For Classes Derived From Page ⚠ Warning
CA5369 Use XmlReader for Deserialize ⚠ Warning
CA5370 Use XmlReader for validating reader ⚠ Warning
CA5371 Use XmlReader for schema read ⚠ Warning
CA5372 Use XmlReader for XPathDocument ⚠ Warning
CA5373 Do not use obsolete key derivation function ⚠ Warning
CA5374 Do not use XslTransform ⚠ Warning
CA5375 Do not use account shared access signature ⚠ Warning
CA5376 Use SharedAccessProtocol HttpsOnly ⚠ Warning
CA5377 Use container level access policy ⚠ Warning
CA5378 Do not disable ServicePointManagerSecurityProtocols ⚠ Warning
CA5379 Ensure key derivation function algorithm is sufficiently strong ⚠ Warning
CA5380 Do not add certificates to root store ⚠ Warning
CA5381 Ensure certificates are not added to root store ⚠ Warning
CA5382 Use secure cookies in ASP.NET Core ⚠ Warning
CA5383 Ensure use secure cookies in ASP.NET Core ⚠ Warning
CA5384 Do not use digital signature algorithm (DSA) ⚠ Warning
CA5385 Use Rivest–Shamir–Adleman (RSA) algorithm with sufficient key size ⚠ Warning
CA5386 Avoid hardcoding SecurityProtocolType value ⚠ Warning
CA5387 Do not use weak key derivation function with insufficient iteration count ⚠ Warning
CA5388 Ensure sufficient iteration count when using weak key derivation function ⚠ Warning
CA5389 Do not add archive item's path to the target file system path ⚠ Warning
CA5390 Do not hard-code encryption key ⚠ Warning
CA5391 Use antiforgery tokens in ASP.NET Core MVC controllers ⚠ Warning
CA5392 Use DefaultDllImportSearchPaths attribute for P/Invokes πŸž… None
CA5393 Do not use unsafe DllImportSearchPath value πŸž… None
CA5394 Do not use insecure randomness ⚠ Warning
CA5395 Miss HttpVerb attribute for action methods β›” Error
CA5396 Set HttpOnly to true for HttpCookie ⚠ Warning
CA5397 Do not use deprecated SslProtocols values ⚠ Warning
CA5398 Avoid hardcoded SslProtocols values β›” Error
CA5399 Enable HttpClient certificate revocation list check ⚠ Warning
CA5400 Ensure HttpClient certificate revocation list check is not disabled ⚠ Warning
CA5401 Do not use CreateEncryptor with non-default IV ⚠ Warning
CA5402 Use CreateEncryptor with the default IV ⚠ Warning
CA5403 Do not hard-code certificate β›” Error
CA5404 Do not disable token validation checks ⚠ Warning
CA5405 Do not always skip token validation in delegates ⚠ Warning
.editorconfig
dotnet_diagnostic.CA2100.severity = warning
dotnet_diagnostic.CA2109.severity = warning
dotnet_diagnostic.CA2119.severity = warning
dotnet_diagnostic.CA2153.severity = warning
dotnet_diagnostic.CA2300.severity = error
dotnet_diagnostic.CA2301.severity = none
dotnet_diagnostic.CA2302.severity = none
dotnet_diagnostic.CA2305.severity = error
dotnet_diagnostic.CA2310.severity = error
dotnet_diagnostic.CA2311.severity = none
dotnet_diagnostic.CA2312.severity = none
dotnet_diagnostic.CA2315.severity = error
dotnet_diagnostic.CA2321.severity = warning
dotnet_diagnostic.CA2322.severity = warning
dotnet_diagnostic.CA2326.severity = warning
dotnet_diagnostic.CA2327.severity = warning
dotnet_diagnostic.CA2328.severity = warning
dotnet_diagnostic.CA2329.severity = warning
dotnet_diagnostic.CA2330.severity = warning
dotnet_diagnostic.CA2350.severity = warning
dotnet_diagnostic.CA2351.severity = warning
dotnet_diagnostic.CA2352.severity = warning
dotnet_diagnostic.CA2353.severity = warning
dotnet_diagnostic.CA2354.severity = warning
dotnet_diagnostic.CA2355.severity = warning
dotnet_diagnostic.CA2356.severity = warning
dotnet_diagnostic.CA2361.severity = warning
dotnet_diagnostic.CA2362.severity = warning
dotnet_diagnostic.CA3001.severity = warning
dotnet_diagnostic.CA3002.severity = warning
dotnet_diagnostic.CA3003.severity = warning
dotnet_diagnostic.CA3004.severity = warning
dotnet_diagnostic.CA3005.severity = warning
dotnet_diagnostic.CA3006.severity = warning
dotnet_diagnostic.CA3007.severity = warning
dotnet_diagnostic.CA3008.severity = warning
dotnet_diagnostic.CA3009.severity = warning
dotnet_diagnostic.CA3010.severity = warning
dotnet_diagnostic.CA3011.severity = warning
dotnet_diagnostic.CA3012.severity = warning
dotnet_diagnostic.CA3061.severity = warning
dotnet_diagnostic.CA3075.severity = warning
dotnet_diagnostic.CA3076.severity = warning
dotnet_diagnostic.CA3077.severity = warning
dotnet_diagnostic.CA3147.severity = warning
dotnet_diagnostic.CA5350.severity = warning
dotnet_diagnostic.CA5351.severity = warning
dotnet_diagnostic.CA5358.severity = warning
dotnet_diagnostic.CA5359.severity = warning
dotnet_diagnostic.CA5360.severity = warning
dotnet_diagnostic.CA5361.severity = warning
dotnet_diagnostic.CA5362.severity = suggestion 
dotnet_diagnostic.CA5363.severity = warning
dotnet_diagnostic.CA5364.severity = warning
dotnet_diagnostic.CA5365.severity = warning
dotnet_diagnostic.CA5366.severity = warning
dotnet_diagnostic.CA5367.severity = error 
dotnet_diagnostic.CA5368.severity = warning
dotnet_diagnostic.CA5369.severity = warning
dotnet_diagnostic.CA5370.severity = warning
dotnet_diagnostic.CA5371.severity = warning
dotnet_diagnostic.CA5372.severity = warning
dotnet_diagnostic.CA5373.severity = warning
dotnet_diagnostic.CA5374.severity = warning
dotnet_diagnostic.CA5375.severity = warning
dotnet_diagnostic.CA5376.severity = warning
dotnet_diagnostic.CA5377.severity = warning
dotnet_diagnostic.CA5378.severity = warning
dotnet_diagnostic.CA5379.severity = warning
dotnet_diagnostic.CA5380.severity = warning
dotnet_diagnostic.CA5381.severity = warning
dotnet_diagnostic.CA5382.severity = warning
dotnet_diagnostic.CA5383.severity = warning
dotnet_diagnostic.CA5384.severity = warning
dotnet_diagnostic.CA5385.severity = warning
dotnet_diagnostic.CA5386.severity = warning
dotnet_diagnostic.CA5387.severity = warning
dotnet_diagnostic.CA5388.severity = warning
dotnet_diagnostic.CA5389.severity = warning
dotnet_diagnostic.CA5390.severity = warning
dotnet_diagnostic.CA5391.severity = warning
dotnet_diagnostic.CA5392.severity = none
dotnet_diagnostic.CA5393.severity = none
dotnet_diagnostic.CA5394.severity = warning
dotnet_diagnostic.CA5395.severity = error
dotnet_diagnostic.CA5396.severity = warning
dotnet_diagnostic.CA5397.severity = warning
dotnet_diagnostic.CA5398.severity = error
dotnet_diagnostic.CA5399.severity = warning
dotnet_diagnostic.CA5400.severity = warning
dotnet_diagnostic.CA5401.severity = warning
dotnet_diagnostic.CA5402.severity = warning
dotnet_diagnostic.CA5403.severity = error
dotnet_diagnostic.CA5404.severity = warning
dotnet_diagnostic.CA5405.severity = warning

Microsoft.CodeAnalysis.NetAnalyzers | Usage

Code Description ___________________________________________________________________________ !! Severity !!
CA1816 Call GC.SuppressFinalize correctly πŸ›ˆ Suggestion
CA2200 Rethrow to preserve stack details ⚠ Warning
CA2201 Do not raise reserved exception types ⚠ Warning
CA2207 Initialize value type static fields inline ⚠ Warning
CA2208 Instantiate argument exceptions correctly ⚠ Warning
CA2211 Non-constant fields should not be visible ⚠ Warning
CA2213 Disposable fields should be disposed ⚠ Warning
CA2214 Do not call overridable methods in constructors ⚠ Warning
CA2215 Dispose methods should call base class dispose ⚠ Warning
CA2216 Disposable types should declare finalizer ⚠ Warning
CA2217 Do not mark enums with FlagsAttribute β›” Error
CA2218 Override GetHashCode on overriding Equals ⚠ Warning
CA2219 Do not raise exceptions in exception clauses β›” Error
CA2224 Override Equals on overloading operator equals πŸž… None
CA2225 Operator overloads have named alternates πŸž… None
CA2226 Operators should have symmetrical overloads πŸž… None
CA2227 Collection properties should be read only ⚠ Warning
CA2229 Implement serialization constructors πŸž… None
CA2231 Overload operator equals on overriding ValueType.Equals ⚠ Warning
CA2234 Pass System.Uri objects instead of strings ⚠ Warning
CA2235 Mark all non-serializable fields ⚠ Warning
CA2237 Mark ISerializable types with SerializableAttribute ⚠ Warning
CA2241 Provide correct arguments to formatting methods β›” Error
CA2242 Test for NaN correctly β›” Error
CA2243 Attribute string literals should parse correctly β›” Error
CA2244 Do not duplicate indexed element initializations β›” Error
CA2245 Do not assign a property to itself β›” Error
CA2246 Do not assign a symbol and its member in the same statement β›” Error
CA2247 Argument passed to TaskCompletionSource constructor should be
TaskCreationOptions enum
⚠ Warning
CA2248 Provide correct enum argument to Enum.HasFlag β›” Error
CA2249 Consider using String.Contains instead of String.IndexOf ⚠ Warning
CA2250 Use ThrowIfCancellationRequested ⚠ Warning
CA2251 Use String.Equals over String.Compare ⚠ Warning
CA2252 Opt in to preview features before using them β›” Error
CA2253 Named placeholders should not be numeric values ⚠ Warning
CA2254 Template should be a static expression ⚠ Warning
CA2255 The ModuleInitializer attribute should not be used in libraries ⚠ Warning
CA2256 All members declared in parent interfaces must implement DICI-attributed interface ⚠ Warning
CA2257 Members defined on an interface with the DICIAttribute should be static ⚠ Warning
CA2258 Providing a DICI interface in Visual Basic is unsupported ⚠ Warning
CA2259 Ensure ThreadStatic is only used with static fields ⚠ Warning
CA2260 Implement generic math interfaces correctly ⚠ Warning
CA2261 Do not use ConfigureAwaitOptions.SuppressThrowing with Task ⚠ Warning
.editorconfig
dotnet_diagnostic.CA1816.severity = suggestion 
dotnet_diagnostic.CA2200.severity = warning
dotnet_diagnostic.CA2201.severity = warning
dotnet_diagnostic.CA2207.severity = warning 
dotnet_diagnostic.CA2208.severity = warning
dotnet_diagnostic.CA2211.severity = warning
dotnet_diagnostic.CA2213.severity = warning 
dotnet_diagnostic.CA2214.severity = warning 
dotnet_diagnostic.CA2215.severity = warning
dotnet_diagnostic.CA2216.severity = warning 
dotnet_diagnostic.CA2217.severity = error 
dotnet_diagnostic.CA2218.severity = warning
dotnet_diagnostic.CA2219.severity = error
dotnet_diagnostic.CA2224.severity = none
dotnet_diagnostic.CA2225.severity = none
dotnet_diagnostic.CA2226.severity = none
dotnet_diagnostic.CA2227.severity = warning
dotnet_diagnostic.CA2229.severity = none
dotnet_diagnostic.CA2231.severity = warning
dotnet_diagnostic.CA2234.severity = warning 
dotnet_diagnostic.CA2235.severity = warning 
dotnet_diagnostic.CA2237.severity = warning 
dotnet_diagnostic.CA2241.severity = error
dotnet_diagnostic.CA2242.severity = error
dotnet_diagnostic.CA2243.severity = error 
dotnet_diagnostic.CA2244.severity = error
dotnet_diagnostic.CA2245.severity = error
dotnet_diagnostic.CA2246.severity = error
dotnet_diagnostic.CA2247.severity = warning
dotnet_diagnostic.CA2248.severity = error
dotnet_diagnostic.CA2249.severity = warning
dotnet_diagnostic.CA2250.severity = warning
dotnet_diagnostic.CA2251.severity = warning
dotnet_diagnostic.CA2252.severity = error
dotnet_diagnostic.CA2253.severity = warning
dotnet_diagnostic.CA2254.severity = warning
dotnet_diagnostic.CA2255.severity = warning
dotnet_diagnostic.CA2256.severity = warning
dotnet_diagnostic.CA2257.severity = warning
dotnet_diagnostic.CA2258.severity = warning
dotnet_diagnostic.CA2259.severity = warning
dotnet_diagnostic.CA2260.severity = warning
dotnet_diagnostic.CA2261.severity = warning

Code style rules

Language rules | using directive preferences

Language rules | Code block preferences

Language rules | Expression-bodied preferences

Language rules | Expression-level preferences

Language rules | Field preferences

Language rules | Modifier preferences

Language rules | New line preferences

Language rules | Null-checking preferences

Language rules | Parameter preferences

Language rules | Parentheses preferences

Language rules | Pattern matching preferences

Language rules | this preferences

Language rules | var preferences

Formatting rules

.editorconfig
dotnet_diagnostic.IDE0055.severity = warning