An opinionated C# .editorconfig
Compatible with Visual Studio 2022, and 2019*.
- Visual Studio options
- Advanced
- Code style
- General
- this. preferences
- Predefined type preferences
- var preferences
- Code block preferences
- Parentheses preferences
- Expression preferences
- Expression-bodied members
- Pattern matching preferences
- Variable preferences
- null checking
- using preferences
- Modifier preferences
- Parameter preferences
- Style
- New line preferences
- Formatting
- General
- Microsoft.CodeAnalysis.NetAnalyzers
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
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
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
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
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
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
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
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
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
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
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
Description _______________________________________________ | Code | Preference ____________ | !! Severity !! |
---|---|---|---|
Preferred using directive placement | IDE0065 | Outside namespace | β Error |
.editorconfig
csharp_using_directive_placement = outside_namespace:error
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
Description _______________________________________________ | Code | Preference ____________ | !! Severity !! |
---|---|---|---|
Avoid unused parameters | IDE0060 | Non-public methods | β Warning |
.editorconfig
dotnet_code_quality_unused_parameters = non_public:warning
Description _______________________________________________ | Code | Preference ____________ | !! Severity !! |
---|---|---|---|
Use collection expression for empty | IDE0301 | Yes | β Warning |
Use collection expression for stackalloc | IDE0302 | Yes | π Suggestion |
Use collection expression for Create() | IDE0303 | Yes | β Warning |
Use collection expression for builder | IDE0304 | Yes | β Warning |
Use collection expression for fluent | IDE0305 | Yes | β Warning |
Make anonymous function static | IDE0320 | Yes | π Suggestion |
Prefer System.Threading.Lock | IDE0330 | Yes | β Error |
.editorconfig
dotnet_diagnostic.IDE0301.severity = warning
dotnet_diagnostic.IDE0302.severity = suggestion
dotnet_diagnostic.IDE0303.severity = warning
dotnet_diagnostic.IDE0304.severity = warning
dotnet_diagnostic.IDE0305.severity = warning
dotnet_diagnostic.IDE0320.severity = suggestion
dotnet_diagnostic.IDE0330.severity = error
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Code | Description ___________________________________________________________________________ | !! Severity !! |
---|---|---|
CA1200 | Avoid using cref tags with a prefix | π None |
.editorconfig
dotnet_diagnostic.CA1200.severity = none
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
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
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 |
CA1514 | Avoid redundant length argument | β Warning |
CA1515 | Consider making public types internal | β 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
dotnet_diagnostic.CA1514.severity = warning
dotnet_diagnostic.CA1515.severity = warning
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
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 |
CA1871 | Do not pass a nullable struct to ArgumentNullException.ThrowIfNull | β Warning |
CA1872 | Prefer Convert.ToHexString and Convert.ToHexStringLower over call chains based on BitConverter.ToString | β 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
dotnet_diagnostic.CA1871.severity = warning
dotnet_diagnostic.CA1872.severity = warning
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 |
CA2022 | Avoid inexact read with Stream.Read | β 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
dotnet_diagnostic.CA2022.severity = warning
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 = suggestion
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
Code | Description ___________________________________________________________________________ | !! Severity !! |
---|---|---|
CA1801 | Review unused parameters | β Warning |
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 |
CA2262 | Set MaxResponseHeadersLength properly | β Warning |
CA2263 | Prefer generic overload when type is known | β Warning |
CA2264 | Do not pass a non-nullable value to ArgumentNullException.ThrowIfNull | β Warning |
CA2265 | Do not compare Span to null or default | β Warning |
.editorconfig
dotnet_diagnostic.CA1801.severity = warning
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
dotnet_diagnostic.CA2262.severity = warning
dotnet_diagnostic.CA2263.severity = warning
dotnet_diagnostic.CA2264.severity = warning
dotnet_diagnostic.CA2265.severity = warning
.editorconfig
dotnet_diagnostic.IDE0055.severity = warning