Skip to content

Instantly share code, notes, and snippets.

@RealDotNetDave
Last active January 12, 2026 15:04
Show Gist options
  • Select an option

  • Save RealDotNetDave/dbae4d97358ba4515dd52e5b8ca87671 to your computer and use it in GitHub Desktop.

Select an option

Save RealDotNetDave/dbae4d97358ba4515dd52e5b8ca87671 to your computer and use it in GitHub Desktop.
.editorConfig by David (dotNetDave) McCarter - dotNetTips.com
####################################################################################################
# dotNetDave's (David McCarter) Editor Config - dotNetTips.com
# Updates to this file are posted quarterly at: https://bit.ly/EditorConfig5
# Updated January 12, 2026
# Code performance book is available at: https://bit.ly/CodePerf5
# Coding standards book is available at: https://bit.ly/CodingStandards20th
####################################################################################################
root = true
####################################################################################################
# Base Configuration - General Settings, File Formatting, and Naming Conventions
# Part of dotNetDave's Editor Config Suite
####################################################################################################
# All Files
[*]
charset = utf-8
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_prefer_top_level_statements = true:silent
end_of_line = crlf
indent_size = 4
indent_style = tab
insert_final_newline = true
tab_width = 4
trim_trailing_whitespace = true
# Type members
dotnet_hide_advanced_members = false
dotnet_member_insertion_location = with_other_members_of_the_same_kind
dotnet_property_generation_behavior = prefer_throwing_properties
# Symbol search
dotnet_search_reference_assemblies = true
# Nullability settings
dotnet_build_property.Nullable = enable
# Enable or disable the analyzers
dotnet_analyzer_diagnostic.severity = warning
# Visual Studio XML Project Files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
indent_size = 2
# XML Configuration Files
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct,xml,stylecop}]
indent_size = 2
# JSON Files
[*.{json,json5,webmanifest}]
indent_size = 2
# YAML Files
[*.{yml,yaml}]
indent_size = 2
# Markdown Files
[*.{md,mdx}]
trim_trailing_whitespace = false
# Bash Files
[*.sh]
end_of_line = lf
# Batch Files
[*.{cmd,bat}]
end_of_line = crlf
# Web Files
[*.{htm,html,js,jsm,ts,tsx,cjs,cts,ctsx,mjs,mts,mtsx,css,sass,scss,less,pcss,svg,vue}]
indent_size = 2
insert_final_newline = true
# Makefiles
[Makefile]
indent_style = tab
####################################################################################################
# .NET Style Rules - Naming Conventions
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#net-style-rules
####################################################################################################
[*.{cs,csx,cake,vb,vbx}]
# Non-private static fields are PascalCase
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = warning
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
dotnet_naming_rule.private_fields.severity = warning
dotnet_naming_rule.private_fields.style = camel_case_underscore
dotnet_naming_rule.private_fields.symbols = private_fields
dotnet_naming_rule.private_fields_style.severity = warning
dotnet_naming_rule.private_fields_style.style = camel_case
dotnet_naming_rule.private_fields_style.symbols = private_fields
dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
# Constants are PascalCase
dotnet_naming_rule.constants_should_be_pascal_case.severity = warning
dotnet_naming_rule.constants_should_be_pascal_case.style = non_private_static_field_style
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
dotnet_naming_style.constant_style.capitalization = pascal_case
dotnet_naming_symbols.constants.applicable_kinds = field, local
dotnet_naming_symbols.constants.required_modifiers = const
# Locals and parameters are camelCase
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
dotnet_naming_rule.locals_should_be_camel_case.severity = warning
# camel_case_style - Define the camelCase style
dotnet_naming_style.camel_case_style.capitalization = camel_case
dotnet_naming_style.static_field_style.required_prefix = s_
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
dotnet_naming_symbols.static_fields.required_modifiers = static
# first_upper_style - The first character must start with an upper-case character
dotnet_naming_style.first_upper_style.capitalization = first_word_upper
# prefix_interface_with_i_style - Interfaces must be PascalCase and first character must be 'I'
dotnet_naming_style.prefix_interface_with_i_style.required_prefix = I
dotnet_naming_style.prefix_interface_with_i_style.capitalization = pascal_case
# prefix_type_parameters_with_t_style - Generic Type Parameters must be PascalCase and start with 'T'
dotnet_naming_style.prefix_type_parameters_with_t_style.capitalization = pascal_case
dotnet_naming_style.prefix_type_parameters_with_t_style.required_prefix = T
# disallowed_style - Anything that has this style applied is marked as disallowed
dotnet_naming_style.disallowed_style.capitalization = pascal_case
dotnet_naming_style.disallowed_style.required_prefix = ____RULE_VIOLATION____
dotnet_naming_style.disallowed_style.required_suffix = ____RULE_VIOLATION____
# internal_error_style - This style should never occur
dotnet_naming_style.internal_error_style.capitalization = pascal_case
dotnet_naming_style.internal_error_style.required_prefix = ____INTERNAL_ERROR____
dotnet_naming_style.internal_error_style.required_suffix = ____INTERNAL_ERROR____
# All public/protected/protected_internal constant fields must be PascalCase
dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.severity = warning
dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.style = non_private_static_field_style
dotnet_naming_rule.public_protected_constant_fields_must_be_pascal_case_rule.symbols = public_protected_constant_fields_group
dotnet_naming_symbols.public_protected_constant_fields_group.applicable_accessibilities = public, protected, protected_internal
dotnet_naming_symbols.public_protected_constant_fields_group.applicable_kinds = field
dotnet_naming_symbols.public_protected_constant_fields_group.required_modifiers = const
# All public/protected/protected_internal static readonly fields must be PascalCase
dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.severity = warning
dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.style = non_private_static_field_style
dotnet_naming_rule.public_protected_static_readonly_fields_must_be_pascal_case_rule.symbols = public_protected_static_readonly_fields_group
dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_accessibilities = public, protected, protected_internal
dotnet_naming_symbols.public_protected_static_readonly_fields_group.applicable_kinds = field
dotnet_naming_symbols.public_protected_static_readonly_fields_group.required_modifiers = static, readonly
# No other public/protected/protected_internal fields are allowed
dotnet_naming_rule.other_public_protected_fields_disallowed_rule.severity = error
dotnet_naming_rule.other_public_protected_fields_disallowed_rule.style = disallowed_style
dotnet_naming_rule.other_public_protected_fields_disallowed_rule.symbols = other_public_protected_fields_group
dotnet_naming_symbols.other_public_protected_fields_group.applicable_accessibilities = public, protected, protected_internal
dotnet_naming_symbols.other_public_protected_fields_group.applicable_kinds = field
##########################################
# StyleCop Field Naming Rules
##########################################
# All constant fields must be PascalCase
dotnet_naming_rule.private_or_internal_field_should_be__fieldname.severity = warning
dotnet_naming_rule.private_or_internal_field_should_be__fieldname.style = _fieldname
dotnet_naming_rule.private_or_internal_field_should_be__fieldname.symbols = private_or_internal_field
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.severity = warning
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.style = non_private_static_field_style
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.symbols = stylecop_constant_fields_group
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_kinds = field
dotnet_naming_symbols.stylecop_constant_fields_group.required_modifiers = const
# All static readonly fields must be PascalCase
dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.severity = warning
dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.style = non_private_static_field_style
dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.symbols = stylecop_static_readonly_fields_group
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds = field
dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static, readonly
# No non-private instance fields are allowed
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.severity = error
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.style = disallowed_style
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.symbols = stylecop_fields_must_be_private_group
dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected
dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_kinds = field
# Private fields must be camelCase
dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.severity = warning
dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.style = camel_case_style
dotnet_naming_rule.stylecop_private_fields_must_be_camel_case_rule.symbols = stylecop_private_fields_group
dotnet_naming_symbols.stylecop_private_fields_group.applicable_accessibilities = private
dotnet_naming_symbols.stylecop_private_fields_group.applicable_kinds = field
# Local variables must be camelCase
dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.severity = silent
dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.style = camel_case_style
dotnet_naming_rule.stylecop_local_fields_must_be_camel_case_rule.symbols = stylecop_local_fields_group
dotnet_naming_symbols.stylecop_local_fields_group.applicable_accessibilities = local
dotnet_naming_symbols.stylecop_local_fields_group.applicable_kinds = local
# Sanity check - uncovered field case
dotnet_naming_rule.sanity_check_uncovered_field_case_rule.severity = error
dotnet_naming_rule.sanity_check_uncovered_field_case_rule.style = internal_error_style
dotnet_naming_rule.sanity_check_uncovered_field_case_rule.symbols = sanity_check_uncovered_field_case_group
dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_accessibilities = *
dotnet_naming_symbols.sanity_check_uncovered_field_case_group.applicable_kinds = field
# All elements (namespaces, classes, enums, etc.) must be PascalCase
dotnet_naming_rule.element_rule.severity = warning
dotnet_naming_rule.element_rule.style = non_private_static_field_style
dotnet_naming_rule.element_rule.symbols = element_group
dotnet_naming_symbols.element_group.applicable_kinds = namespace, class, enum, struct, delegate, event, method, property
# Interfaces use PascalCase and are prefixed with uppercase 'I'
dotnet_naming_rule.interface_rule.severity = warning
dotnet_naming_rule.interface_rule.style = prefix_interface_with_i_style
dotnet_naming_rule.interface_rule.symbols = interface_group
dotnet_naming_symbols.interface_group.applicable_kinds = interface
# Generics Type Parameters use PascalCase and are prefixed with uppercase 'T'
dotnet_naming_rule.type_parameter_rule.severity = warning
dotnet_naming_rule.type_parameter_rule.style = prefix_type_parameters_with_t_style
dotnet_naming_rule.type_parameter_rule.symbols = type_parameter_group
dotnet_naming_symbols.type_parameter_group.applicable_kinds = type_parameter
# Function parameters use camelCase
dotnet_naming_rule.parameters_rule.severity = warning
dotnet_naming_rule.parameters_rule.style = camel_case_style
dotnet_naming_rule.parameters_rule.symbols = parameters_group
dotnet_naming_symbols.parameters_group.applicable_kinds = parameter
# Type Parameters
dotnet_naming_rule.type_parameter_naming.severity = warning
dotnet_naming_rule.type_parameter_naming.style = type_parameter_style
dotnet_naming_rule.type_parameter_naming.symbols = type_parameter_symbol
dotnet_naming_style.type_parameter_style.capitalization = pascal_case
dotnet_naming_style.type_parameter_style.required_prefix = T
dotnet_naming_symbols.type_parameter_symbol.applicable_accessibilities = *
dotnet_naming_symbols.type_parameter_symbol.applicable_kinds = type_parameter
# Instance fields are camelCase and start with _
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.instance_fields_should_be_camel_case.style = camel_case_underscore_style
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
dotnet_naming_style.instance_field_style.capitalization = camel_case
dotnet_naming_style.instance_field_style.required_prefix = _
dotnet_naming_symbols.instance_fields.applicable_kinds = field
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
# Local functions are PascalCase
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = warning
dotnet_naming_rule.local_functions_should_be_pascal_case.style = non_private_static_field_style
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = all_members
dotnet_naming_style.local_function_style.capitalization = pascal_case
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
# "this." and "Me." qualifiers
dotnet_style_qualification_for_event = true:warning
dotnet_style_qualification_for_field = true:warning
dotnet_style_qualification_for_method = true:warning
dotnet_style_qualification_for_property = true:warning
# Undocumented
dotnet_style_operator_placement_when_wrapping = end_of_line
# Naming styles
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
dotnet_naming_rule.interface_should_be_begins_with_i.style = prefix_interface_with_i_style
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
dotnet_naming_rule.types_should_be_pascal_case.style = non_private_static_field_style
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
# By default, name items with PascalCase
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = non_private_static_field_style
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
# pascal_case_style - Define the PascalCase style
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
dotnet_naming_symbols.all_members.applicable_kinds = *
# Symbol specifications
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.required_modifiers = *
# Naming styles
dotnet_naming_style._fieldname.capitalization = camel_case
dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
# Simplify interpolation
dotnet_diagnostic.IDE0071.severity = warning
# Allow multiple blank lines
dotnet_diagnostic.IDE2000.severity = silent
####################################################################################################
# Code Quality Settings
####################################################################################################
dotnet_code_quality.enable_nullable_reference_types = true
dotnet_code_quality.enableNETAnalyzers = true
dotnet_code_quality.interpolated_string_composite_format = true
dotnet_code_quality.prefer_auto_properties = false
dotnet_code_quality.prefer_const = true
dotnet_code_quality.prefer_inferred_anonymous_type_member_names = true
dotnet_code_quality.prefer_inferred_tuple_names = true
dotnet_code_quality.prefer_readonly = true
dotnet_code_quality.require_accessibility_modifiers = true
dotnet_code_quality.require_explicit_type_arguments = true
dotnet_code_quality.require_explicit_visibility = true
dotnet_code_quality.require_variable_declaration_for_explicit_type = false
dotnet_code_quality_unused_parameters = all:warning
dotnet_enable_roslyn_analyzers = true
dotnet_remove_unnecessary_suppression_exclusions = none
# RS0016: Add public types and members to the declared API
dotnet_public_api_analyzer.require_api_files = true
# Do not use generic CodeAction.Create to create CodeAction
dotnet_diagnostic.RS0005.severity = none
####################################################################################################
# C# Specific Settings
####################################################################################################
[*.{cs,csx,cake}]
# Newline options
csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true
# C# Unnecessary code rules
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
# Set the C# language version
csharp_language_version = latest
# Prefer "var" everywhere (Implicit and explicit types)
csharp_style_var_elsewhere = true:warning
csharp_style_var_for_built_in_types = true:warning
csharp_style_var_when_type_is_apparent = true:warning
# Modifier preferences
csharp_prefer_static_anonymous_function = true
csharp_prefer_static_local_function = true:warning
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning
csharp_style_prefer_readonly_struct = true:suggestion
csharp_style_prefer_readonly_struct_member = true:suggestion
dotnet_style_readonly_field = true:warning
dotnet_style_require_accessibility_modifiers = always:warning
# Code-block preferences
csharp_prefer_braces = true: error
csharp_prefer_simple_using_statement = false:silent
csharp_prefer_system_threading_lock = true
dotnet_style_prefer_collection_expression = true:suggestion
# Enable foreach explicit cast preference
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed:warning
# Prefer System.Threading.Lock
csharp_prefer_system_threading_lock = true:warning
# Prefer parameter null checking
csharp_style_prefer_parameter_null_checking = true:suggestion
# Prefer extended property pattern
csharp_style_prefer_extended_property_pattern = true:suggestion
# Prefer UTF-8 string literals
csharp_style_prefer_utf8_string_literals = true:suggestion
# Prefer tuple swap
csharp_style_prefer_tuple_swap = true:suggestion
# Prefer local over anonymous function
csharp_style_prefer_local_over_anonymous_function = true:suggestion
# Prefer unbound generic type in nameof
csharp_style_prefer_unbound_generic_type_in_nameof = true:warning
# Expression-level preferences
csharp_prefer_simple_default_expression = true:warning
csharp_style_deconstructed_variable_declaration = true:warning
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
csharp_style_inlined_variable_declaration = true:warning
csharp_style_pattern_local_over_anonymous_function = true:warning
csharp_style_prefer_index_operator = true:warning
csharp_style_prefer_range_operator = true:warning
csharp_style_prefer_null_check_over_type_check = true:warning
csharp_style_throw_expression = true:warning
# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:warning
# New line preferences
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
# Expression-Bodied members
csharp_style_expression_bodied_accessors = true:warning
csharp_style_expression_bodied_constructors = true:warning
csharp_style_expression_bodied_indexers = true:warning
csharp_style_expression_bodied_lambdas = true:warning
csharp_style_expression_bodied_local_functions = true:warning
csharp_style_expression_bodied_methods = true:suggestion
csharp_style_expression_bodied_operators = true:warning
csharp_style_expression_bodied_properties = true:warning
# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
csharp_style_prefer_not_pattern = true:warning
csharp_style_prefer_pattern_matching = true:warning
csharp_style_prefer_switch_expression = true:warning
csharp_style_prefer_explicit_this = true:warning
# "Null" checking preferences
csharp_style_conditional_delegate_call = true:warning
# Spacing options
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
# Wrap options
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true
# Namespace options
csharp_style_namespace_declarations = file_scoped:warning
####################################################################################################
# Visual Basic Specific Settings
####################################################################################################
[*.{vb}]
visual_basic_preferred_modifier_order = Partial, Default, Private, Protected, Public, Friend, NotOverridable, Overridable, MustOverride, Overloads, Overrides, MustInherit, NotInheritable, Static, Shared, Shadows, ReadOnly, WriteOnly, Dim, Const, WithEvents, Widening, Narrowing, Custom, Async:warning
visual_basic_style_prefer_simplified_object_creation = all : suggestion
visual_basic_style_prefer_isnot_expression = true : suggestion
####################################################################################################
# .NET Style Preferences
####################################################################################################
[*.{cs,csx,cake,vb,vbx}]
# Language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
dotnet_style_predefined_type_for_member_access = true:warning
# Parentheses preferences
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning
dotnet_style_collection_initializer = true:warning
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_object_initializer = true:warning
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_prefer_compound_assignment = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
dotnet_style_prefer_inferred_tuple_names = true:warning
dotnet_style_prefer_simplified_boolean_expressions = false:silent
dotnet_style_prefer_simplified_interpolation = true:warning
# Expression-level preferences
dotnet_prefer_system_hash_code = true
# Null-checking preferences
dotnet_style_coalesce_expression = true:warning
dotnet_style_null_propagation = true:warning
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
[*.g.cs]
# Missing XML comment for publicly visible type or member 'Type_or_Member'
dotnet_diagnostic.CS1591.severity = none
####################################################################################################
# Design Rules (CA1000-CA1070)
# Design rules support adherence to the .NET Framework design guidelines
# Part of dotNetDave's Editor Config Suite
####################################################################################################
[*.{cs,vb}]
# Do not declare static members on generic types
dotnet_diagnostic.CA1000.severity = suggestion
# Types that own disposable fields should be disposable
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1001.severity = error
# Do not expose generic lists
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1002.severity = error
# Use generic event handler instances
dotnet_diagnostic.CA1003.severity = warning
# Avoid excessive parameters on generic types
dotnet_diagnostic.CA1005.severity = warning
# Enums should have zero value
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1008.severity = error
# Collections should implement generic interface
dotnet_diagnostic.CA1010.severity = warning
# Abstract types should not have public constructors
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1012.severity = error
# Mark assemblies with CLSCompliantAttribute
dotnet_diagnostic.CA1014.severity = silent
# Mark assemblies with AssemblyVersionAttribute
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1016.severity = error
# Mark assemblies with ComVisibleAttribute
dotnet_diagnostic.CA1017.severity = silent
# Mark attributes with AttributeUsageAttribute
dotnet_diagnostic.CA1018.severity = suggestion
# Define accessors for attribute arguments
dotnet_diagnostic.CA1019.severity = suggestion
# Avoid out parameters
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1021.severity = suggestion
# Use properties where appropriate
dotnet_diagnostic.CA1024.severity = suggestion
# Mark enums with FlagsAttribute
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1027.severity = error
# Enum storage should be Int32
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1028.severity = error
# Use events where appropriate
dotnet_diagnostic.CA1030.severity = suggestion
# Do not catch general exception types
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1031.severity = error
# Implement standard exception constructors
dotnet_diagnostic.CA1032.severity = suggestion
# Interface methods should be callable by child types
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1033.severity = suggestion
# Nested types should not be visible
dotnet_diagnostic.CA1034.severity = error
# Override methods on comparable types
dotnet_diagnostic.CA1036.severity = suggestion
# Avoid empty interfaces
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1040.severity = suggestion
# Provide ObsoleteAttribute message
dotnet_diagnostic.CA1041.severity = warning
# Use integral or string argument for indexers
dotnet_diagnostic.CA1043.severity = suggestion
# Properties should not be write only
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1044.severity = error
# Do not pass types by reference
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1045.severity = warning
# Do not overload operator equals on reference types
dotnet_diagnostic.CA1046.severity = warning
# Do not declare protected members in sealed types
dotnet_diagnostic.CA1047.severity = error
# Declare types in namespaces
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1050.severity = error
# Do not declare visible instance fields
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1051.severity = error
# Static holder types should be Static or NotInheritable
dotnet_diagnostic.CA1052.severity = warning
# Static holder types should not have default constructors
dotnet_diagnostic.CA1053.severity = warning
# URI parameters should not be strings
dotnet_diagnostic.CA1054.severity = warning
# URI return values should not be strings
dotnet_diagnostic.CA1055.severity = warning
# URI properties should not be strings
dotnet_diagnostic.CA1056.severity = warning
# Types should not extend certain base types
dotnet_diagnostic.CA1058.severity = warning
# Move P/Invokes to NativeMethods class
dotnet_diagnostic.CA1060.severity = warning
# Do not hide base class methods
dotnet_diagnostic.CA1061.severity = warning
# Validate arguments of public methods
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_code_quality.CA1062.api_surface = public, protected
dotnet_diagnostic.CA1062.severity = error
# Implement IDisposable correctly
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1063.severity = error
# Exceptions should be public
dotnet_diagnostic.CA1064.severity = warning
# Do not raise exceptions in unexpected locations
dotnet_diagnostic.CA1065.severity = warning
# Implement IEquatable when overriding Equals
dotnet_diagnostic.CA1066.severity = warning
# Override Equals when implementing IEquatable
dotnet_diagnostic.CA1067.severity = warning
# CancellationToken parameters must come last
dotnet_diagnostic.CA1068.severity = warning
# Enums should not have duplicate values
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1069.severity = error
# Do not declare event fields as virtual
dotnet_diagnostic.CA1070.severity = warning
####################################################################################################
# Documentation Rules (CA1200)
# Documentation rules support writing well-documented libraries
# Part of dotNetDave's Editor Config Suite
####################################################################################################
[*.{cs,vb}]
# Avoid using cref tags with a prefix
dotnet_diagnostic.CA1200.severity = suggestion
####################################################################################################
# Globalization Rules (CA1303-CA1311 and CA2101)
# Globalization rules support world-ready libraries and applications
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Part of dotNetDave's Editor Config Suite
####################################################################################################
[*.{cs,vb}]
# Do not pass literals as localized parameters
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_code_quality.CA1303.use_naming_heuristic = true
dotnet_diagnostic.CA1303.severity = warning
# Specify CultureInfo
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1304.severity = error
# Specify IFormatProvider
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1305.severity = error
# Specify StringComparison for clarity
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1307.severity = error
# Normalize strings to uppercase
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1308.severity = warning
# Use ordinal StringComparison
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1309.severity = warning
# Specify StringComparison for correctness
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1310.severity = warning
# Specify a culture or use an invariant version
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1311.severity = error
# Specify marshaling for P/Invoke string arguments
dotnet_diagnostic.CA2101.severity = warning
####################################################################################################
# Interoperability Rules (CA1400-CA1422)
# Portability rules support portability across different platforms
# Interoperability rules support interaction with COM clients
# Part of dotNetDave's Editor Config Suite
####################################################################################################
[*.{cs,vb}]
# P/Invokes should not be visible
dotnet_diagnostic.CA1401.severity = error
# Validate platform compatibility
dotnet_diagnostic.CA1416.severity = suggestion
# Do not use OutAttribute on string parameters for P/Invokes
dotnet_diagnostic.CA1417.severity = suggestion
# Validate platform compatibility
dotnet_diagnostic.CA1418.severity = suggestion
# Provide a parameterless constructor that is as visible as the containing type for concrete types derived from 'System.Runtime.InteropServices.SafeHandle'
dotnet_diagnostic.CA1419.severity = suggestion
# Property, type, or attribute requires runtime marshalling
dotnet_diagnostic.CA1420.severity = suggestion
# Method uses runtime marshalling when DisableRuntimeMarshallingAttribute is applied
dotnet_diagnostic.CA1421.severity = warning
# Validate platform compatibility - obsoleted APIs
dotnet_diagnostic.CA1422.severity = warning
####################################################################################################
# Maintainability Rules (CA1501-CA1516)
# Maintainability rules support library and application maintenance
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Part of dotNetDave's Editor Config Suite
####################################################################################################
[*.{cs,vb}]
# Avoid excessive inheritance
dotnet_diagnostic.CA1501.severity = warning
# Avoid excessive complexity
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1502.severity = error
# Avoid unmaintainable code
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1505.severity = error
# Avoid excessive class coupling
dotnet_diagnostic.CA1506.severity = error
# Use nameof in place of string
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1507.severity = warning
# Avoid dead conditional code
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1508.severity = error
# Invalid entry in code metrics configuration file
dotnet_diagnostic.CA1509.severity = error
# Use ArgumentNullException throw helper
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1510.severity = warning
# Use ArgumentException throw helper
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1511.severity = warning
# Use ArgumentOutOfRangeException throw helper
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1512.severity = warning
# Use ObjectDisposedException throw helper
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1513.severity = warning
# Avoid redundant length argument
dotnet_diagnostic.CA1514.severity = warning
# Consider making public types internal
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1515.severity = suggestion
####################################################################################################
# Naming Rules (CA1700-CA1727 and IDE0130)
# Naming rules support adherence to the naming conventions of the .NET design guidelines
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Part of dotNetDave's Editor Config Suite
####################################################################################################
[*.{cs,vb}]
# Namespace does not match folder structure
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0130.severity = warning
# Do not name enum values 'Reserved'
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_code_quality.CA1700.api_surface = public, protected
dotnet_diagnostic.CA1700.severity = error
# Identifiers should not contain underscores
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_code_quality.CA1707.api_surface = public, protected
dotnet_diagnostic.CA1707.severity = error
# Identifiers should differ by more than case
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1708.severity = error
# Identifiers should have correct suffix
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1710.severity = error
# Identifiers should not have incorrect suffix
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1711.severity = error
# Do not prefix enum values with type name
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1712.severity = error
# Events should not have Before or After prefix
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1713.severity = error
# Flags enums should have plural names
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1714.severity = error
# Identifiers should have correct prefix
dotnet_diagnostic.CA1715.severity = error
# Identifiers should not match keywords
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1716.severity = error
# Only FlagsAttribute enums should have plural names
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1717.severity = error
# Identifiers should not contain type names
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1720.severity = warning
# Property names should not match get methods
dotnet_diagnostic.CA1721.severity = error
# Type names should not match namespaces
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1724.severity = warning
# Parameter names should match base declaration
dotnet_diagnostic.CA1725.severity = warning
# Use PascalCase for named placeholders
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1727.severity = error
####################################################################################################
# Performance Rules (CA1802-CA1877)
# Performance rules support high-performance libraries and applications
# Examples in Rock Your Code: Code Performance in Microsoft .NET
# Part of dotNetDave's Editor Config Suite
####################################################################################################
[*.{cs,vb}]
# Use Literals Where Appropriate
# Examples in Rock Your Code: Code Performance in Microsoft .NET >
dotnet_diagnostic.CA1802.severity = suggestion
# Do not initialize unnecessarily
# Examples in Rock Your Code: Code Performance in Microsoft .NET
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1805.severity = error
# Do not ignore method results
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1806.severity = error
# Initialize reference type static fields inline
# Examples in Rock Your Code: Code Performance in Microsoft .NET >
dotnet_diagnostic.CA1810.severity = suggestion
# Avoid uninstantiated internal classes
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1812.severity = suggestion
# Avoid unsealed attributes
# Examples in Rock Your Code: Code Performance in Microsoft .NET >
dotnet_diagnostic.CA1813.severity = suggestion
# Prefer jagged arrays over multidimensional
dotnet_diagnostic.CA1814.severity = warning
# Override equals and operator equals on value types
# Examples in Rock Your Code: Code Performance in Microsoft .NET >
dotnet_diagnostic.CA1815.severity = warning
# Properties should not return arrays
# Examples in Rock Your Code: Code Performance in Microsoft .NET >
dotnet_diagnostic.CA1819.severity = warning
dotnet_code_quality.CA1819.api_surface = public, protected
# Test for empty strings using string length
# Examples in Rock Your Code: Code Performance in Microsoft .NET >
dotnet_diagnostic.CA1820.severity = error
# Remove empty finalizers
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1821.severity = error
# Mark members as static
# Examples in Rock Your Code: Coding Standards for Microsoft .NET >
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1822.severity = suggestion
# Avoid unused private fields
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1823.severity = error
# Mark assemblies with NeutralResourcesLanguageAttribute
dotnet_diagnostic.CA1824.severity = suggestion
# Avoid zero-length array allocations
# Examples in Rock Your Code: Code Performance in Microsoft .NET >
dotnet_diagnostic.CA1825.severity = suggestion
# Use property instead of Linq Enumerable method
# Examples in Rock Your Code: Code Performance in Microsoft .NET >
dotnet_diagnostic.CA1826.severity = error
# Do not use Count/LongCount when Any can be used
# Examples in Rock Your Code: Code Performance in Microsoft .NET >
dotnet_diagnostic.CA1827.severity = silent
# Do not use CountAsync/LongCountAsync when AnyAsync can be used
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1828.severity = silent
# Use Length/Count property instead of Enumerable.Count() method
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1829.severity = error
# Prefer strongly-typed Append and Insert method overloads on StringBuilder
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1830.severity = warning
# Use AsSpan instead of Range-based indexers for string when appropriate
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1831.severity = error
# Use AsSpan or AsMemory instead of Range-based indexers for getting ReadOnlySpan or ReadOnlyMemory portion of an array
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1832.severity = error
# Use AsSpan or AsMemory instead of Range-based indexers for getting Span or Memory portion of an array
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1833.severity = error
# Use StringBuilder.Append(char) for single character strings
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1834.severity = suggestion
# Prefer the memory-based overloads of ReadAsync/WriteAsync methods in stream-based classes
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1835.severity = warning
# Prefer IsEmpty over Count when available
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1836.severity = error
# Use Environment.ProcessId instead of Process.GetCurrentProcess().Id
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1837.severity = suggestion
# Avoid StringBuilder parameters for P/Invokes
dotnet_diagnostic.CA1838.severity = warning
# Use Environment.ProcessPath instead of Process.GetCurrentProcess().MainModule.FileName
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1839.severity = error
# Use Environment.CurrentManagedThreadId instead of Thread.CurrentThread.ManagedThreadId
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1840.severity = silent
# Prefer Dictionary Contains methods
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1841.severity = silent
# Do not use 'WhenAll' with a single task
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1842.severity = error
# Do not use 'WaitAll' with a single task
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1843.severity = error
# Provide memory-based overrides of async methods when subclassing 'Stream'
dotnet_diagnostic.CA1844.severity = warning
# Use span-based 'string.Concat'
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1845.severity = error
# Prefer AsSpan over Substring
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1846.severity = error
# Use string.Contains(char) instead of string.Contains(string) with single character
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1847.severity = error
# Use the LoggerMessage delegates
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1848.severity = error
# Call async methods when in an async method
dotnet_diagnostic.CA1849.severity = error
# Prefer static HashData method over ComputeHash
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1850.severity = error
# Possible multiple enumerations of IEnumerable collection
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1851.severity = error
# Seal internal types
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1852.severity = error
# Unnecessary call to 'Dictionary.ContainsKey(key)'
dotnet_diagnostic.CA1853.severity = error
# Prefer the IDictionary.TryGetValue(TKey, out TValue) method
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1854.severity = error
# Use Span<T>.Clear() instead of Span<T>.Fill()
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1855.severity = suggestion
# Incorrect usage of ConstantExpected attribute
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1856.severity = suggestion
# A constant is expected for the parameter
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1857.severity = suggestion
# Use StartsWith instead of IndexOf
dotnet_diagnostic.CA1858.severity = error
# Use concrete types when possible for improved performance
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1859.severity = warning
# Avoid using 'Enumerable.Any()' extension method
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1860.severity = error
# Avoid constant arrays as arguments
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1861.severity = warning
# Prefer the 'StringComparison' method overloads to perform case-insensitive string comparisons
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1862.severity = warning
# Use 'CompositeFormat'
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1863.severity = warning
# Prefer the 'IDictionary.TryAdd(TKey, TValue)' method
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1864.severity = suggestion
# Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1865.severity = error
dotnet_diagnostic.CA1866.severity = error
dotnet_diagnostic.CA1867.severity = error
# Unnecessary call to 'Contains' for sets
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1868.severity = error
# Cache and reuse 'JsonSerializerOptions' instances
dotnet_diagnostic.CA1869.severity = warning
# Use a cached 'SearchValues' instance
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1870.severity = error
# Do not pass a nullable struct to 'ArgumentNullException.ThrowIfNull'
dotnet_diagnostic.CA1871.severity = warning
# Prefer 'Convert.ToHexString' and 'Convert.ToHexStringLower' over call chains based on 'BitConverter.ToString'
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1872.severity = error
# CA1873: Use 'Convert.ToHexString' and 'Convert.ToHexStringLower'
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1873.severity = error
# CA1874: Prefer static HashData method over ComputeHash
dotnet_diagnostic.CA1874.severity = error
# CA1875: Use 'Regex.Count'
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA1875.severity = warning
# CA1877: Use 'Path.Combine' or 'Path.Join' overloads
dotnet_diagnostic.CA1877.severity = warning
####################################################################################################
# Reliability Rules (CA2000-CA2024)
# Reliability rules support library and application reliability
# Examples in Rock Your Code: Code Performance in Microsoft .NET
# Part of dotNetDave's Editor Config Suite
####################################################################################################
[*.{cs,vb}]
# Dispose objects before losing scope
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA2000.severity = error
# Do not lock on objects with weak identity
dotnet_diagnostic.CA2002.severity = error
# Do not directly await a Task
dotnet_diagnostic.CA2007.severity = error
# Do not create tasks without passing a TaskScheduler
dotnet_diagnostic.CA2008.severity = suggestion
# Do not call ToImmutableCollection on an ImmutableCollection value
dotnet_diagnostic.CA2009.severity = error
# Do not assign property within its setter
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA2011.severity = error
# Use ValueTasks correctly
dotnet_diagnostic.CA2012.severity = error
# Do not use ReferenceEquals with value types
dotnet_diagnostic.CA2013.severity = suggestion
# Do not use stackalloc in loops
dotnet_diagnostic.CA2014.severity = error
# Do not define finalizers for types derived from MemoryManager
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA2015.severity = error
# Forward the CancellationToken parameter to methods that take one
dotnet_diagnostic.CA2016.severity = suggestion
# Parameter count mismatch
dotnet_diagnostic.CA2017.severity = error
# The count argument to Buffer.BlockCopy should specify the number of bytes to copy
dotnet_diagnostic.CA2018.severity = warning
# ThreadStatic fields should not use inline initialization
dotnet_diagnostic.CA2019.severity = error
# Prevent behavioral change caused by built-in operators of IntPtr/UIntPtr
dotnet_diagnostic.CA2020.severity = warning
# Do not call Enumerable.Cast<T> or Enumerable.OfType<T> with incompatible types
dotnet_diagnostic.CA2021.severity = warning
# Avoid inexact read with Stream.Read
dotnet_diagnostic.CA2022.severity = warning
# Invalid braces in message template
dotnet_diagnostic.CA2023.severity = warning
# Do not use StreamReader.EndOfStream in async methods
dotnet_diagnostic.CA2024.severity = warning
####################################################################################################
# Security Rules (CA2100, CA2109, CA2119, CA2153, CA2300-CA5405, SEC001)
# Security rules support safer libraries and applications
# Part of dotNetDave's Editor Config Suite
####################################################################################################
[*.{cs,vb}]
# Review SQL queries for security vulnerabilities
dotnet_diagnostic.CA2100.severity = error
# Review visible event handlers
dotnet_diagnostic.CA2109.severity = warning
# Seal methods that satisfy private interfaces
dotnet_diagnostic.CA2119.severity = warning
# Avoid handling Corrupted State Exceptions
dotnet_diagnostic.CA2153.severity = warning
# Do not use insecure deserializer BinaryFormatter
dotnet_diagnostic.CA2300.severity = error
# Do not call BinaryFormatter.Deserialize without first setting BinaryFormatter.Binder
dotnet_diagnostic.CA2301.severity = warning
# Ensure BinaryFormatter.Binder is set before calling BinaryFormatter.Deserialize
dotnet_diagnostic.CA2302.severity = warning
# Do not use insecure deserializer LosFormatter
dotnet_diagnostic.CA2305.severity = error
# Do not use insecure deserializer NetDataContractSerializer
dotnet_diagnostic.CA2310.severity = error
# Do not deserialize without first setting NetDataContractSerializer.Binder
dotnet_diagnostic.CA2311.severity = warning
# Ensure NetDataContractSerializer.Binder is set before deserializing
dotnet_diagnostic.CA2312.severity = warning
# Do not use insecure deserializer ObjectStateFormatter
dotnet_diagnostic.CA2315.severity = warning
# Do not deserialize with JavaScriptSerializer using a SimpleTypeResolver
dotnet_diagnostic.CA2321.severity = warning
# Ensure JavaScriptSerializer is not initialized with SimpleTypeResolver before deserializing
dotnet_diagnostic.CA2322.severity = warning
# Do not use TypeNameHandling values other than None
dotnet_diagnostic.CA2326.severity = warning
# Do not use insecure JsonSerializerSettings
dotnet_diagnostic.CA2327.severity = error
# Ensure that JsonSerializerSettings are secure
dotnet_diagnostic.CA2328.severity = warning
# Do not deserialize with JsonSerializer using an insecure configuration
dotnet_diagnostic.CA2329.severity = error
# Ensure that JsonSerializer has a secure configuration when deserializing
dotnet_diagnostic.CA2330.severity = warning
# Ensure DataTable.ReadXml()'s input is trusted
dotnet_diagnostic.CA2350.severity = warning
# Ensure DataSet.ReadXml()'s input is trusted
dotnet_diagnostic.CA2351.severity = warning
# Unsafe DataSet or DataTable in serializable type can be vulnerable to remote code execution attacks
dotnet_diagnostic.CA2352.severity = error
# Unsafe DataSet or DataTable in serializable type
dotnet_diagnostic.CA2353.severity = error
# Unsafe DataSet or DataTable in deserialized object graph can be vulnerable to remote code execution attack
dotnet_diagnostic.CA2354.severity = error
# Unsafe DataSet or DataTable in deserialized object graph
dotnet_diagnostic.CA2355.severity = error
# Unsafe DataSet or DataTable type in web deserialized object graph
dotnet_diagnostic.CA2356.severity = error
# Ensure autogenerated class containing DataSet.ReadXml() is not used with untrusted data
dotnet_diagnostic.CA2361.severity = error
# Unsafe DataSet or DataTable in autogenerated serializable type can be vulnerable to remote code execution attacks
dotnet_diagnostic.CA2362.severity = error
# Review code for SQL injection vulnerabilities
dotnet_diagnostic.CA3001.severity = warning
# Review code for XSS vulnerabilities
dotnet_diagnostic.CA3002.severity = warning
# Review code for file path injection vulnerabilities
dotnet_diagnostic.CA3003.severity = warning
# Review code for information disclosure vulnerabilities
dotnet_diagnostic.CA3004.severity = warning
# Review code for LDAP injection vulnerabilities
dotnet_diagnostic.CA3005.severity = error
# Review code for process command injection vulnerabilities
dotnet_diagnostic.CA3006.severity = error
# Review code for open redirect vulnerabilities
dotnet_diagnostic.CA3007.severity = warning
# Review code for XPath injection vulnerabilities
dotnet_diagnostic.CA3008.severity = error
# Review code for XML injection vulnerabilities
dotnet_diagnostic.CA3009.severity = error
# Review code for XAML injection vulnerabilities
dotnet_diagnostic.CA3010.severity = error
# Review code for DLL injection vulnerabilities
dotnet_diagnostic.CA3011.severity = warning
# Review code for regex injection vulnerabilities
dotnet_diagnostic.CA3012.severity = warning
# Do Not Add Schema By URL
dotnet_diagnostic.CA3061.severity = warning
# Insecure DTD processing in XML
dotnet_diagnostic.CA3075.severity = warning
# Insecure XSLT script processing
dotnet_diagnostic.CA3076.severity = warning
# Insecure Processing in API Design, XmlDocument and XmlTextReader
dotnet_diagnostic.CA3077.severity = warning
# Mark Verb Handlers With Validate Antiforgery Token
dotnet_diagnostic.CA3147.severity = warning
# Do Not Use Weak Cryptographic Algorithms
dotnet_diagnostic.CA5350.severity = warning
# Do Not Use Broken Cryptographic Algorithms
dotnet_diagnostic.CA5351.severity = error
# Do Not Use Unsafe Cipher Modes
dotnet_diagnostic.CA5358.severity = warning
# Do Not Disable Certificate Validation
dotnet_diagnostic.CA5359.severity = warning
# Do Not Call Dangerous Methods In Deserialization
dotnet_diagnostic.CA5360.severity = warning
# Do Not Disable SChannel Use of Strong Crypto
dotnet_diagnostic.CA5361.severity = warning
# Do Not Refer Self In Serializable Class
dotnet_diagnostic.CA5362.severity = error
# Do Not Disable Request Validation
dotnet_diagnostic.CA5363.severity = warning
# Do Not Use Deprecated Security Protocols
dotnet_diagnostic.CA5364.severity = error
# Do Not Disable HTTP Header Checking
dotnet_diagnostic.CA5365.severity = warning
# Use XmlReader For DataSet Read Xml
dotnet_diagnostic.CA5366.severity = warning
# Do Not Serialize Types With Pointer Fields
dotnet_diagnostic.CA5367.severity = warning
# Set ViewStateUserKey For Classes Derived From Page
dotnet_diagnostic.CA5368.severity = warning
# Use XmlReader For Deserialize
dotnet_diagnostic.CA5369.severity = warning
# Use XmlReader For Validating Reader
dotnet_diagnostic.CA5370.severity = warning
# Use XmlReader For Schema Read
dotnet_diagnostic.CA5371.severity = warning
# Use XmlReader For XPathDocument
dotnet_diagnostic.CA5372.severity = warning
# Do not use obsolete key derivation function
dotnet_diagnostic.CA5373.severity = warning
# Do Not Use XslTransform
dotnet_diagnostic.CA5374.severity = warning
# Do Not Use Account Shared Access Signature
dotnet_diagnostic.CA5375.severity = warning
# Use SharedAccessProtocol HttpsOnly
dotnet_diagnostic.CA5376.severity = warning
# Use Container Level Access Policy
dotnet_diagnostic.CA5377.severity = warning
# Do not disable ServicePointManagerSecurityProtocols
dotnet_diagnostic.CA5378.severity = warning
# Do Not Use Weak Key Derivation Function Algorithm
dotnet_diagnostic.CA5379.severity = warning
# Do Not Add Certificates To Root Store
dotnet_diagnostic.CA5380.severity = warning
# Ensure Certificates Are Not Added To Root Store
dotnet_diagnostic.CA5381.severity = warning
# Use Secure Cookies In ASP.Net Core
dotnet_diagnostic.CA5382.severity = warning
# Ensure Use Secure Cookies In ASP.Net Core
dotnet_diagnostic.CA5383.severity = warning
# Do Not Use Digital Signature Algorithm (DSA)
dotnet_diagnostic.CA5384.severity = warning
# Use Rivest–Shamir–Adleman (RSA) Algorithm With Sufficient Key Size
dotnet_diagnostic.CA5385.severity = warning
# Avoid hardcoding SecurityProtocolType value
dotnet_diagnostic.CA5386.severity = warning
# Do Not Use Weak Key Derivation Function With Insufficient Iteration Count
dotnet_diagnostic.CA5387.severity = warning
# Ensure Sufficient Iteration Count When Using Weak Key Derivation Function
dotnet_diagnostic.CA5388.severity = warning
# Do Not Add Archive Item's Path To The Target File System Path
dotnet_diagnostic.CA5389.severity = warning
# Do Not Hard Code Encryption Key
dotnet_diagnostic.CA5390.severity = error
# Use antiforgery tokens in ASP.NET Core MVC controllers
dotnet_diagnostic.CA5391.severity = warning
# Use DefaultDllImportSearchPaths attribute for P/Invokes
dotnet_diagnostic.CA5392.severity = warning
# Do not use unsafe DllImportSearchPath value
dotnet_diagnostic.CA5393.severity = warning
# Do not use insecure randomness
dotnet_diagnostic.CA5394.severity = warning
# Miss HttpVerb attribute for action methods
dotnet_diagnostic.CA5395.severity = warning
# Set HttpOnly to true for HttpCookie
dotnet_diagnostic.CA5396.severity = warning
# Do not use deprecated SslProtocols values
dotnet_diagnostic.CA5397.severity = warning
# Avoid hardcoded SslProtocols values
dotnet_diagnostic.CA5398.severity = warning
# Definitely disable HttpClient certificate revocation list check
dotnet_diagnostic.CA5399.severity = warning
# Ensure HttpClient certificate revocation list check is not disabled
dotnet_diagnostic.CA5400.severity = warning
# Do not use CreateEncryptor with non-default IV
dotnet_diagnostic.CA5401.severity = suggestion
# Use CreateEncryptor with the default IV
dotnet_diagnostic.CA5402.severity = warning
# Do not hard-code certificate
dotnet_diagnostic.CA5403.severity = error
# Do not disable token validation checks
dotnet_diagnostic.CA5404.severity = error
# Do not always skip token validation in delegates
dotnet_diagnostic.CA5405.severity = error
dotnet_diagnostic.SEC001.severity = error
####################################################################################################
# SingleFile Rules (IL3000-IL3005)
# Single-file rules support single-file applications
# Part of dotNetDave's Editor Config Suite
####################################################################################################
[*.{cs,vb}]
# Avoid using accessing Assembly file path when publishing as a single-file
dotnet_diagnostic.IL3000.severity = error
# Avoid accessing Assembly file path when publishing as a single file
dotnet_diagnostic.IL3001.severity = error
# Avoid calling members annotated with 'RequiresAssemblyFilesAttribute' when publishing as a single file
dotnet_diagnostic.IL3002.severity = error
# RequiresAssemblyFilesAttribute annotations must match across all interface implementations or overrides
dotnet_diagnostic.IL3003.severity = error
# RequiresAssemblyFilesAttribute cannot be placed directly on application entry point
dotnet_diagnostic.IL3005.severity = error
####################################################################################################
# Style Rules (IDE0001-IDE0380)
# Style rules support consistent code style in your codebase
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Part of dotNetDave's Editor Config Suite
####################################################################################################
[*.{cs,vb}]
# Simplify name
dotnet_diagnostic.IDE0001.severity = warning
# Simplify member access
dotnet_diagnostic.IDE0002.severity = warning
# this and Me preferences
dotnet_diagnostic.IDE0003.severity = suggestion
dotnet_diagnostic.IDE0009.severity = suggestion
# Remove unnecessary cast
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDE0004.severity = error
# Remove unnecessary import
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0005.severity = warning
# Add missing cases to switch statement
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0010.severity = warning
# Add braces
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0011.severity = error
# Use throw expression
dotnet_diagnostic.IDE0016.severity = warning
# Use object initializers
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0017.severity = suggestion
# Inline variable declaration
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDE0018.severity = suggestion
# Use pattern matching to avoid 'as' followed by a 'null' check
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0019.severity = warning
# Use pattern matching to avoid 'is' check followed by a cast
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0020.severity = warning
# Use expression body for constructors
dotnet_diagnostic.IDE0021.severity = silent
# Use expression body for methods
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDE0022.severity = silent
# Use expression body for operators
dotnet_diagnostic.IDE0023.severity = suggestion
dotnet_diagnostic.IDE0024.severity = suggestion
# Use expression body for properties
dotnet_diagnostic.IDE0025.severity = silent
# Use expression body for indexers
dotnet_diagnostic.IDE0026.severity = suggestion
# Use expression body for accessors
dotnet_diagnostic.IDE0027.severity = silent
# Use collection initializers
dotnet_diagnostic.IDE0028.severity = suggestion
# Use coalesce expression
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDE0029.severity = suggestion
# Use coalesce expression (nullable types)
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDE0030.severity = suggestion
# Use null propagation
dotnet_diagnostic.IDE0031.severity = suggestion
# Use auto property
dotnet_diagnostic.IDE0032.severity = suggestion
# Use explicitly provided tuple name
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0033.severity = suggestion
# Simplify 'default' expression
dotnet_diagnostic.IDE0034.severity = suggestion
# Remove unreachable code
dotnet_diagnostic.IDE0035.severity = error
# Order modifiers
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0036.severity = warning
# Use inferred member name
dotnet_diagnostic.IDE0037.severity = suggestion
# Use pattern matching to avoid is check followed by a cast (without variable)
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0038.severity = warning
# Use local function instead of lambda
dotnet_diagnostic.IDE0039.severity = suggestion
# Add accessibility modifiers
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0040.severity = error
# Use is null check
dotnet_diagnostic.IDE0041.severity = suggestion
# Deconstruct variable declaration
dotnet_diagnostic.IDE0042.severity = suggestion
# Format string contains invalid placeholder
dotnet_diagnostic.IDE0043.severity = warning
# Add readonly modifier
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0044.severity = warning
# Use conditional expression for assignment
dotnet_diagnostic.IDE0045.severity = suggestion
# Use conditional expression for return
dotnet_diagnostic.IDE0046.severity = suggestion
# Parentheses preferences
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0047.severity = warning
dotnet_diagnostic.IDE0048.severity = warning
# Use language keywords instead of framework type names for type references
dotnet_diagnostic.IDE0049.severity = warning
# Convert anonymous type to tuple
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0050.severity = suggestion
# Remove unused private member
dotnet_diagnostic.IDE0051.severity = warning
# Remove unread private member
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0052.severity = error
# Use expression body for lambdas
dotnet_diagnostic.IDE0053.severity = suggestion
# Use compound assignment
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDE0054.severity = suggestion
# Fix formatting
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0055.severity = suggestion
# Use index operator
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0056.severity = suggestion
# Use range operator
dotnet_diagnostic.IDE0057.severity = suggestion
# Remove unnecessary expression value
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDE0058.severity = warning
# Remove unnecessary value assignment
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDE0059.severity = error
# Remove unused parameter
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDE0060.severity = error
# Use expression body for local functions
dotnet_diagnostic.IDE0061.severity = suggestion
# Make local function static
dotnet_diagnostic.IDE0062.severity = suggestion
# Use simple 'using' statement
dotnet_diagnostic.IDE0063.severity = suggestion
# Make struct fields writable
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0064.severity = suggestion
# 'using' directive placement
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0065.severity = error
# Use switch expression
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0066.severity = warning
# Use 'System.HashCode.Combine'
dotnet_diagnostic.IDE0070.severity = warning
# Add missing cases to switch expression
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0072.severity = suggestion
# Require file header
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0073.severity = warning
# Use compound assignment
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0074.severity = suggestion
# Simplify conditional expression
dotnet_diagnostic.IDE0075.severity = suggestion
# Remove invalid global 'SuppressMessageAttribute'
dotnet_diagnostic.IDE0076.severity = silent
# Avoid legacy format target in global 'SuppressMessageAttribute'
dotnet_diagnostic.IDE0077.severity = warning
# Use pattern matching
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0078.severity = warning
# Remove unnecessary suppression
dotnet_diagnostic.IDE0079.severity = error
# Remove unnecessary suppression operator
dotnet_diagnostic.IDE0080.severity = suggestion
# Remove ByVal
dotnet_diagnostic.IDE0081.severity = error
# Convert typeof to nameof
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0082.severity = warning
# Use pattern matching (not operator)
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0083.severity = warning
# Use pattern matching (IsNot operator)
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0084.severity = suggestion
# Simplify new expression
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDE0090.severity = suggestion
# Remove unnecessary equality operator
dotnet_diagnostic.IDE0100.severity = silent
# Use conditional delegate call
dotnet_diagnostic.IDE0105.severity = warning
# Remove unnecessary discard
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDE0110.severity = warning
# Simplify LINQ expression
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0120.severity = warning
# Simplify LINQ type check and cast
dotnet_diagnostic.IDE0121.severity = warning
# Simplify object creation
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0140.severity = suggestion
# Prefer 'null' check over type check
dotnet_diagnostic.IDE0150.severity = warning
# Use block-scoped namespace
dotnet_diagnostic.IDE0160.severity = suggestion
# Use file-scoped namespace
dotnet_diagnostic.IDE0161.severity = suggestion
# Simplify property pattern
dotnet_diagnostic.IDE0170.severity = warning
# Use tuple to swap values
dotnet_diagnostic.IDE0180.severity = suggestion
# Unnecessary lambda expression
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDE0200.severity = warning
# Convert to top-level statements
dotnet_diagnostic.IDE0210.severity = warning
# Convert to 'Program.Main' style program
dotnet_diagnostic.IDE0211.severity = suggestion
# Add explicit cast in foreach loop
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0220.severity = error
# Use UTF-8 string literal
dotnet_diagnostic.IDE0230.severity = warning
# Nullable directive is redundant
dotnet_diagnostic.IDE0240.severity = error
# Nullable directive is unnecessary
dotnet_diagnostic.IDE0241.severity = error
# Struct can be made 'readonly'
dotnet_diagnostic.IDE0250.severity = warning
# Member can be made 'readonly'
dotnet_diagnostic.IDE0251.severity = warning
# Use pattern matching
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0260.severity = warning
# Null check can be simplified
dotnet_diagnostic.IDE0270.severity = warning
# Use 'nameof'
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0280.severity = error
# Use primary constructor
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDE0290.severity = suggestion
# Use collection expression for array
dotnet_diagnostic.IDE0300.severity = warning
# Use collection expression for empty
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDE0301.severity = suggestion
# Use collection expression for stackalloc
dotnet_diagnostic.IDE0302.severity = warning
# Use collection expression for Create()
dotnet_diagnostic.IDE0303.severity = warning
# Use collection expression for builder
dotnet_diagnostic.IDE0304.severity = warning
# Use collection expression for fluent
dotnet_diagnostic.IDE0305.severity = warning
# Use collection expression for new
dotnet_diagnostic.IDE0306.severity = warning
# Make anonymous function static
dotnet_diagnostic.IDE0320.severity = warning
# Prefer 'System.Threading.Lock'
dotnet_diagnostic.IDE0330.severity = warning
# Use unbound generic type
dotnet_diagnostic.IDE0340.severity = warning
# Use implicitly typed lambda
dotnet_diagnostic.IDE0350.severity = warning
# Simplify property accessor
dotnet_diagnostic.IDE0360.severity = suggestion
# Remove unnecessary `unsafe` modifier
dotnet_diagnostic.IDE0380.severity = warning
# Remove unnecessary suppression (null-forgiving operator)
dotnet_diagnostic.IDE0370.severity = warning
# Naming rule violation
dotnet_diagnostic.IDE1006.severity = silent
# Embedded statements must be on their own line
dotnet_diagnostic.IDE2001.severity = warning
# Consecutive braces must not have blank line between them
dotnet_diagnostic.IDE2002.severity = warning
# Blank line required between block and subsequent statement
dotnet_diagnostic.IDE2003.severity = warning
# Blank line not allowed after constructor initializer colon
dotnet_diagnostic.IDE2004.severity = warning
# Blank line not allowed after conditional expression token
dotnet_diagnostic.IDE2005.severity = warning
# Blank line not allowed after arrow expression clause token
dotnet_diagnostic.IDE2006.severity = warning
####################################################################################################
# C# Style Rules - var preferences
####################################################################################################
[*.{cs,csx,cake}]
dotnet_diagnostic.IDE0007.severity = warning
dotnet_diagnostic.IDE0008.severity = warning
####################################################################################################
# Usage Rules (CA1801, CA1816, CA2200-CA2267)
# Usage rules support proper usage of .NET
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Part of dotNetDave's Editor Config Suite
####################################################################################################
[*.{cs,vb}]
# Review unused parameters
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1801.severity = warning
# Call GC.SuppressFinalize correctly
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA1816.severity = error
# Rethrow to preserve stack details
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA2200.severity = error
# Do not raise reserved exception types
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA2201.severity = error
# Initialize value type static fields inline
dotnet_diagnostic.CA2207.severity = warning
# Instantiate argument exceptions correctly
dotnet_diagnostic.CA2208.severity = error
# Non-constant fields should not be visible
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA2211.severity = error
# Disposable fields should be disposed
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA2213.severity = error
# Do not call overridable methods in constructors
dotnet_diagnostic.CA2214.severity = warning
# Dispose methods should call base class dispose
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA2215.severity = error
# Disposable types should declare finalizer
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA2216.severity = warning
# Do not mark enums with FlagsAttribute
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA2217.severity = error
# Override GetHashCode on overriding Equals
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA2218.severity = warning
# Do not raise exceptions in exception clauses
dotnet_diagnostic.CA2219.severity = error
# Override Equals on overloading operator equals
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA2224.severity = warning
# Operator overloads have named alternates
dotnet_diagnostic.CA2225.severity = warning
# Operators should have symmetrical overloads
dotnet_diagnostic.CA2226.severity = warning
# Collection properties should be read only
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA2227.severity = error
# Implement serialization constructors
dotnet_diagnostic.CA2229.severity = warning
# Overload operator equals on overriding ValueType.Equals
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA2231.severity = warning
# Pass System.Uri objects instead of strings
dotnet_diagnostic.CA2234.severity = warning
# Mark all non-serializable fields
dotnet_diagnostic.CA2235.severity = suggestion
# Mark ISerializable types with SerializableAttribute
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA2237.severity = warning
# Provide correct arguments to formatting methods
dotnet_diagnostic.CA2241.severity = warning
# Test for NaN correctly
dotnet_diagnostic.CA2242.severity = warning
# Attribute string literals should parse correctly
dotnet_diagnostic.CA2243.severity = warning
# Do not duplicate indexed element initializations
dotnet_diagnostic.CA2244.severity = warning
# Do not assign a property to itself
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA2245.severity = error
# Do not assign a symbol and its member in the same statement
dotnet_diagnostic.CA2246.severity = warning
# Argument passed to TaskCompletionSource constructor should be TaskCreationOptions enum instead of TaskContinuationOptions enum
dotnet_diagnostic.CA2247.severity = warning
# Provide correct enum argument to Enum.HasFlag
dotnet_diagnostic.CA2248.severity = warning
# Consider using String.Contains instead of String.IndexOf
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CA2249.severity = error
# Use ThrowIfCancellationRequested
dotnet_diagnostic.CA2250.severity = warning
# Use String.Equals over String.Compare
dotnet_diagnostic.CA2251.severity = warning
# Opt in to preview features
dotnet_diagnostic.CA2252.severity = suggestion
# Named placeholders should not be numeric values
dotnet_diagnostic.CA2253.severity = warning
# Template should be a static expression
dotnet_diagnostic.CA2254.severity = warning
# The ModuleInitializer attribute should not be used in libraries
dotnet_diagnostic.CA2255.severity = warning
# All members declared in parent interfaces must have an implementation in a DynamicInterfaceCastableImplementation-attributed interface
dotnet_diagnostic.CA2256.severity = warning
# Members defined on an interface with 'DynamicInterfaceCastableImplementationAttribute' should be 'static'
dotnet_diagnostic.CA2257.severity = warning
# Providing a 'DynamicInterfaceCastableImplementation' interface in Visual Basic is unsupported
dotnet_diagnostic.CA2258.severity = warning
# Ensure ThreadStatic is only used with static fields
dotnet_diagnostic.CA2259.severity = error
# Implement generic math interfaces correctly
dotnet_diagnostic.CA2260.severity = warning
# Do not use ConfigureAwaitOptions.SuppressThrowing with Task<TResult>
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.CA2261.severity = warning
# Set 'MaxResponseHeadersLength' properly
dotnet_diagnostic.CA2262.severity = warning
# Do not pass a non-nullable value to 'ArgumentNullException.ThrowIfNull'
dotnet_diagnostic.CA2264.severity = warning
# Do not compare Span<T> to null or default
dotnet_diagnostic.CA2265.severity = error
# Use correct type parameter
dotnet_diagnostic.CA2266.severity = warning
# Use correct type parameter for 'IAsyncEnumerable.ConfigureAwait'
dotnet_diagnostic.CA2267.severity = warning
####################################################################################################
# External Analyzer Rules
# Rules from StyleCop, Async, Dispose, Regex, JSON, MSTest, and other third-party analyzers
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Part of dotNetDave's Editor Config Suite
####################################################################################################
[*.{cs,vb}]
####################################################################################################
# StyleCop Analyzer Rules (SA)
####################################################################################################
# A violation of this rule occurs when a compilation (project) contains files with DocumentationMode set to None
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA0001.severity = warning
# The spacing around a C# keyword is incorrect
dotnet_diagnostic.SA1000.severity = warning
# DoNotPrefixCallsWithBaseUnlessLocalImplementationExists
dotnet_diagnostic.SA1100.severity = warning
# StatementMustNotUseUnnecessaryParenthesis
dotnet_diagnostic.SA1119.severity = suggestion
# CommentsMustContainText
dotnet_diagnostic.SA1120.severity = warning
# DoNotUseRegions
dotnet_diagnostic.SA1124.severity = warning
# UsingDirectivesMustBePlacedCorrectly
dotnet_diagnostic.SA1200.severity = warning
# ElementsMustAppearInTheCorrectOrder
dotnet_diagnostic.SA1201.severity = warning
# ElementsMustBeOrderedByAccess
dotnet_diagnostic.SA1202.severity = warning
# ElementMustBeginWithUpperCaseLetter
dotnet_diagnostic.SA1300.severity = error
# InterfaceNamesMustBeginWithI
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1302.severity = error
# ConstFieldNamesMustBeginWithUpperCaseLetter
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1303.severity = error
# FieldNamesMustNotUseHungarianNotation
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1305.severity = warning
# VariableNamesMustNotBePrefixed
dotnet_diagnostic.SA1308.severity = error
# A field name in C# begins with an underscore
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1309.severity = silent
# VariableNamesMustBeginWithLowerCaseLetter
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1312.severity = warning
# ParameterNamesMustBeginWithLowerCaseLetter
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1313.severity = error
# TupleElementNamesShouldUseCorrectCasing
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1316.severity = warning
# AccessModifierMustBeDeclared
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1400.severity = warning
# FieldsMustBePrivate
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1401.severity = error
# FileMayOnlyContainASingleNamespace
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1403.severity = error
# A Code Analysis SuppressMessage attribute does not include a justification
dotnet_diagnostic.SA1404.severity = error
# DebugAssertMustProvideMessageText
dotnet_diagnostic.SA1405.severity = warning
# DebugFailMustProvideMessageText
dotnet_diagnostic.SA1406.severity = warning
# RemoveUnnecessaryCode
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1409.severity = error
# BracesForMultiLineStatementsMustNotShareLine
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1500.severity = error
# ElementMustNotBeOnSingleLine
dotnet_diagnostic.SA1502.severity = error
# BracesMustNotBeOmitted
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1503.severity = error
# ClosingBraceMustBeFollowedByBlankLine
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1513.severity = warning
# UseBracesConsistently
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.SA1520.severity = error
# File header copyright text should match
dotnet_diagnostic.SA1636.severity = none
# ElementDocumentationMustBeSpelledCorrectly
dotnet_diagnostic.SA1650.severity = warning
####################################################################################################
# Dispose Analyzer Rules (IDISP)
####################################################################################################
# Dispose created
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDISP001.severity = error
# Dispose member
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP002.severity = error
# Dispose previous before re-assigning
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP003.severity = error
# Don't ignore created IDisposable
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP004.severity = error
# Return type should indicate that the value should be disposed
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP005.severity = error
# Implement IDisposable
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDISP006.severity = error
# Don't dispose injected
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP007.severity = error
# Don't assign member with injected and created disposables
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP008.severity = error
# Add IDisposable interface
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.IDISP009.severity = error
# Call base.Dispose(disposing)
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP010.severity = error
# Don't return disposed instance
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP011.severity = warning
# Property should not return created disposable
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP012.severity = error
# Await in using
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP013.severity = error
# Use a single instance of HttpClient
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP014.severity = warning
# Member should not return created and cached instance
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP015.severity = error
# Don't use disposed instance
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP016.severity = error
# Prefer using
dotnet_diagnostic.IDISP017.severity = error
# Inline variable declaration
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP018.severity = error
# Call SuppressFinalize
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP019.severity = error
# Use pattern matching to avoid is check followed by a cast (with variable)
dotnet_diagnostic.IDISP020.severity = error
# Call this.Dispose(true)
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP021.severity = error
# Call this.Dispose(false)
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP022.severity = error
# Don't use reference types in finalizer context
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP023.severity = error
# Don't call GC.SuppressFinalize(this) when the type is sealed and has no finalizer
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP024.severity = error
# Class with no virtual dispose method should be sealed
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP025.severity = error
# Class with no virtual DisposeAsyncCore method should be sealed
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.IDISP026.severity = error
####################################################################################################
# Async Analyzer Rules (ASYNC, VSTHRD, RCS)
####################################################################################################
# Asynchronous method names should end with Async
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.ASYNC0001.severity = error
# Non asynchronous method names should not end with Async
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.ASYNC0002.severity = error
# Avoid void returning asynchronous method
dotnet_diagnostic.ASYNC0003.severity = warning
# Use ConfigureAwait(false) on await expression
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.ASYNC0004.severity = error
# Do not use blocking call (make method async)
dotnet_diagnostic.MA0045.severity = none
# Call 'ConfigureAwait(false)'
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.RCS1090.severity = error
# Return completed task instead of returning null
dotnet_diagnostic.RCS1210.severity = error
# AsyncifyInvocation: Use Task Async
dotnet_diagnostic.AsyncifyInvocation.severity = error
# AsyncifyVariable: Use Task Async
dotnet_diagnostic.AsyncifyVariable.severity = error
# Avoid legacy thread switching methods
dotnet_diagnostic.VSTHRD001.severity = error
# Avoid problematic synchronous waits
dotnet_diagnostic.VSTHRD002.severity = error
# Avoid awaiting foreign Tasks
dotnet_diagnostic.VSTHRD003.severity = error
# Await SwitchToMainThreadAsync
dotnet_diagnostic.VSTHRD004.severity = error
# Invoke single-threaded types on Main thread
dotnet_diagnostic.VSTHRD010.severity = error
# Use AsyncLazy<T>
dotnet_diagnostic.VSTHRD011.severity = error
# Provide JoinableTaskFactory where allowed
dotnet_diagnostic.VSTHRD012.severity = error
# Avoid async void methods
dotnet_diagnostic.VSTHRD100.severity = error
# Avoid unsupported async delegates
dotnet_diagnostic.VSTHRD101.severity = error
# Implement internal logic asynchronously
dotnet_diagnostic.VSTHRD102.severity = error
# Call async methods when in an async method
dotnet_diagnostic.VSTHRD103.severity = error
# Offer async option
dotnet_diagnostic.VSTHRD104.severity = warning
# Avoid method overloads that assume TaskScheduler.Current
dotnet_diagnostic.VSTHRD105.severity = warning
# Use InvokeAsync to raise async events
dotnet_diagnostic.VSTHRD106.severity = error
# Await Task within using expression
dotnet_diagnostic.VSTHRD107.severity = error
# Assert thread affinity unconditionally
dotnet_diagnostic.VSTHRD108.severity = error
# Switch instead of assert in async methods
dotnet_diagnostic.VSTHRD109.severity = error
# Observe result of async calls
dotnet_diagnostic.VSTHRD110.severity = error
# Use .ConfigureAwait(bool)
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
# Examples in Rock Your Code: Code Performance in Microsoft .NET
dotnet_diagnostic.VSTHRD111.severity = error
# Implement System.IAsyncDisposable
dotnet_diagnostic.VSTHRD112.severity = error
# Check for System.IAsyncDisposable
dotnet_diagnostic.VSTHRD113.severity = error
# Avoid returning a null Task
dotnet_diagnostic.VSTHRD114.severity = error
# Use "Async" suffix for async methods
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.VSTHRD200.severity = error
# Asynchronous method name should end with 'Async'
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.RCS1046.severity = error
# Non-asynchronous method name should not end with 'Async'
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.RCS1047.severity = error
####################################################################################################
# Class Analyzer Rules
####################################################################################################
# Seal Class
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.CLASS0001.severity = warning
####################################################################################################
# Enum Analyzer Rules
####################################################################################################
# Default switch label
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.ENUM0001.severity = error
# Merge switch sections
dotnet_diagnostic.ENUM0002.severity = warning
# Populate switch
# Examples in Rock Your Code: Coding Standards for Microsoft .NET
dotnet_diagnostic.ENUM0003.severity = warning
####################################################################################################
# Regex Analyzer Rules (RE)
####################################################################################################
# Invalid regex pattern
dotnet_diagnostic.RE0001.severity = warning
####################################################################################################
# JSON Analyzer Rules
####################################################################################################
# Invalid JSON pattern
dotnet_diagnostic.JSON001.severity = suggestion
# Probable JSON string detected
dotnet_diagnostic.JSON002.severity = suggestion
####################################################################################################
# Return Analyzer Rules
####################################################################################################
# Do not return null
dotnet_diagnostic.RETURN0001.severity = warning
####################################################################################################
# Roslynator Analyzer Rules (RCS)
####################################################################################################
# Simplify boolean comparison
dotnet_diagnostic.RCS1049.severity = silent
# Remove unnecessary 'Imports' or 'using' directive
dotnet_diagnostic.RemoveUnnecessaryImportsFixable.severity = warning
####################################################################################################
# MSTest Analyzer Rules (MSTEST)
####################################################################################################
# Explicitly enable or disable tests parallelization
dotnet_diagnostic.MSTEST0001.severity = warning
# Test classes should have valid layout
dotnet_diagnostic.MSTEST0002.severity = warning
# Test methods should have valid layout
dotnet_diagnostic.MSTEST0003.severity = warning
# Public types should be test classes
dotnet_diagnostic.MSTEST0004.severity = none
# Test context property should have valid layout
dotnet_diagnostic.MSTEST0005.severity = warning
# Avoid [ExpectedException]
dotnet_diagnostic.MSTEST0006.severity = warning
# Use test attributes only on test methods
dotnet_diagnostic.MSTEST0007.severity = warning
# TestInitialize method should have valid layout
dotnet_diagnostic.MSTEST0008.severity = warning
# TestCleanup method should have valid layout
dotnet_diagnostic.MSTEST0009.severity = warning
# ClassInitialize method should have valid layout
dotnet_diagnostic.MSTEST0010.severity = warning
# ClassCleanup method should have valid layout
dotnet_diagnostic.MSTEST0011.severity = warning
# AssemblyInitialize method should have valid layout
dotnet_diagnostic.MSTEST0012.severity = warning
# AssemblyCleanup method should have valid layout
dotnet_diagnostic.MSTEST0013.severity = warning
# DataRow should be valid
dotnet_diagnostic.MSTEST0014.severity = warning
# Test method should not be ignored
dotnet_diagnostic.MSTEST0015.severity = warning
# Test class should have test method
dotnet_diagnostic.MSTEST0016.severity = warning
# Assertion arguments should be passed in the correct order
dotnet_diagnostic.MSTEST0017.severity = warning
# DynamicData should be valid
dotnet_diagnostic.MSTEST0018.severity = warning
# Prefer TestInitialize methods over constructors
dotnet_diagnostic.MSTEST0019.severity = warning
# Prefer constructors over TestInitialize methods
dotnet_diagnostic.MSTEST0020.severity = warning
# Prefer Dispose over TestCleanup methods
dotnet_diagnostic.MSTEST0021.severity = warning
# Prefer TestCleanup methods over Dispose
dotnet_diagnostic.MSTEST0022.severity = warning
# Do not negate boolean assertions
dotnet_diagnostic.MSTEST0023.severity = warning
# Do not store TestContext in a static member
dotnet_diagnostic.MSTEST0024.severity = warning
# Use 'Assert.Fail' instead of an always-failing assert
dotnet_diagnostic.MSTEST0025.severity = warning
# Avoid conditional access in assertions
dotnet_diagnostic.MSTEST0026.severity = warning
# Non-nullable reference not initialized suppressor
dotnet_diagnostic.MSTEST0027.severity = none
# Non-nullable reference not initialized suppressor
dotnet_diagnostic.MSTEST0028.severity = none
# Public method should be test method
dotnet_diagnostic.MSTEST0029.severity = warning
# Type containing [TestMethod] should be marked with [TestClass]
dotnet_diagnostic.MSTEST0030.severity = warning
# System.ComponentModel.DescriptionAttribute has no effect on test methods
dotnet_diagnostic.MSTEST0031.severity = warning
# Review or remove the assertion as its condition is known to be always true
dotnet_diagnostic.MSTEST0032.severity = warning
# Non-nullable reference not initialized suppressor
dotnet_diagnostic.MSTEST0033.severity = none
# Use ClassCleanupBehavior.EndOfClass with the [ClassCleanup]
dotnet_diagnostic.MSTEST0034.severity = warning
# [DeploymentItem] can be specified only on test class or test method
dotnet_diagnostic.MSTEST0035.severity = warning
# Do not use shadowing inside test class
dotnet_diagnostic.MSTEST0036.severity = warning
# Use proper 'Assert' methods
dotnet_diagnostic.MSTEST0037.severity = warning
# Don't use 'Assert.AreSame' or 'Assert.AreNotSame' with value types
dotnet_diagnostic.MSTEST0038.severity = warning
# Use newer 'Assert.Throws' methods
dotnet_diagnostic.MSTEST0039.severity = warning
# Do not assert inside 'async void' contexts
dotnet_diagnostic.MSTEST0040.severity = warning
# Use 'ConditionBaseAttribute' on test classes
dotnet_diagnostic.MSTEST0041.severity = warning
####################################################################################################
# Obsolete API Rules (SYSLIB)
# Rules for obsolete .NET APIs and platform-specific warnings
# Part of dotNetDave's Editor Config Suite
####################################################################################################
[*.{cs,vb}]
# The UTF-7 encoding is insecure
dotnet_diagnostic.SYSLIB0001.severity = error
# PrincipalPermissionAttribute is obsolete
dotnet_diagnostic.SYSLIB0002.severity = error
# Code access security is not supported
dotnet_diagnostic.SYSLIB0003.severity = error
# The constrained execution region (CER) feature is not supported
dotnet_diagnostic.SYSLIB0004.severity = error
# The global assembly cache (GAC) is not supported
dotnet_diagnostic.SYSLIB0005.severity = error
# Thread.Abort is not supported
dotnet_diagnostic.SYSLIB0006.severity = error
# Default implementations of cryptography algorithms not supported
dotnet_diagnostic.SYSLIB0007.severity = error
# CreatePdbGenerator is not supported
dotnet_diagnostic.SYSLIB0008.severity = error
# The AuthenticationManager Authenticate and PreAuthenticate methods are not supported
dotnet_diagnostic.SYSLIB0009.severity = error
# Unsupported remoting APIs
dotnet_diagnostic.SYSLIB0010.severity = error
# BinaryFormatter serialization is obsolete
dotnet_diagnostic.SYSLIB0011.severity = error
# Type or member is obsolete
dotnet_diagnostic.SYSLIB0012.severity = error
# EscapeUriString is obsolete
dotnet_diagnostic.SYSLIB0013.severity = error
# WebRequest, HttpWebRequest, ServicePoint, WebClient are obsolete
dotnet_diagnostic.SYSLIB0014.severity = error
# DisablePrivateReflectionAttribute is obsolete
dotnet_diagnostic.SYSLIB0015.severity = error
# GetContextInfo() is obsolete
dotnet_diagnostic.SYSLIB0016.severity = error
# Strong-name signing is not supported and throws PlatformNotSupportedException
dotnet_diagnostic.SYSLIB0017.severity = error
# Reflection-only loading is not supported and throws PlatformNotSupportedException
dotnet_diagnostic.SYSLIB0018.severity = error
# Some RuntimeEnvironment APIs are obsolete
dotnet_diagnostic.SYSLIB0019.severity = error
# IgnoreNullValues is obsolete
dotnet_diagnostic.SYSLIB0020.severity = error
# Derived cryptographic types are obsolete
dotnet_diagnostic.SYSLIB0021.severity = error
# The Rijndael and RijndaelManaged types are obsolete
dotnet_diagnostic.SYSLIB0022.severity = error
# RNGCryptoServiceProvider is obsolete
dotnet_diagnostic.SYSLIB0023.severity = error
# Creating and unloading AppDomains is not supported and throws an exception
dotnet_diagnostic.SYSLIB0024.severity = error
# SuppressIldasmAttribute is obsolete
dotnet_diagnostic.SYSLIB0025.severity = error
# X509Certificate and X509Certificate2 are immutable
dotnet_diagnostic.SYSLIB0026.severity = error
# PublicKey.Key is obsolete
dotnet_diagnostic.SYSLIB0027.severity = error
# X509Certificate2.PrivateKey is obsolete
dotnet_diagnostic.SYSLIB0028.severity = error
# ProduceLegacyHmacValues is obsolete
dotnet_diagnostic.SYSLIB0029.severity = error
# HMACSHA1 always uses the algorithm implementation provided by the platform
dotnet_diagnostic.SYSLIB0030.severity = error
# EncodeOID is obsolete
dotnet_diagnostic.SYSLIB0031.severity = error
# Recovery from corrupted process state exceptions is not supported
dotnet_diagnostic.SYSLIB0032.severity = error
# Rfc2898DeriveBytes.CryptDeriveKey is obsolete
dotnet_diagnostic.SYSLIB0033.severity = error
# CmsSigner(CspParameters) constructor is obsolete
dotnet_diagnostic.SYSLIB0034.severity = error
# ComputeCounterSignature without specifying a CmsSigner is obsolete
dotnet_diagnostic.SYSLIB0035.severity = error
# Regex.CompileToAssembly is obsolete
dotnet_diagnostic.SYSLIB0036.severity = error
# AssemblyName members HashAlgorithm, ProcessorArchitecture, and VersionCompatibility are obsolete
dotnet_diagnostic.SYSLIB0037.severity = error
# SerializationFormat.Binary is obsolete
dotnet_diagnostic.SYSLIB0038.severity = error
# SslProtocols.Tls and SslProtocols.Tls11 are obsolete
dotnet_diagnostic.SYSLIB0039.severity = error
# EncryptionPolicy.NoEncryption and EncryptionPolicy.AllowNoEncryption are obsolete
dotnet_diagnostic.SYSLIB0040.severity = error
# Some Rfc2898DeriveBytes constructors are obsolete
dotnet_diagnostic.SYSLIB0041.severity = error
# FromXmlString and ToXmlString on ECC types are obsolete
dotnet_diagnostic.SYSLIB0042.severity = error
# ECDiffieHellmanPublicKey.ToByteArray is obsolete
dotnet_diagnostic.SYSLIB0043.severity = error
# AssemblyName.CodeBase and AssemblyName.EscapedCodeBase are obsolete
dotnet_diagnostic.SYSLIB0044.severity = error
# Some cryptographic factory methods are obsolete
dotnet_diagnostic.SYSLIB0045.severity = error
# ControlledExecution.Run should not be used
dotnet_diagnostic.SYSLIB0046.severity = error
# XmlSecureResolver is obsolete
dotnet_diagnostic.SYSLIB0047.severity = error
# RSA.EncryptValue(Byte[]) and RSA.DecryptValue(Byte[]) are obsolete
dotnet_diagnostic.SYSLIB0048.severity = error
# JsonSerializerOptions.AddContext is obsolete
dotnet_diagnostic.SYSLIB0049.severity = error
# Formatter-based serialization is obsolete
dotnet_diagnostic.SYSLIB0050.severity = error
# APIs that support obsolete formatter-based serialization are obsolete
dotnet_diagnostic.SYSLIB0051.severity = error
# APIs that support obsolete mechanisms for Regex extensibility are obsolete
dotnet_diagnostic.SYSLIB0052.severity = error
# AesGcm should indicate the required tag size for encryption and decryption
dotnet_diagnostic.SYSLIB0053.severity = error
# Thread.VolatileRead and Thread.VolatileWrite are obsolete
dotnet_diagnostic.SYSLIB0054.severity = warning
# AdvSimd.ShiftRightLogicalRoundedNarrowingSaturate* methods with signed parameters are obsolete
dotnet_diagnostic.SYSLIB0055.severity = warning
# Assembly.LoadFrom that takes an AssemblyHashAlgorithm is obsolete
dotnet_diagnostic.SYSLIB0056.severity = warning
# X509Certificate2 and X509Certificate constructors for binary and file content are obsolete
dotnet_diagnostic.SYSLIB0057.severity = warning
# The KeyExchangeAlgorithm, KeyExchangeStrength, CipherAlgorithm, CipherAlgorithmStrength, HashAlgorithm, and HashStrength properties of SslStream are obsolete
dotnet_diagnostic.SYSLIB0058.severity = warning
# SystemEvents.EventsThreadShutdown callbacks aren't run before the process exits
dotnet_diagnostic.SYSLIB0059.severity = warning
# Rfc2898DeriveBytes constructors are obsolete
dotnet_diagnostic.SYSLIB0060.severity = error
# System.Linq.Queryable.MaxBy and System.Linq.Queryable.MinBy taking an IComparer<TSource> are obsolete
dotnet_diagnostic.SYSLIB0061.severity = error
####################################################################################################
# Source Generator Diagnostics (SYSLIB1xxx)
####################################################################################################
# Logging method names can't start with an underscore
dotnet_diagnostic.SYSLIB1001.severity = error
# Don't include log level parameters as templates in the logging message
dotnet_diagnostic.SYSLIB1002.severity = error
# Logging method parameter names can't start with an underscore
dotnet_diagnostic.SYSLIB1003.severity = error
# Could not find a required type definition
dotnet_diagnostic.SYSLIB1005.severity = error
# Multiple logging methods cannot use the same event ID
dotnet_diagnostic.SYSLIB1006.severity = error
# Logging methods must return void
dotnet_diagnostic.SYSLIB1007.severity = error
# One of the arguments to a logging method must implement the ILogger interface
dotnet_diagnostic.SYSLIB1008.severity = error
# Logging methods must be static
dotnet_diagnostic.SYSLIB1009.severity = error
# Logging methods must be partial
dotnet_diagnostic.SYSLIB1010.severity = error
# Logging methods cannot be generic
dotnet_diagnostic.SYSLIB1011.severity = error
# Redundant qualifier in logging message
dotnet_diagnostic.SYSLIB1012.severity = error
# Don't include exception parameters as templates in the logging message
dotnet_diagnostic.SYSLIB1013.severity = error
# Logging template has no corresponding method argument
dotnet_diagnostic.SYSLIB1014.severity = error
# Argument is not referenced from the logging message
dotnet_diagnostic.SYSLIB1015.severity = error
# Logging methods cannot have a body
dotnet_diagnostic.SYSLIB1016.severity = error
# A LogLevel value must be supplied in the LoggerMessage attribute or as a parameter to the logging method
dotnet_diagnostic.SYSLIB1017.severity = error
# Don't include logger parameters as templates in the logging message
dotnet_diagnostic.SYSLIB1018.severity = error
# Couldn't find a field of type ILogger
dotnet_diagnostic.SYSLIB1019.severity = error
# Found multiple fields of type ILogger
dotnet_diagnostic.SYSLIB1020.severity = error
# Multiple message-template item names differ only by case
dotnet_diagnostic.SYSLIB1021.severity = error
# Can't have malformed format strings
dotnet_diagnostic.SYSLIB1022.severity = error
# Generating more than six arguments is not supported
dotnet_diagnostic.SYSLIB1023.severity = error
# System.Text.Json source generator did not generate output for type
dotnet_diagnostic.SYSLIB1030.severity = error
# System.Text.Json source generator encountered a duplicate type info property name
dotnet_diagnostic.SYSLIB1031.severity = error
# Context classes to be augmented by the System.Text.Json source generator must be declared as partial
dotnet_diagnostic.SYSLIB1032.severity = error
# System.Text.Json source generator encountered a type with multiple [JsonConstructor] annotations
dotnet_diagnostic.SYSLIB1033.severity = warning
# JsonSourceGenerator encountered a [JsonStringEnumConverter] annotation
dotnet_diagnostic.SYSLIB1034.severity = warning
# System.Text.Json source generator encountered a type with multiple [JsonExtensionData] annotations
dotnet_diagnostic.SYSLIB1035.severity = error
# System.Text.Json source generator encountered an invalid [JsonExtensionData] annotation
dotnet_diagnostic.SYSLIB1036.severity = error
# System.Text.Json source generator encountered a type with init-only properties which are not supported for deserialization
dotnet_diagnostic.SYSLIB1037.severity = error
# System.Text.Json source generator encountered a property annotated with [JsonInclude] but with inaccessible accessors
dotnet_diagnostic.SYSLIB1038.severity = error
# Invalid GeneratedRegexAttribute usage
dotnet_diagnostic.SYSLIB1040.severity = error
# Multiple GeneratedRegexAttribute attributes were applied to the same method, but only one is allowed
dotnet_diagnostic.SYSLIB1041.severity = error
# The specified regular expression is invalid
dotnet_diagnostic.SYSLIB1042.severity = error
# A GeneratedRegexAttribute method must be partial, parameterless, non-generic, and non-abstract, and return Regex
dotnet_diagnostic.SYSLIB1043.severity = error
# The regex generator couldn't generate a complete source implementation for the specified regular expression due to an internal limitation
dotnet_diagnostic.SYSLIB1044.severity = error
# Use GeneratedRegexAttribute to generate the regular expression implementation at compile time
dotnet_diagnostic.SYSLIB1045.severity = warning
# Invalid LibraryImportAttribute usage
dotnet_diagnostic.SYSLIB1050.severity = error
# The specified type is not supported by source-generated p/invokes
dotnet_diagnostic.SYSLIB1051.severity = error
# The specified configuration is not supported by source-generated p/invokes
dotnet_diagnostic.SYSLIB1052.severity = error
# The specified LibraryImportAttribute arguments cannot be forwarded to DllImportAttribute
dotnet_diagnostic.SYSLIB1053.severity = error
# Use LibraryImportAttribute instead of DllImportAttribute to generate p/invoke marshalling code at compile time
dotnet_diagnostic.SYSLIB1054.severity = error
# Invalid CustomMarshallerAttribute usage
dotnet_diagnostic.SYSLIB1055.severity = error
# The specified native type is invalid
dotnet_diagnostic.SYSLIB1056.severity = error
# The marshaller type does not have the required shape
dotnet_diagnostic.SYSLIB1057.severity = error
# Invalid NativeMarshallingAttribute usage
dotnet_diagnostic.SYSLIB1058.severity = error
# The marshaller type does not support an allocating constructor
dotnet_diagnostic.SYSLIB1059.severity = error
# The specified marshaller type is invalid
dotnet_diagnostic.SYSLIB1060.severity = error
# The marshaller type has incompatible method signatures
dotnet_diagnostic.SYSLIB1061.severity = error
# The project must be updated with <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
dotnet_diagnostic.SYSLIB1062.severity = error
# Invalid JSImportAttribute usage
dotnet_diagnostic.SYSLIB1070.severity = error
# Invalid JSExportAttribute usage
dotnet_diagnostic.SYSLIB1071.severity = error
# The specified type is not supported by source-generated JavaScript interop
dotnet_diagnostic.SYSLIB1072.severity = error
# The specified configuration is not supported by source-generated JavaScript interop
dotnet_diagnostic.SYSLIB1073.severity = error
# JSImportAttribute requires unsafe code
dotnet_diagnostic.SYSLIB1074.severity = error
# JSExportAttribute requires unsafe code
dotnet_diagnostic.SYSLIB1075.severity = error
# Invalid GeneratedComInterfaceAttribute usage
dotnet_diagnostic.SYSLIB1090.severity = error
# Method is declared in different partial declaration than the GeneratedComInterface attribute
dotnet_diagnostic.SYSLIB1091.severity = error
# Usage of LibraryImport or GeneratedComInterface attribute does not follow recommendation
dotnet_diagnostic.SYSLIB1092.severity = error
# Analysis for COM interface generation has failed
dotnet_diagnostic.SYSLIB1093.severity = error
# The base COM interface failed to generate source. Code will not be generated for this interface
dotnet_diagnostic.SYSLIB1094.severity = error
# Invalid GeneratedComClassAttribute usage
dotnet_diagnostic.SYSLIB1095.severity = error
# Use GeneratedComInterfaceAttribute instead of ComImportAttribute to generate COM marshalling code at compile time
dotnet_diagnostic.SYSLIB1096.severity = error
# This type implements at least one type with the GeneratedComInterfaceAttribute attribute
dotnet_diagnostic.SYSLIB1097.severity = error
# .NET COM hosting with EnableComHosting only supports built-in COM interop
dotnet_diagnostic.SYSLIB1098.severity = error
# COM Interop APIs on System.Runtime.InteropServices.Marshal do not support source-generated COM and will fail at run time
dotnet_diagnostic.SYSLIB1099.severity = error
# Type is not supported
dotnet_diagnostic.SYSLIB1100.severity = error
# Property on type is not supported
dotnet_diagnostic.SYSLIB1101.severity = error
# Project's language version must be at least C# 11
dotnet_diagnostic.SYSLIB1102.severity = error
# Value types are invalid inputs to configuration 'Bind' methods
dotnet_diagnostic.SYSLIB1103.severity = error
# Generator cannot determine the target configuration type
dotnet_diagnostic.SYSLIB1104.severity = error
# Can't use ValidateObjectMembersAttribute or ValidateEnumeratedItemsAttribute on fields or properties with open generic types
dotnet_diagnostic.SYSLIB1201.severity = error
# A member type has no fields or properties to validate
dotnet_diagnostic.SYSLIB1202.severity = error
# A type has no fields or properties to validate
dotnet_diagnostic.SYSLIB1203.severity = error
# Deriving from a GeneratedComInterface-attributed interface defined in another assembly is not supported
dotnet_diagnostic.SYSLIB1230.severity = error
####################################################################################################
# Other Platform Diagnostics
####################################################################################################
# SVE is a preview feature can be used by enabling EnablePreviewFeatures flag
dotnet_diagnostic.SYSLIB5003.severity = error
# CS9035 - should be warning or error
dotnet_diagnostic.CS9035.severity = none
@gest01
Copy link

gest01 commented Apr 20, 2023

nice work 👍

found a typo in line 1480 (https://gist.github.com/RealDotNetDave/dbae4d97358ba4515dd52e5b8ca87671#file-editorconfig-L1480)

# CA1010: Collections should implement generic interface
dotnet_diagnostic.CA1008.severity=warning

should be

# CA1010: Collections should implement generic interface
dotnet_diagnostic.CA1010.severity=warning

@agustinm20
Copy link

Looks good! But why mandatory brackets on if/else?

@RealDotNetDave
Copy link
Author

Collections should implement generic interface

That has been fixed!

@RealDotNetDave
Copy link
Author

RealDotNetDave commented Sep 22, 2023

Looks good! But why mandatory brackets on if/else?

YES! If not, a more jr dev can add a line under it thinking it is part of the if when it's not.

@VahidN
Copy link

VahidN commented Mar 2, 2025

Please provide the list of required NuGet packages as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment