Code Inspections in C#
In C#, ReSharper 2019.2 provides two kinds of code inspections: 793 inspections that detect errors such as broken syntax, unresolved symbols, compiler errors, and so on (you cannot configure or disable any of these inspections), and 627 proprietary code inspections, any of which you can disable or change its severity level.
These code inspections help you detect code issues in design time in all open files, and additionally they allow you to find code issues in specific scope.
Configurable C# inspections are listed below, grouped by their categories.
Code Notification (1 inspection)
This category groups code inspections with minor severity levels.Inspection | ID | EditorConfig property | Default severity |
---|---|---|---|
Method invocation is skipped | InvocationIsSkipped | resharper_invocation_is_skipped_highlighting | Hint |
Code Style (37 inspections)
Inspections in this category detect violations of code syntax styles. In contrast to most of other code inspections, these inspections can either detect the same code construct as a code issue or not depending on the corresponding code style rule configured on the page of ReSharper options (Alt+R,,O). You can also fix issues that these inspection detect, using code cleanup.Inspection | ID | EditorConfig property | Default severity |
---|---|---|---|
Add parentheses to avoid non-obvious precedence | ArrangeMissingParentheses | resharper_arrange_missing_parentheses_highlighting | Disabled |
Add/remove qualifier for static members | ArrangeStaticMemberQualifier | resharper_arrange_static_member_qualifier_highlighting | Hint |
Add/remove 'this.' qualifier | ArrangeThisQualifier | resharper_arrange_this_qualifier_highlighting | Hint |
Adjust modifiers declaration order | ArrangeModifiersOrder | resharper_arrange_modifiers_order_highlighting | Suggestion |
Join or separate attributes is section | ArrangeAttributes | resharper_arrange_attributes_highlighting | Disabled |
Join or separate 'var' in deconstruction declarations | ArrangeVarKeywordsInDeconstructingDeclaration | resharper_arrange_var_keywords_in_deconstructing_declaration_highlighting | Suggestion |
Remove redundant parentheses | ArrangeRedundantParentheses | resharper_arrange_redundant_parentheses_highlighting | Hint |
Replace built-in type reference with a CLR type name or a keyword | BuiltInTypeReferenceStyle | resharper_built_in_type_reference_style_highlighting | Hint |
Replace built-in type reference with a CLR type name or a keyword in static member access expressions | BuiltInTypeReferenceStyleForMemberAccess | resharper_built_in_type_reference_style_for_member_access_highlighting | Hint |
Separate control transfer statement with blank line | SeparateControlTransferStatement | resharper_separate_control_transfer_statement_highlighting | Disabled |
Unnecessary whitespace at the end of line | UnnecessaryWhitespace | resharper_unnecessary_whitespace_highlighting | Disabled |
Usage of tabulation character for indentation is prohibited | TabsAreDisallowed | resharper_tabs_are_disallowed_highlighting | Disabled |
Use explicit or implicit modifier definition for type members | ArrangeTypeMemberModifiers | resharper_arrange_type_member_modifiers_highlighting | Hint |
Use explicit or implicit modifier definition for types | ArrangeTypeModifiers | resharper_arrange_type_modifiers_highlighting | Hint |
Use preferred argument style | ArgumentsStyleOther | resharper_arguments_style_other_highlighting | Hint |
Use preferred argument style for anonymous functions | ArgumentsStyleAnonymousFunction | resharper_arguments_style_anonymous_function_highlighting | Hint |
Use preferred argument style for literal values | ArgumentsStyleLiteral | resharper_arguments_style_literal_highlighting | Hint |
Use preferred argument style for named expressions | ArgumentsStyleNamedExpression | resharper_arguments_style_named_expression_highlighting | Hint |
Use preferred argument style for string literal values | ArgumentsStyleStringLiteral | resharper_arguments_style_string_literal_highlighting | Hint |
Use preferred body style (convert to constructor or destructor with preferred body style) | ArrangeConstructorOrDestructorBody | resharper_arrange_constructor_or_destructor_body_highlighting | Disabled |
Use preferred body style (convert to local function with preferred body style) | ArrangeLocalFunctionBody | resharper_arrange_local_function_body_highlighting | Disabled |
Use preferred body style (convert to method or operator with preferred body style) | ArrangeMethodOrOperatorBody | resharper_arrange_method_or_operator_body_highlighting | Disabled |
Use preferred body style (convert to property, indexer or event with preferred body style) | ArrangeAccessorOwnerBody | resharper_arrange_accessor_owner_body_highlighting | Suggestion |
Use preferred braces style (enforce braces in 'do-while' statement) | EnforceDoWhileStatementBraces | resharper_enforce_do_while_statement_braces_highlighting | Disabled |
Use preferred braces style (enforce braces in 'fixed' statement) | EnforceFixedStatementBraces | resharper_enforce_fixed_statement_braces_highlighting | Disabled |
Use preferred braces style (enforce braces in 'for' statement) | EnforceForStatementBraces | resharper_enforce_for_statement_braces_highlighting | Disabled |
Use preferred braces style (enforce braces in 'foreach' statement) | EnforceForeachStatementBraces | resharper_enforce_foreach_statement_braces_highlighting | Disabled |
Use preferred braces style (enforce braces in 'if' statement) | EnforceIfStatementBraces | resharper_enforce_if_statement_braces_highlighting | Disabled |
Use preferred braces style (enforce braces in 'lock' statement) | EnforceLockStatementBraces | resharper_enforce_lock_statement_braces_highlighting | Disabled |
Use preferred braces style (enforce braces in 'using' statement) | EnforceUsingStatementBraces | resharper_enforce_using_statement_braces_highlighting | Disabled |
Use preferred braces style (enforce braces in 'while' statement) | EnforceWhileStatementBraces | resharper_enforce_while_statement_braces_highlighting | Disabled |
Use preferred braces style (remove redundant braces) | RemoveRedundantBraces | resharper_remove_redundant_braces_highlighting | Disabled |
Use preferred style for discard declaration | SuggestDiscardDeclarationVarStyle | resharper_suggest_discard_declaration_var_style_highlighting | Hint |
Use preferred 'var' style (elsewhere) | SuggestVarOrType_Elsewhere | resharper_suggest_var_or_type_elsewhere_highlighting | Hint |
Use preferred 'var' style (for built-in types) | SuggestVarOrType_BuiltInTypes | resharper_suggest_var_or_type_built_in_types_highlighting | Hint |
Use preferred 'var' style (in deconstruction declarations) | SuggestVarOrType_DeconstructionDeclarations | resharper_suggest_var_or_type_deconstruction_declarations_highlighting | Hint |
Use preferred 'var' style (when type is simple) | SuggestVarOrType_SimpleTypes | resharper_suggest_var_or_type_simple_types_highlighting | Hint |
Common Practices and Code Improvements (139 inspections)
This category groups inspections that hunt for medium severity issues that mainly affect code readability.Inspection | ID | EditorConfig property | Default severity |
---|---|---|---|
Access to a static member of a type via a derived type | AccessToStaticMemberViaDerivedType | resharper_access_to_static_member_via_derived_type_highlighting | Warning |
Annotation duplicate in hierarchy | AnnotationRedundancyInHierarchy | resharper_annotation_redundancy_in_hierarchy_highlighting | Warning |
Auto-property can be made get-only (non-private accessibility) | AutoPropertyCanBeMadeGetOnly.Global | resharper_auto_property_can_be_made_get_only_global_highlighting | Suggestion |
Auto-property can be made get-only (private accessibility) | AutoPropertyCanBeMadeGetOnly.Local | resharper_auto_property_can_be_made_get_only_local_highlighting | Suggestion |
Base member has 'params' parameter, but overrider hasn't | BaseMemberHasParams | resharper_base_member_has_params_highlighting | Warning |
Check for reference equality instead | CheckForReferenceEqualityInstead.1 | resharper_check_for_reference_equality_instead_1_highlighting | Suggestion |
Check for reference equality instead | CheckForReferenceEqualityInstead.3 | resharper_check_for_reference_equality_instead_3_highlighting | Suggestion |
Check for reference equality instead | CheckForReferenceEqualityInstead.2 | resharper_check_for_reference_equality_instead_2_highlighting | Suggestion |
Check for reference equality instead | CheckForReferenceEqualityInstead.4 | resharper_check_for_reference_equality_instead_4_highlighting | Suggestion |
Class can be made sealed (non-inheritable) (non-private accessibility) | ClassCanBeSealed.Global | resharper_class_can_be_sealed_global_highlighting | Disabled |
Class can be made sealed (non-inheritable) (private accessibility) | ClassCanBeSealed.Local | resharper_class_can_be_sealed_local_highlighting | Disabled |
Container nullability attribute usage with declaration of non-container type | ContainerAnnotationRedundancy | resharper_container_annotation_redundancy_highlighting | Warning |
Convert 'if do while' to 'while | ConvertIfDoToWhile | resharper_convert_if_do_to_while_highlighting | Suggestion |
Convert 'if' to '||' | ConvertIfToOrExpression | resharper_convert_if_to_or_expression_highlighting | Suggestion |
Convert local variable or field to constant (non-private accessibility) | ConvertToConstant.Global | resharper_convert_to_constant_global_highlighting | Hint |
Convert local variable or field to constant (private accessibility) | ConvertToConstant.Local | resharper_convert_to_constant_local_highlighting | Hint |
Declaration nullability inferred (parameter is inferred to be not null) | AnnotateNotNullParameter | resharper_annotate_not_null_parameter_highlighting | Disabled |
Declaration nullability inferred (parameter is inferred to be nullable) | AnnotateCanBeNullParameter | resharper_annotate_can_be_null_parameter_highlighting | Disabled |
Declaration nullability inferred (type member is inferred to be not null) | AnnotateNotNullTypeMember | resharper_annotate_not_null_type_member_highlighting | Disabled |
Declaration nullability inferred (type member is inferred to be nullable) | AnnotateCanBeNullTypeMember | resharper_annotate_can_be_null_type_member_highlighting | Disabled |
Empty control statement body | EmptyEmbeddedStatement | resharper_empty_embedded_statement_highlighting | Warning |
Empty statement is redundant | EmptyStatement | resharper_empty_statement_highlighting | Warning |
Field can be made readonly (non-private accessibility) | FieldCanBeMadeReadOnly.Global | resharper_field_can_be_made_read_only_global_highlighting | Suggestion |
Field can be made readonly (private accessibility) | FieldCanBeMadeReadOnly.Local | resharper_field_can_be_made_read_only_local_highlighting | Suggestion |
Get-only auto-property is never assigned | UnassignedGetOnlyAutoProperty | resharper_unassigned_get_only_auto_property_highlighting | Warning |
Invert condition | InvertCondition.1 | resharper_invert_condition_1_highlighting | Hint |
Iteration variable can be declared with a more specific type | MoreSpecificForeachVariableTypeAvailable | resharper_more_specific_foreach_variable_type_available_highlighting | Suggestion |
Join local variable declaration and assignment | JoinDeclarationAndInitializer | resharper_join_declaration_and_initializer_highlighting | Suggestion |
Literal's length can be reduced by using verbatim string | UseVerbatimString | resharper_use_verbatim_string_highlighting | Hint |
Local variable has too wide declaration scope | TooWideLocalVariableScope | resharper_too_wide_local_variable_scope_highlighting | Suggestion |
Make constructor in abstract class protected | PublicConstructorInAbstractClass | resharper_public_constructor_in_abstract_class_highlighting | Suggestion |
Member can be made private (non-private accessibility) | MemberCanBePrivate.Global | resharper_member_can_be_private_global_highlighting | Suggestion |
Member can be made private (private accessibility) | MemberCanBePrivate.Local | resharper_member_can_be_private_local_highlighting | Suggestion |
Member can be made protected (non-private accessibility) | MemberCanBeProtected.Global | resharper_member_can_be_protected_global_highlighting | Suggestion |
Member can be made protected (private accessibility) | MemberCanBeProtected.Local | resharper_member_can_be_protected_local_highlighting | Suggestion |
Member can be made static(shared) (non-private accessibility) | MemberCanBeMadeStatic.Global | resharper_member_can_be_made_static_global_highlighting | Hint |
Member can be made static(shared) (private accessibility) | MemberCanBeMadeStatic.Local | resharper_member_can_be_made_static_local_highlighting | Hint |
Member or type can be made internal(friend) | MemberCanBeInternal | resharper_member_can_be_internal_highlighting | Disabled |
Method supports cancellation | MethodSupportsCancellation | resharper_method_supports_cancellation_highlighting | Suggestion |
Missing XML comment for private or internal type or member | InternalOrPrivateMemberNotDocumented | resharper_internal_or_private_member_not_documented_highlighting | Disabled |
Multiple nullable attributes usage | MultipleNullableAttributesUsage | resharper_multiple_nullable_attributes_usage_highlighting | Warning |
Nested string interpolation can be inlined | NestedStringInterpolation | resharper_nested_string_interpolation_highlighting | Suggestion |
Nullability attribute usage with declaration of void or value type | AnnotationRedundancyAtValueType | resharper_annotation_redundancy_at_value_type_highlighting | Warning |
Nullability attribute used with declaration that cannot be directly referenced from other code | NotObservableAnnotationRedundancy | resharper_not_observable_annotation_redundancy_highlighting | Warning |
Parameter can be declared with base type | SuggestBaseTypeForParameter | resharper_suggest_base_type_for_parameter_highlighting | Hint |
Parameter type can be IEnumerable<T> (non-private accessibility) | ParameterTypeCanBeEnumerable.Global | resharper_parameter_type_can_be_enumerable_global_highlighting | Hint |
Parameter type can be IEnumerable<T> (private accessibility) | ParameterTypeCanBeEnumerable.Local | resharper_parameter_type_can_be_enumerable_local_highlighting | Hint |
Possible mistaken argument | PossibleMistakenArgument | resharper_possible_mistaken_argument_highlighting | Warning |
Possible mistaken call to GetType() | PossibleMistakenCallToGetType.1 | resharper_possible_mistaken_call_to_get_type_1_highlighting | Warning |
Possible mistaken call to GetType() | PossibleMistakenCallToGetType.2 | resharper_possible_mistaken_call_to_get_type_2_highlighting | Warning |
Remove constructor invocation | RemoveConstructorInvocation | resharper_remove_constructor_invocation_highlighting | Disabled |
Remove redundant statement | RemoveRedundantOrStatement.False | resharper_remove_redundant_or_statement_false_highlighting | Suggestion |
Remove redundant statement | RemoveRedundantOrStatement.True | resharper_remove_redundant_or_statement_true_highlighting | Suggestion |
Remove ToList() | RemoveToList.1 | resharper_remove_to_list_1_highlighting | Suggestion |
Remove ToList() | RemoveToList.2 | resharper_remove_to_list_2_highlighting | Suggestion |
Replace with FirstOrDefault($args$) | ReplaceWithFirstOrDefault.1 | resharper_replace_with_first_or_default_1_highlighting | Suggestion |
Replace with FirstOrDefault($args$) | ReplaceWithFirstOrDefault.2 | resharper_replace_with_first_or_default_2_highlighting | Suggestion |
Replace with FirstOrDefault($args$) | ReplaceWithFirstOrDefault.3 | resharper_replace_with_first_or_default_3_highlighting | Suggestion |
Replace with FirstOrDefault($args$) | ReplaceWithFirstOrDefault.4 | resharper_replace_with_first_or_default_4_highlighting | Suggestion |
Replace with LastOrDefault($args$) | ReplaceWithLastOrDefault.1 | resharper_replace_with_last_or_default_1_highlighting | Suggestion |
Replace with LastOrDefault($args$) | ReplaceWithLastOrDefault.2 | resharper_replace_with_last_or_default_2_highlighting | Suggestion |
Replace with LastOrDefault($args$) | ReplaceWithLastOrDefault.3 | resharper_replace_with_last_or_default_3_highlighting | Suggestion |
Replace with LastOrDefault($args$) | ReplaceWithLastOrDefault.4 | resharper_replace_with_last_or_default_4_highlighting | Suggestion |
Replace with OfType<T>() | ReplaceWithOfType.1 | resharper_replace_with_of_type_1_highlighting | Suggestion |
Replace with OfType<T>() | ReplaceWithOfType.2 | resharper_replace_with_of_type_2_highlighting | Suggestion |
Replace with OfType<T>() | ReplaceWithOfType.3 | resharper_replace_with_of_type_3_highlighting | Suggestion |
Replace with OfType<T>().Any() | ReplaceWithOfType.Any.1 | resharper_replace_with_of_type_any_1_highlighting | Suggestion |
Replace with OfType<T>().Any() (replace with OfType<T>().Any(..)) | ReplaceWithOfType.Any.2 | resharper_replace_with_of_type_any_2_highlighting | Suggestion |
Replace with OfType<T>().Count() | ReplaceWithOfType.Count.1 | resharper_replace_with_of_type_count_1_highlighting | Suggestion |
Replace with OfType<T>().Count() (replace with OfType<T>().Count(..)) | ReplaceWithOfType.Count.2 | resharper_replace_with_of_type_count_2_highlighting | Suggestion |
Replace with OfType<T>().First() | ReplaceWithOfType.First.1 | resharper_replace_with_of_type_first_1_highlighting | Suggestion |
Replace with OfType<T>().First() (replace with OfType<T>().First(..)) | ReplaceWithOfType.First.2 | resharper_replace_with_of_type_first_2_highlighting | Suggestion |
Replace with OfType<T>().FirstOrDefault() | ReplaceWithOfType.FirstOrDefault.1 | resharper_replace_with_of_type_first_or_default_1_highlighting | Suggestion |
Replace with OfType<T>().FirstOrDefault() (replace with OfType<T>().FirstOrDefault(..)) | ReplaceWithOfType.FirstOrDefault.2 | resharper_replace_with_of_type_first_or_default_2_highlighting | Suggestion |
Replace with OfType<T>().Last() | ReplaceWithOfType.Last.1 | resharper_replace_with_of_type_last_1_highlighting | Suggestion |
Replace with OfType<T>().Last() (replace with OfType<T>().Last(..)) | ReplaceWithOfType.Last.2 | resharper_replace_with_of_type_last_2_highlighting | Suggestion |
Replace with OfType<T>().LastOrDefault() | ReplaceWithOfType.LastOrDefault.1 | resharper_replace_with_of_type_last_or_default_1_highlighting | Suggestion |
Replace with OfType<T>().LastOrDefault() (replace with OfType<T>().LastOrDefault(..)) | ReplaceWithOfType.LastOrDefault.2 | resharper_replace_with_of_type_last_or_default_2_highlighting | Suggestion |
Replace with OfType<T>().LongCount() | ReplaceWithOfType.LongCount | resharper_replace_with_of_type_long_count_highlighting | Suggestion |
Replace with OfType<T>().Single() | ReplaceWithOfType.Single.1 | resharper_replace_with_of_type_single_1_highlighting | Suggestion |
Replace with OfType<T>().Single() (replace with OfType<T>().Single(..)) | ReplaceWithOfType.Single.2 | resharper_replace_with_of_type_single_2_highlighting | Suggestion |
Replace with OfType<T>().SingleOrDefault() | ReplaceWithOfType.SingleOrDefault.1 | resharper_replace_with_of_type_single_or_default_1_highlighting | Suggestion |
Replace with OfType<T>().SingleOrDefault() (replace with OfType<T>().SingleOrDefault(..)) | ReplaceWithOfType.SingleOrDefault.2 | resharper_replace_with_of_type_single_or_default_2_highlighting | Suggestion |
Replace with OfType<T>().Where() (replace with OfType<T>().Where(..)) | ReplaceWithOfType.Where | resharper_replace_with_of_type_where_highlighting | Suggestion |
Replace with simple assignment | ReplaceWithSimpleAssignment.True | resharper_replace_with_simple_assignment_true_highlighting | Suggestion |
Replace with simple assignment | ReplaceWithSimpleAssignment.False | resharper_replace_with_simple_assignment_false_highlighting | Suggestion |
Replace with single assignment | ReplaceWithSingleAssignment.False | resharper_replace_with_single_assignment_false_highlighting | Suggestion |
Replace with single assignment | ReplaceWithSingleAssignment.True | resharper_replace_with_single_assignment_true_highlighting | Suggestion |
Replace with single call to Any(..) | ReplaceWithSingleCallToAny | resharper_replace_with_single_call_to_any_highlighting | Suggestion |
Replace with single call to Count(..) | ReplaceWithSingleCallToCount | resharper_replace_with_single_call_to_count_highlighting | Suggestion |
Replace with single call to First(..) | ReplaceWithSingleCallToFirst | resharper_replace_with_single_call_to_first_highlighting | Suggestion |
Replace with single call to FirstOrDefault(..) | ReplaceWithSingleCallToFirstOrDefault | resharper_replace_with_single_call_to_first_or_default_highlighting | Suggestion |
Replace with single call to Last(..) | ReplaceWithSingleCallToLast | resharper_replace_with_single_call_to_last_highlighting | Suggestion |
Replace with single call to LastOrDefault(..) | ReplaceWithSingleCallToLastOrDefault | resharper_replace_with_single_call_to_last_or_default_highlighting | Suggestion |
Replace with single call to Single(..) | ReplaceWithSingleCallToSingle | resharper_replace_with_single_call_to_single_highlighting | Suggestion |
Replace with single call to SingleOrDefault(..) | ReplaceWithSingleCallToSingleOrDefault | resharper_replace_with_single_call_to_single_or_default_highlighting | Suggestion |
Replace with SingleOrDefault($args$) | ReplaceWithSingleOrDefault.1 | resharper_replace_with_single_or_default_1_highlighting | Suggestion |
Replace with SingleOrDefault($args$) | ReplaceWithSingleOrDefault.2 | resharper_replace_with_single_or_default_2_highlighting | Suggestion |
Replace with SingleOrDefault($args$) | ReplaceWithSingleOrDefault.3 | resharper_replace_with_single_or_default_3_highlighting | Suggestion |
Replace with SingleOrDefault($args$) | ReplaceWithSingleOrDefault.4 | resharper_replace_with_single_or_default_4_highlighting | Suggestion |
Return type can be IEnumerable<T> (non-private accessibility) | ReturnTypeCanBeEnumerable.Global | resharper_return_type_can_be_enumerable_global_highlighting | Hint |
Return type can be IEnumerable<T> (private accessibility) | ReturnTypeCanBeEnumerable.Local | resharper_return_type_can_be_enumerable_local_highlighting | Hint |
Simplify conditional ternary expression | SimplifyConditionalTernaryExpression | resharper_simplify_conditional_ternary_expression_highlighting | Suggestion |
Simplify LINQ expression | SimplifyLinqExpression | resharper_simplify_linq_expression_highlighting | Suggestion |
Simplify negative equality expression | NegativeEqualityExpression | resharper_negative_equality_expression_highlighting | Suggestion |
Specify string comparison explicitly | SpecifyStringComparison | resharper_specify_string_comparison_highlighting | Hint |
Specify string culture explicitly | SpecifyACultureInStringConversionExplicitly | resharper_specify_a_culture_in_string_conversion_explicitly_highlighting | Warning |
String literal can be inlined | StringLiteralAsInterpolationArgument | resharper_string_literal_as_interpolation_argument_highlighting | Suggestion |
String.Compare is culture-specific (string.Compare(string, int, string, int) is culture-specific) | StringCompareIsCultureSpecific.4 | resharper_string_compare_is_culture_specific_4_highlighting | Warning |
String.Compare is culture-specific (string.Compare(string, int, string, int, bool) is culture-specific) | StringCompareIsCultureSpecific.5 | resharper_string_compare_is_culture_specific_5_highlighting | Warning |
String.Compare is culture-specific (string.Compare(string, int, string, int, bool) is culture-specific) | StringCompareIsCultureSpecific.6 | resharper_string_compare_is_culture_specific_6_highlighting | Warning |
String.Compare is culture-specific (string.Compare(string, string) is culture-specific) | StringCompareIsCultureSpecific.1 | resharper_string_compare_is_culture_specific_1_highlighting | Warning |
String.Compare is culture-specific (string.Compare(string, string, bool) is culture-specific) | StringCompareIsCultureSpecific.2 | resharper_string_compare_is_culture_specific_2_highlighting | Warning |
String.Compare is culture-specific (string.Compare(string, string, bool) is culture-specific) | StringCompareIsCultureSpecific.3 | resharper_string_compare_is_culture_specific_3_highlighting | Warning |
String.CompareTo is culture-specific | StringCompareToIsCultureSpecific | resharper_string_compare_to_is_culture_specific_highlighting | Warning |
String.EndsWith is culture-specific (string.EndsWith(string) is culture-specific) | StringEndsWithIsCultureSpecific | resharper_string_ends_with_is_culture_specific_highlighting | Disabled |
String.IndexOf is culture-specific (string.IndexOf(string) is culture-specific) | StringIndexOfIsCultureSpecific.1 | resharper_string_index_of_is_culture_specific_1_highlighting | Warning |
String.IndexOf is culture-specific (string.IndexOf(string, int) is culture-specific) | StringIndexOfIsCultureSpecific.2 | resharper_string_index_of_is_culture_specific_2_highlighting | Warning |
String.IndexOf is culture-specific (string.IndexOf(string, int) is culture-specific) | StringIndexOfIsCultureSpecific.3 | resharper_string_index_of_is_culture_specific_3_highlighting | Warning |
String.LastIndexOf is culture-specific (string.LastIndexOf(string) is culture-specific) | StringLastIndexOfIsCultureSpecific.1 | resharper_string_last_index_of_is_culture_specific_1_highlighting | Warning |
String.LastIndexOf is culture-specific (string.LastIndexOf(string, int) is culture-specific) | StringLastIndexOfIsCultureSpecific.2 | resharper_string_last_index_of_is_culture_specific_2_highlighting | Warning |
String.LastIndexOf is culture-specific (string.LastIndexOf(string, int) is culture-specific) | StringLastIndexOfIsCultureSpecific.3 | resharper_string_last_index_of_is_culture_specific_3_highlighting | Warning |
String.StartsWith is culture-specific (string.StartsWith(string) is culture-specific) | StringStartsWithIsCultureSpecific | resharper_string_starts_with_is_culture_specific_highlighting | Disabled |
try-catch and try-finally statements can be merged | TryStatementsCanBeMerged | resharper_try_statements_can_be_merged_highlighting | Hint |
Type parameter could be declared as covariant or contravariant | TypeParameterCanBeVariant | resharper_type_parameter_can_be_variant_highlighting | Suggestion |
Unreachable code detected | UnreachableCode | resharper_unreachable_code_highlighting | Warning |
Use array creation expression | UseArrayCreationExpression.1 | resharper_use_array_creation_expression_1_highlighting | Suggestion |
Use array creation expression | UseArrayCreationExpression.2 | resharper_use_array_creation_expression_2_highlighting | Suggestion |
Use cancellation token | UseCancellationTokenForIAsyncEnumerable | resharper_use_cancellation_token_for_i_async_enumerable_highlighting | Suggestion |
Use indexed property | UseIndexedProperty | resharper_use_indexed_property_highlighting | Suggestion |
Use 'is' operator | UseIsOperator.1 | resharper_use_is_operator_1_highlighting | Suggestion |
Use 'is' operator | UseIsOperator.2 | resharper_use_is_operator_2_highlighting | Suggestion |
Use method Any() | UseMethodAny.0 | resharper_use_method_any_0_highlighting | Suggestion |
Use method Any() | UseMethodAny.1 | resharper_use_method_any_1_highlighting | Suggestion |
Use method Any() | UseMethodAny.2 | resharper_use_method_any_2_highlighting | Suggestion |
Use method Any() | UseMethodAny.3 | resharper_use_method_any_3_highlighting | Suggestion |
Use method Any() | UseMethodAny.4 | resharper_use_method_any_4_highlighting | Suggestion |
Use method IsInstanceOfType(..) | UseMethodIsInstanceOfType | resharper_use_method_is_instance_of_type_highlighting | Suggestion |
Use 'String.IsNullOrEmpty' | ReplaceWithStringIsNullOrEmpty | resharper_replace_with_string_is_null_or_empty_highlighting | Suggestion |
Compiler Warnings (85 inspections)
Inspections in this category detect compiler warnings before you compile.Inspection | ID | EditorConfig property | Default severity |
---|---|---|---|
'#warning' directive | CSharpWarnings::CS1030 | resharper_c_sharp_warnings_cs1030_highlighting | Warning |
A previous catch clause already catches all exceptions | CSharpWarnings::CS1058 | resharper_c_sharp_warnings_cs1058_highlighting | Warning |
Access to a member through 'base' keyword from anonymous method, lambda expression, query expression or iterator results in unverifiable code | CSharpWarnings::CS1911 | resharper_c_sharp_warnings_cs1911_highlighting | Warning |
Alignment value 'value' has a magnitude greater than 'magnitude limit' and may result in a large formatted string. | CSharpWarnings::CS8094 | resharper_c_sharp_warnings_cs8094_highlighting | Warning |
Ambiguous reference in XML comment | CSharpWarnings::CS1574 | resharper_c_sharp_warnings_cs1574_highlighting | Warning |
Assignment in conditional expression | CSharpWarnings::CS0665 | resharper_c_sharp_warnings_cs0665_highlighting | Warning |
Assignment made to same variable | CSharpWarnings::CS1717 | resharper_c_sharp_warnings_cs1717_highlighting | Warning |
Async function without await expression | CSharpWarnings::CS1998 | resharper_c_sharp_warnings_cs1998_highlighting | Warning |
Async method invocation without await expression | CSharpWarnings::CS4014 | resharper_c_sharp_warnings_cs4014_highlighting | Warning |
'attribute modifier' is not a recognized attribute location. All attributes in this block will be ignored | CSharpWarnings::CS0658 | resharper_c_sharp_warnings_cs0658_highlighting | Warning |
'attribute modifier' is not a valid attribute location for this declaration. All attributes in this block will be ignored | CSharpWarnings::CS0657 | resharper_c_sharp_warnings_cs0657_highlighting | Warning |
Badly formed XML in included comments file | CSharpWarnings::CS1592 | resharper_c_sharp_warnings_cs1592_highlighting | Warning |
Call to non-readonly member from a 'readonly' member results in an implicit copy of 'this' | CSharpWarnings::CS8655 | resharper_c_sharp_warnings_cs8655_highlighting | Warning |
Cannot convert null literal to non-nullable reference or unconstrained type parameter. | CSharpWarnings::CS8625 | resharper_c_sharp_warnings_cs8625_highlighting | Warning |
Cannot resolve reference in XML comment | CSharpWarnings::CS1574,CS1584,CS1581,CS1580 | resharper_c_sharp_warnings_cs1574_cs1584_cs1581_cs1580_highlighting | Warning |
Class overrides Object.Equals(object o) but not Object.GetHashCode() | CSharpWarnings::CS0659 | resharper_c_sharp_warnings_cs0659_highlighting | Warning |
Code is unreachable | CSharpWarnings::CS0162 | resharper_c_sharp_warnings_cs0162_highlighting | Warning |
Converting null literal or possible null value to non-nullable type. | CSharpWarnings::CS8600 | resharper_c_sharp_warnings_cs8600_highlighting | Warning |
Declaring new protected member in sealed class is the same as declaring it as private | CSharpWarnings::CS0628 | resharper_c_sharp_warnings_cs0628_highlighting | Warning |
Default value specified for parameter will have no effect because it applies to a member that is used in contexts that do not allow optional arguments | CSharpWarnings::CS1066 | resharper_c_sharp_warnings_cs1066_highlighting | Warning |
Duplicate param tag in XML comment | CSharpWarnings::CS1571 | resharper_c_sharp_warnings_cs1571_highlighting | Warning |
Duplicate typeparam tag in XML comment | CSharpWarnings::CS1710 | resharper_c_sharp_warnings_cs1710_highlighting | Warning |
Empty switch block | CSharpWarnings::CS1522 | resharper_c_sharp_warnings_cs1522_highlighting | Warning |
Field is never used | UnusedField.Compiler | resharper_unused_field_compiler_highlighting | Warning |
Filter expression is a constant, consider removing the filter | CSharpWarnings::CS7095 | resharper_c_sharp_warnings_cs7095_highlighting | Warning |
Given expression is always of the provided type | CSharpWarnings::CS0183 | resharper_c_sharp_warnings_cs0183_highlighting | Warning |
Given expression is never of the provided type | CSharpWarnings::CS0184 | resharper_c_sharp_warnings_cs0184_highlighting | Warning |
'goto case' value is not implicitly convertible to required type | CSharpWarnings::CS0469 | resharper_c_sharp_warnings_cs0469_highlighting | Warning |
Incorrect signature in XML comment | CSharpWarnings::CS1580 | resharper_c_sharp_warnings_cs1580_highlighting | Warning |
Introducing a 'Finalize' method can interfere with destructor invocation | CSharpWarnings::CS0465 | resharper_c_sharp_warnings_cs0465_highlighting | Warning |
Invalid XML in XML comment | CSharpWarnings::CS1570 | resharper_c_sharp_warnings_cs1570_highlighting | Warning |
Invalid XML include element | CSharpWarnings::CS1590 | resharper_c_sharp_warnings_cs1590_highlighting | Warning |
Keyword 'new' is redundant | CSharpWarnings::CS0109 | resharper_c_sharp_warnings_cs0109_highlighting | Warning |
Keyword 'new' is required | CSharpWarnings::CS0108,CS0114 | resharper_c_sharp_warnings_cs0108_cs0114_highlighting | Warning |
Member overrides obsolete member | CSharpWarnings::CS0672 | resharper_c_sharp_warnings_cs0672_highlighting | Warning |
Missing XML comment for publicly visible type or member | CSharpWarnings::CS1591 | resharper_c_sharp_warnings_cs1591_highlighting | Warning |
Multiple override candidates at run-time | CSharpWarnings::CS1957 | resharper_c_sharp_warnings_cs1957_highlighting | Warning |
Namespace should be default namespace of this project | CSharpWarnings::WME006 | resharper_c_sharp_warnings_wme006_highlighting | Warning |
Non-accessed field | NotAccessedField.Compiler | resharper_not_accessed_field_compiler_highlighting | Warning |
Non-accessed local variable | NotAccessedVariable.Compiler | resharper_not_accessed_variable_compiler_highlighting | Warning |
Non-nullable field is uninitialized. | CSharpWarnings::CS8618 | resharper_c_sharp_warnings_cs8618_highlighting | Warning |
Nullability of reference types in argument doesn't match parameter type. | CSharpWarnings::CS8620 | resharper_c_sharp_warnings_cs8620_highlighting | Warning |
Nullability of reference types in return type doesn't match implemented member. | CSharpWarnings::CS8616 | resharper_c_sharp_warnings_cs8616_highlighting | Warning |
Nullability of reference types in return type doesn't match implicitly implemented member. | CSharpWarnings::CS8613 | resharper_c_sharp_warnings_cs8613_highlighting | Warning |
Nullability of reference types in return type doesn't match overridden member. | CSharpWarnings::CS8609 | resharper_c_sharp_warnings_cs8609_highlighting | Warning |
Nullability of reference types in return type doesn't match the target delegate. | CSharpWarnings::CS8621 | resharper_c_sharp_warnings_cs8621_highlighting | Warning |
Nullability of reference types in source type doesn't match target type. | CSharpWarnings::CS8619 | resharper_c_sharp_warnings_cs8619_highlighting | Warning |
Nullability of reference types in type doesn't match implemented member. | CSharpWarnings::CS8615 | resharper_c_sharp_warnings_cs8615_highlighting | Warning |
Nullability of reference types in type doesn't match implicitly implemented member. | CSharpWarnings::CS8612 | resharper_c_sharp_warnings_cs8612_highlighting | Warning |
Nullability of reference types in type doesn't match overridden member. | CSharpWarnings::CS8608 | resharper_c_sharp_warnings_cs8608_highlighting | Warning |
Nullability of reference types in type of a parameter doesn't match the target delegate. | CSharpWarnings::CS8622 | resharper_c_sharp_warnings_cs8622_highlighting | Warning |
Nullability of reference types in type of parameter doesn't match implemented member. | CSharpWarnings::CS8617 | resharper_c_sharp_warnings_cs8617_highlighting | Warning |
Nullability of reference types in type of parameter doesn't match implicitly implemented member. | CSharpWarnings::CS8614 | resharper_c_sharp_warnings_cs8614_highlighting | Warning |
Nullability of reference types in type of parameter doesn't match overridden member. | CSharpWarnings::CS8610 | resharper_c_sharp_warnings_cs8610_highlighting | Warning |
Nullability of reference types in type of parameter doesn't match partial method declaration. | CSharpWarnings::CS8611 | resharper_c_sharp_warnings_cs8611_highlighting | Warning |
Nullable value type may be null. | CSharpWarnings::CS8629 | resharper_c_sharp_warnings_cs8629_highlighting | Warning |
Operator '==' or operator '!=' with 'Object.Equals(object o)' and 'Object.GetHashCode()' not overridden | CSharpWarnings::CS0660,CS0661 | resharper_c_sharp_warnings_cs0660_cs0661_highlighting | Warning |
Parameter has no matching param tag in the XML comment | CSharpWarnings::CS1573 | resharper_c_sharp_warnings_cs1573_highlighting | Warning |
Possible dereference of a null reference. | CSharpWarnings::CS8602 | resharper_c_sharp_warnings_cs8602_highlighting | Warning |
Possible mistaken empty statement | CSharpWarnings::CS0642 | resharper_c_sharp_warnings_cs0642_highlighting | Warning |
Possible null reference argument for a parameter. | CSharpWarnings::CS8604 | resharper_c_sharp_warnings_cs8604_highlighting | Warning |
Possible null reference assignment. | CSharpWarnings::CS8601 | resharper_c_sharp_warnings_cs8601_highlighting | Warning |
Possible null reference return. | CSharpWarnings::CS8603 | resharper_c_sharp_warnings_cs8603_highlighting | Warning |
Possible unintended reference comparison | CSharpWarnings::CS0252,CS0253 | resharper_c_sharp_warnings_cs0252_cs0253_highlighting | Warning |
Reference to a volatile field will not be treated as volatile | CSharpWarnings::CS0420 | resharper_c_sharp_warnings_cs0420_highlighting | Warning |
Syntax error in XML comment | CSharpWarnings::CS1584 | resharper_c_sharp_warnings_cs1584_highlighting | Warning |
Taking address of marshal-by-reference class field | CSharpWarnings::CS0197 | resharper_c_sharp_warnings_cs0197_highlighting | Warning |
The 'l' suffix is easily confused with the digit '1' | CSharpWarnings::CS0078 | resharper_c_sharp_warnings_cs0078_highlighting | Warning |
The suppression operator (!) can only be applied to reference types. | CSharpWarnings::CS8624 | resharper_c_sharp_warnings_cs8624_highlighting | Warning |
The switch expression does not handle all possible inputs (it is not exhaustive). | CSharpWarnings::CS8509 | resharper_c_sharp_warnings_cs8509_highlighting | Warning |
The tuple element name is ignored because a different name or no name is specified by the target type. | CSharpWarnings::CS8123 | resharper_c_sharp_warnings_cs8123_highlighting | Warning |
The tuple element name is ignored because a different name or no name is specified on the other side of the tuple == or != operator. | CSharpWarnings::CS8383 | resharper_c_sharp_warnings_cs8383_highlighting | Warning |
Type parameter has no matching typeparam tag in the XML comment | CSharpWarnings::CS1712 | resharper_c_sharp_warnings_cs1712_highlighting | Warning |
Type parameter has the same name as a type parameter from the outer type | CSharpWarnings::CS0693 | resharper_c_sharp_warnings_cs0693_highlighting | Warning |
Unable to include XML fragment | CSharpWarnings::CS1589 | resharper_c_sharp_warnings_cs1589_highlighting | Warning |
Unassigned field | UnassignedField.Compiler | resharper_unassigned_field_compiler_highlighting | Warning |
Unassigned readonly field | UnassignedReadonlyField.Compiler | resharper_unassigned_readonly_field_compiler_highlighting | Warning |
Unused local variable | UnusedVariable.Compiler | resharper_unused_variable_compiler_highlighting | Warning |
Use of obsolete symbol | CSharpWarnings::CS0618 | resharper_c_sharp_warnings_cs0618_highlighting | Warning |
Use of obsolete symbol (without message) | CSharpWarnings::CS0612 | resharper_c_sharp_warnings_cs0612_highlighting | Warning |
Using 'is' to test compatibility with 'dynamic' is essentially identical to testing compatibility with 'Object' and will succeed for all non-null values | CSharpWarnings::CS1981 | resharper_c_sharp_warnings_cs1981_highlighting | Warning |
XML comment has a 'param' tag for 'Parameter', but there is no parameter by that name | CSharpWarnings::CS1572 | resharper_c_sharp_warnings_cs1572_highlighting | Warning |
XML comment has a 'typeparam' tag for 'TypeParameter', but there is no type parameter by that name | CSharpWarnings::CS1711 | resharper_c_sharp_warnings_cs1711_highlighting | Warning |
XML comment has cref attribute that refers to a type parameter | CSharpWarnings::CS1723 | resharper_c_sharp_warnings_cs1723_highlighting | Warning |
XML comment is not placed on a valid language element | CSharpWarnings::CS1587 | resharper_c_sharp_warnings_cs1587_highlighting | Warning |
Constraints Violations (10 inspections)
This category includes code inspections, mostly with the warning severity level, which detect violations related to symbol attributes, including ReSharper's code annotations, and other similar issues.Inspection | ID | EditorConfig property | Default severity |
---|---|---|---|
Base type is required | RequiredBaseTypesIsNotInherited | resharper_required_base_types_is_not_inherited_highlighting | Warning |
BaseTypeRequired attribute supports only classes and interfaces | UnsupportedRequiredBaseType | resharper_unsupported_required_base_type_highlighting | Warning |
Compare with '==' types marked by 'CannotApplyEqualityOperatorAttribute' | CannotApplyEqualityOperatorToType | resharper_cannot_apply_equality_operator_to_type_highlighting | Warning |
Inconsistent Naming | InconsistentNaming | resharper_inconsistent_naming_highlighting | Warning |
Member with '[NotNull]' attribute is not initialized at constructor exit | NotNullMemberIsNotInitialized | resharper_not_null_member_is_not_initialized_highlighting | Warning |
Namespace does not correspond to file location | CheckNamespace | resharper_check_namespace_highlighting | Warning |
Possible 'null' assignment to entity with '[NotNull]' attribute | AssignNullToNotNullAttribute | resharper_assign_null_to_not_null_attribute_highlighting | Warning |
Problem in contract annotation definition | ContractAnnotationNotParsed | resharper_contract_annotation_not_parsed_highlighting | Warning |
Required base type conflicting another type | RequiredBaseTypesConflict | resharper_required_base_types_conflict_highlighting | Warning |
Type specified in '[BaseTypeRequired]' attribute conflicts another type | RequiredBaseTypesDirectConflict | resharper_required_base_types_direct_conflict_highlighting | Warning |
Formatting (41 inspections)
Inspections in this category detect code code formatting problems.Inspection | ID | EditorConfig property | Default severity |
---|---|---|---|
Incorrect blank lines (blank lines are missing elsewhere) | MissingBlankLines | resharper_missing_blank_lines_highlighting | Disabled |
Incorrect blank lines (blank lines are redundant elsewhere) | RedundantBlankLines | resharper_redundant_blank_lines_highlighting | Disabled |
Incorrect blank lines (incorrect number of blank lines near braces) | IncorrectBlankLinesNearBraces | resharper_incorrect_blank_lines_near_braces_highlighting | Disabled |
Incorrect indent (around child statement) | BadChildStatementIndent | resharper_bad_child_statement_indent_highlighting | Warning |
Incorrect indent (around declaration braces) | BadDeclarationBracesIndent | resharper_bad_declaration_braces_indent_highlighting | Disabled |
Incorrect indent (around expression braces) | BadExpressionBracesIndent | resharper_bad_expression_braces_indent_highlighting | Disabled |
Incorrect indent (around namespace braces) | BadNamespaceBracesIndent | resharper_bad_namespace_braces_indent_highlighting | Disabled |
Incorrect indent (around preprocessor directive) | BadPreprocessorIndent | resharper_bad_preprocessor_indent_highlighting | Disabled |
Incorrect indent (around statement braces) | BadControlBracesIndent | resharper_bad_control_braces_indent_highlighting | Suggestion |
Incorrect indent (around switch statement) | BadSwitchBracesIndent | resharper_bad_switch_braces_indent_highlighting | Disabled |
Incorrect indent (incorrect indent size) | WrongIndentSize | resharper_wrong_indent_size_highlighting | Disabled |
Incorrect indent (line indent should be restored to the previous level elsewhere) | OutdentIsOffPrevLevel | resharper_outdent_is_off_prev_level_highlighting | Disabled |
Incorrect indent (line indent should not be changed relative to the previous line elsewhere) | BadIndent | resharper_bad_indent_highlighting | Disabled |
Incorrect indent (line should be indented or outdented elsewhere) | MissingIndent | resharper_missing_indent_highlighting | Disabled |
Incorrect indent (tabs/spaces mismatch) | TabsAndSpacesMismatch | resharper_tabs_and_spaces_mismatch_highlighting | Disabled |
Incorrect line breaks (around comma in lists) | BadListLineBreaks | resharper_bad_list_line_breaks_highlighting | Disabled |
Incorrect line breaks (around declaration braces) | BadDeclarationBracesLineBreaks | resharper_bad_declaration_braces_line_breaks_highlighting | Disabled |
Incorrect line breaks (around empty braces) | BadEmptyBracesLineBreaks | resharper_bad_empty_braces_line_breaks_highlighting | Disabled |
Incorrect line breaks (around expression braces) | BadExpressionBracesLineBreaks | resharper_bad_expression_braces_line_breaks_highlighting | Disabled |
Incorrect line breaks (around LINQ queries) | BadLinqLineBreaks | resharper_bad_linq_line_breaks_highlighting | Disabled |
Incorrect line breaks (around parenthesis) | BadParensLineBreaks | resharper_bad_parens_line_breaks_highlighting | Disabled |
Incorrect line breaks (around statement braces) | BadControlBracesLineBreaks | resharper_bad_control_braces_line_breaks_highlighting | Disabled |
Incorrect line breaks (line break is missing elsewhere) | MissingLinebreak | resharper_missing_linebreak_highlighting | Disabled |
Incorrect line breaks (line break is redundant elsewhere) | RedundantLinebreak | resharper_redundant_linebreak_highlighting | Disabled |
Incorrect line breaks (multiple statements on one line) | MultipleStatementsOnOneLine | resharper_multiple_statements_on_one_line_highlighting | Disabled |
Incorrect line breaks (multiple type members on one line) | MultipleTypeMembersOnOneLine | resharper_multiple_type_members_on_one_line_highlighting | Disabled |
Incorrect spacing (around attributes) | BadAttributeBracketsSpaces | resharper_bad_attribute_brackets_spaces_highlighting | Disabled |
Incorrect spacing (around braces) | BadBracesSpaces | resharper_bad_braces_spaces_highlighting | Disabled |
Incorrect spacing (around colon) | BadColonSpaces | resharper_bad_colon_spaces_highlighting | Disabled |
Incorrect spacing (around comma) | BadCommaSpaces | resharper_bad_comma_spaces_highlighting | Disabled |
Incorrect spacing (around generic brackets) | BadGenericBracketsSpaces | resharper_bad_generic_brackets_spaces_highlighting | Disabled |
Incorrect spacing (around member access symbols) | BadMemberAccessSpaces | resharper_bad_member_access_spaces_highlighting | Disabled |
Incorrect spacing (around operator symbols) | BadSymbolSpaces | resharper_bad_symbol_spaces_highlighting | Disabled |
Incorrect spacing (around parenthesis) | BadParensSpaces | resharper_bad_parens_spaces_highlighting | Disabled |
Incorrect spacing (around semicolon) | BadSemicolonSpaces | resharper_bad_semicolon_spaces_highlighting | Disabled |
Incorrect spacing (around square brackets within a statement) | BadSquareBracketsSpaces | resharper_bad_square_brackets_spaces_highlighting | Disabled |
Incorrect spacing (between keyword and parenthesis) | BadSpacesAfterKeyword | resharper_bad_spaces_after_keyword_highlighting | Disabled |
Incorrect spacing (multiple spaces are prohibited) | MultipleSpaces | resharper_multiple_spaces_highlighting | Disabled |
Incorrect spacing (space is missing elsewhere) | MissingSpace | resharper_missing_space_highlighting | Disabled |
Incorrect spacing (space is redundant elsewhere) | RedundantSpace | resharper_redundant_space_highlighting | Disabled |
Incorrect spacing (tabs are prohibited here) | TabsOutsideIndent | resharper_tabs_outside_indent_highlighting | Disabled |
Language Usage Opportunities (46 inspections)
This category includes code inspections, mostly with the suggestion severity level, which notify you when more advanced language constructs can be used. These inspections detect syntax of outdated language versions and suggest using features from more modern language versions. For most of the supported languages, language version can be detected automatically or set manually.Inspection | ID | EditorConfig property | Default severity |
---|---|---|---|
Class cannot be instantiated | ClassCannotBeInstantiated | resharper_class_cannot_be_instantiated_highlighting | Warning |
Convert 'as' expression type check and the following null check into negated pattern matching | UseNegatedPatternMatching | resharper_use_negated_pattern_matching_highlighting | Hint |
Convert 'as' expression type check and the following null check into pattern matching | UsePatternMatching | resharper_use_pattern_matching_highlighting | Suggestion |
Convert delegate variable to local function | ConvertToLocalFunction | resharper_convert_to_local_function_highlighting | Suggestion |
Convert 'if' statement to 'switch' statement | ConvertIfStatementToSwitchStatement | resharper_convert_if_statement_to_switch_statement_highlighting | Hint |
Convert lambda expression to method group | ConvertClosureToMethodGroup | resharper_convert_closure_to_method_group_highlighting | Suggestion |
Convert 'Nullable<T>' to 'T?' | ConvertNullableToShortForm | resharper_convert_nullable_to_short_form_highlighting | Suggestion |
Convert property to auto-property | ConvertToAutoProperty | resharper_convert_to_auto_property_highlighting | Suggestion |
Convert property to auto-property (when possible) | ConvertToAutoPropertyWhenPossible | resharper_convert_to_auto_property_when_possible_highlighting | Hint |
Convert property to auto-property with private setter | ConvertToAutoPropertyWithPrivateSetter | resharper_convert_to_auto_property_with_private_setter_highlighting | Hint |
Convert static method invocation to extension method call | InvokeAsExtensionMethod | resharper_invoke_as_extension_method_highlighting | Suggestion |
Convert to 'await using' statement or declaration | UseAwaitUsing | resharper_use_await_using_highlighting | Suggestion |
Convert to lambda expression | ConvertToLambdaExpression | resharper_convert_to_lambda_expression_highlighting | Suggestion |
Convert to lambda expression (when possible) | ConvertToLambdaExpressionWhenPossible | resharper_convert_to_lambda_expression_when_possible_highlighting | Disabled |
Convert to static class | ConvertToStaticClass | resharper_convert_to_static_class_highlighting | Suggestion |
Convert to using declaration | ConvertToUsingDeclaration | resharper_convert_to_using_declaration_highlighting | Suggestion |
Foreach loop can be converted into LINQ-expression but another 'GetEnumerator' method will be used | ForeachCanBeConvertedToQueryUsingAnotherGetEnumerator | resharper_foreach_can_be_converted_to_query_using_another_get_enumerator_highlighting | Hint |
For-loop can be converted into foreach-loop | ForCanBeConvertedToForeach | resharper_for_can_be_converted_to_foreach_highlighting | Suggestion |
'if' statement can be re-written as '?:' expression | ConvertIfStatementToConditionalTernaryExpression | resharper_convert_if_statement_to_conditional_ternary_expression_highlighting | Suggestion |
'if' statement can be re-written as '??' expression | ConvertIfStatementToNullCoalescingExpression | resharper_convert_if_statement_to_null_coalescing_expression_highlighting | Suggestion |
'if-return' statement can be re-written as 'return' statement | ConvertIfStatementToReturnStatement | resharper_convert_if_statement_to_return_statement_highlighting | Hint |
Inline 'out' variable declaration | InlineOutVariableDeclaration | resharper_inline_out_variable_declaration_highlighting | Suggestion |
Introduce optional parameters (non-private accessibility) | IntroduceOptionalParameters.Global | resharper_introduce_optional_parameters_global_highlighting | Suggestion |
Introduce optional parameters (private accessibility) | IntroduceOptionalParameters.Local | resharper_introduce_optional_parameters_local_highlighting | Suggestion |
Invert 'if' statement to reduce nesting | InvertIf | resharper_invert_if_highlighting | Hint |
Join null check with assignment | JoinNullCheckWithUsage | resharper_join_null_check_with_usage_highlighting | Suggestion |
Join null check with assignment (when possible) | JoinNullCheckWithUsageWhenPossible | resharper_join_null_check_with_usage_when_possible_highlighting | Disabled |
Loop can be converted into LINQ-expression | LoopCanBeConvertedToQuery | resharper_loop_can_be_converted_to_query_highlighting | Hint |
Merge conditional ?: expression into conditional access | MergeConditionalExpression | resharper_merge_conditional_expression_highlighting | Suggestion |
Merge conditional ?: expression into conditional access (when possible) | MergeConditionalExpressionWhenPossible | resharper_merge_conditional_expression_when_possible_highlighting | Disabled |
Merge sequential checks in && or || expressions | MergeSequentialChecks | resharper_merge_sequential_checks_highlighting | Suggestion |
Merge sequential checks in && or || expressions (when possible) | MergeSequentialChecksWhenPossible | resharper_merge_sequential_checks_when_possible_highlighting | Disabled |
Part of foreach loop can be converted into LINQ-expression but another 'GetEnumerator' method will be used | ForeachCanBePartlyConvertedToQueryUsingAnotherGetEnumerator | resharper_foreach_can_be_partly_converted_to_query_using_another_get_enumerator_highlighting | Hint |
Part of loop's body can be converted into LINQ-expression | LoopCanBePartlyConvertedToQuery | resharper_loop_can_be_partly_converted_to_query_highlighting | Disabled |
Replace if statement with null-propagating code | UseNullPropagation | resharper_use_null_propagation_highlighting | Suggestion |
Replace if statement with null-propagating code (when possible) | UseNullPropagationWhenPossible | resharper_use_null_propagation_when_possible_highlighting | Disabled |
Use compound assignment | ConvertToCompoundAssignment | resharper_convert_to_compound_assignment_highlighting | Hint |
Use compound assignment | ConvertToNullCoalescingCompoundAssignment | resharper_convert_to_null_coalescing_compound_assignment_highlighting | Suggestion |
Use deconstruction | UseDeconstruction | resharper_use_deconstruction_highlighting | Hint |
Use deconstruction (on parameter declaration) | UseDeconstructionOnParameter | resharper_use_deconstruction_on_parameter_highlighting | Hint |
Use index from end expression | UseIndexFromEndExpression | resharper_use_index_from_end_expression_highlighting | Suggestion |
Use 'nameof' expression to reference name | UseNameofExpression | resharper_use_nameof_expression_highlighting | Suggestion |
Use object or collection initializer when possible | UseObjectOrCollectionInitializer | resharper_use_object_or_collection_initializer_highlighting | Suggestion |
Use string interpolation expression | UseStringInterpolation | resharper_use_string_interpolation_highlighting | Suggestion |
Use switch expression | ConvertSwitchStatementToSwitchExpression | resharper_convert_switch_statement_to_switch_expression_highlighting | Hint |
Use switch expression | ConvertConditionalTernaryExpressionToSwitchExpression | resharper_convert_conditional_ternary_expression_to_switch_expression_highlighting | Hint |
NUnit (16 inspections)
These inspections detect code issues related to NUnit tests.Inspection | ID | EditorConfig property | Default severity |
---|---|---|---|
NUnit. Async test method must return Task or Task<T> | NUnit.AsyncMethodMustBeTask | resharper_n_unit_async_method_must_be_task_highlighting | Warning |
NUnit. Cannot resolve symbol in TestCaseSource or ValueSource attribute | NUnit.TestCaseSourceCannotBeResolved | resharper_n_unit_test_case_source_cannot_be_resolved_highlighting | Warning |
NUnit. Incompatible argument type or incorrect argument value | NUnit.IncorrectArgumentType | resharper_n_unit_incorrect_argument_type_highlighting | Warning |
NUnit. Incompatible expected result type or incorrect value | NUnit.IncorrectExpectedResultType | resharper_n_unit_incorrect_expected_result_type_highlighting | Warning |
NUnit. Missing arguments in TestCase attribute | NUnit.MissingArgumentsInTestCaseAttribute | resharper_n_unit_missing_arguments_in_test_case_attribute_highlighting | Warning |
NUnit. Missing expected result for non-void test method | NUnit.TestCaseAttributeRequiresExpectedResult | resharper_n_unit_test_case_attribute_requires_expected_result_highlighting | Warning |
NUnit. Non-public test method | NUnit.NonPublicMethodWithTestAttribute | resharper_n_unit_non_public_method_with_test_attribute_highlighting | Warning |
NUnit. Redundant argument in TestCase attribute | NUnit.RedundantArgumentInTestCaseAttribute | resharper_n_unit_redundant_argument_in_test_case_attribute_highlighting | Warning |
NUnit. Redundant argument instead of ExpectedResult | NUnit.RedundantArgumentInsteadOfExpectedResult | resharper_n_unit_redundant_argument_instead_of_expected_result_highlighting | Warning |
NUnit. Redundant expected result for void test method | NUnit.RedundantExpectedResultInTestCaseAttribute | resharper_n_unit_redundant_expected_result_in_test_case_attribute_highlighting | Warning |
NUnit. Test case Result property duplicates ExpectedResult | NUnit.TestCaseResultPropertyDuplicatesExpectedResult | resharper_n_unit_test_case_result_property_duplicates_expected_result_highlighting | Warning |
NUnit. Test case Result property is obsolete | NUnit.TestCaseResultPropertyIsObsolete | resharper_n_unit_test_case_result_property_is_obsolete_highlighting | Warning |
NUnit. Test case source must be field, property, or method | NUnit.TestCaseSourceMustBeFieldPropertyMethod | resharper_n_unit_test_case_source_must_be_field_property_method_highlighting | Warning |
NUnit. Test case source must be non-abstract and implement IEnumerable | NUnit.TestCaseSourceShouldImplementIEnumerable | resharper_n_unit_test_case_source_should_implement_i_enumerable_highlighting | Warning |
NUnit. Test case source must be static | NUnit.TestCaseSourceMustBeStatic | resharper_n_unit_test_case_source_must_be_static_highlighting | Warning |
NUnit. Values for test method parameters are not provided | NUnit.MethodWithParametersAndTestAttribute | resharper_n_unit_method_with_parameters_and_test_attribute_highlighting | Warning |
Potential Code Quality Issues (138 inspections)
This category includes inspections that detect critical issues (code smells), mostly with Error or Warning level. This category also includes inspections that ensure localization assistance.Inspection | ID | EditorConfig property | Default severity |
---|---|---|---|
'?:' expression has identical true and false branches | ConditionalTernaryEqualBranch | resharper_conditional_ternary_equal_branch_highlighting | Warning |
[ThreadStatic] doesn't work with instance fields | ThreadStaticAtInstanceField | resharper_thread_static_at_instance_field_highlighting | Warning |
Abstract or virtual(overridable) event is never invoked | EventNeverInvoked.Global | resharper_event_never_invoked_global_highlighting | Suggestion |
Access to disposed closure | AccessToDisposedClosure | resharper_access_to_disposed_closure_highlighting | Warning |
Access to foreach variable in closure | AccessToForEachVariableInClosure | resharper_access_to_for_each_variable_in_closure_highlighting | Warning |
Access to modified closure | AccessToModifiedClosure | resharper_access_to_modified_closure_highlighting | Warning |
According to values of the bit masks, expression result will always be the same. | NonConstantEqualityExpressionHasConstantResult | resharper_non_constant_equality_expression_has_constant_result_highlighting | Warning |
Actual shift count equals zero. | ShiftExpressionRealShiftCountIsZero | resharper_shift_expression_real_shift_count_is_zero_highlighting | Warning |
Ambiguous symbols in text argument | MultipleResolveCandidatesInText | resharper_multiple_resolve_candidates_in_text_highlighting | Warning |
Annotation conflict in hierarchy | AnnotationConflictInHierarchy | resharper_annotation_conflict_in_hierarchy_highlighting | Warning |
Assignment in conditional expression | AssignmentInConditionalExpression | resharper_assignment_in_conditional_expression_highlighting | Warning |
Async iterator invocation without 'await foreach' | AsyncIteratorInvocationWithoutAwaitForeach | resharper_async_iterator_invocation_without_await_foreach_highlighting | Warning |
Auto-property accessor is never used (non-private accessibility) | UnusedAutoPropertyAccessor.Global | resharper_unused_auto_property_accessor_global_highlighting | Warning |
Auto-property accessor is never used (private accessibility) | UnusedAutoPropertyAccessor.Local | resharper_unused_auto_property_accessor_local_highlighting | Warning |
Bitwise operation on enum which is not marked by [Flags] attribute | BitwiseOperatorOnEnumWithoutFlags | resharper_bitwise_operator_on_enum_without_flags_highlighting | Warning |
Call to base member with implicit default parameters | BaseMethodCallWithDefaultParameter | resharper_base_method_call_with_default_parameter_highlighting | Warning |
Call to 'base.Equals(...)' is reference equality | BaseObjectEqualsIsObjectEquals | resharper_base_object_equals_is_object_equals_highlighting | Warning |
Cannot access static symbol in text argument | StaticProblemInText | resharper_static_problem_in_text_highlighting | Warning |
Cannot access symbol in text argument | AccessRightsInText | resharper_access_rights_in_text_highlighting | Warning |
Cannot resolve property | PropertyNotResolved | resharper_property_not_resolved_highlighting | Error |
Cannot resolve resource | ResourceNotResolved | resharper_resource_not_resolved_highlighting | Error |
Cannot resolve resource item | ResourceItemNotResolved | resharper_resource_item_not_resolved_highlighting | Error |
Cannot resolve symbol in text argument | NotResolvedInText | resharper_not_resolved_in_text_highlighting | Warning |
Captured field reference of a marshal-by-reference class may cause a runtime exception | AddressOfMarshalByRefObject | resharper_address_of_marshal_by_ref_object_highlighting | Warning |
Captured reference to 'volatile' field will not be treated as 'volatile' | ByRefArgumentIsVolatileField | resharper_by_ref_argument_is_volatile_field_highlighting | Warning |
Char is possibly unintentionally used as integer | ConfusingCharAsIntegerInConstructor | resharper_confusing_char_as_integer_in_constructor_highlighting | Warning |
Class is never instantiated (non-private accessibility) | ClassNeverInstantiated.Global | resharper_class_never_instantiated_global_highlighting | Suggestion |
Class is never instantiated (private accessibility) | ClassNeverInstantiated.Local | resharper_class_never_instantiated_local_highlighting | Suggestion |
Collection is never updated (non-private accessibility) | CollectionNeverUpdated.Global | resharper_collection_never_updated_global_highlighting | Warning |
Collection is never updated (private accessibility) | CollectionNeverUpdated.Local | resharper_collection_never_updated_local_highlighting | Warning |
Collection's content is never queried (non-private accessibility) | CollectionNeverQueried.Global | resharper_collection_never_queried_global_highlighting | Warning |
Collection's content is never queried (private accessibility) | CollectionNeverQueried.Local | resharper_collection_never_queried_local_highlighting | Warning |
Constant shift expression with non-zero operands results in zero value. | ShiftExpressionResultEqualsZero | resharper_shift_expression_result_equals_zero_highlighting | Warning |
Co-variant array conversion | CoVariantArrayConversion | resharper_co_variant_array_conversion_highlighting | Warning |
Delegate subtractions | DelegateSubtraction | resharper_delegate_subtraction_highlighting | Warning |
Element is localizable | LocalizableElement | resharper_localizable_element_highlighting | Warning |
Empty general catch clause | EmptyGeneralCatchClause | resharper_empty_general_catch_clause_highlighting | Warning |
'Enumerable.Sum' invocation in explicit unchecked context | EnumerableSumInExplicitUncheckedContext | resharper_enumerable_sum_in_explicit_unchecked_context_highlighting | Warning |
Equality comparison of floating point numbers | CompareOfFloatsByEqualityOperator | resharper_compare_of_floats_by_equality_operator_highlighting | Warning |
Event is never subscribed to (non-private accessibility) | EventNeverSubscribedTo.Global | resharper_event_never_subscribed_to_global_highlighting | Suggestion |
Event is never subscribed to (private accessibility) | EventNeverSubscribedTo.Local | resharper_event_never_subscribed_to_local_highlighting | Suggestion |
Event never invoked | EventNeverInvoked | resharper_event_never_invoked_highlighting | Warning |
Event unsubscription via anonymous delegate | EventUnsubscriptionViaAnonymousDelegate | resharper_event_unsubscription_via_anonymous_delegate_highlighting | Warning |
Exception rethrow possibly intended | PossibleIntendedRethrow | resharper_possible_intended_rethrow_highlighting | Warning |
Explicit argument passed to parameter with caller info attribute | ExplicitCallerInfoArgument | resharper_explicit_caller_info_argument_highlighting | Warning |
Formatting is specified, but interpolated string expression is not IFormattable | InterpolatedStringExpressionIsNotIFormattable | resharper_interpolated_string_expression_is_not_i_formattable_highlighting | Warning |
Function body is too complex to analyze | FunctionComplexityOverflow | resharper_function_complexity_overflow_highlighting | Disabled |
Function is recursive on all execution paths | FunctionRecursiveOnAllPaths | resharper_function_recursive_on_all_paths_highlighting | Warning |
Function never returns | FunctionNeverReturns | resharper_function_never_returns_highlighting | Warning |
'GC.SuppressFinalize' is invoked for type without destructor | GCSuppressFinalizeForTypeWithoutDestructor | resharper_gc_suppress_finalize_for_type_without_destructor_highlighting | Warning |
Implicitly captured closure | ImplicitlyCapturedClosure | resharper_implicitly_captured_closure_highlighting | Hint |
Inconsistent synchronization on field | InconsistentlySynchronizedField | resharper_inconsistently_synchronized_field_highlighting | Warning |
Instance of IEnumerator is never disposed | GenericEnumeratorNotDisposed | resharper_generic_enumerator_not_disposed_highlighting | Warning |
Interfaces marked as ServiceContract should declare at least one OperationContract | SeviceContractWithoutOperations | resharper_sevice_contract_without_operations_highlighting | Warning |
Invalid XML documentation comment | InvalidXmlDocComment | resharper_invalid_xml_doc_comment_highlighting | Warning |
Invocation of polymorphic field-like event | PolymorphicFieldLikeEventInvocation | resharper_polymorphic_field_like_event_invocation_highlighting | Warning |
IQueryable is possibly unintentionally used as IEnumerable | PossibleUnintendedQueryableAsEnumerable | resharper_possible_unintended_queryable_as_enumerable_highlighting | Suggestion |
Iterator never returns | IteratorNeverReturns | resharper_iterator_never_returns_highlighting | Warning |
Local variable hides member | LocalVariableHidesMember | resharper_local_variable_hides_member_highlighting | Warning |
Loop control variable is never changed inside loop | LoopVariableIsNeverChangedInsideLoop | resharper_loop_variable_is_never_changed_inside_loop_highlighting | Warning |
Member hides static member from outer class | MemberHidesStaticFromOuterClass | resharper_member_hides_static_from_outer_class_highlighting | Warning |
Member initialized value ignored | MemberInitializerValueIgnored | resharper_member_initializer_value_ignored_highlighting | Warning |
Method is marked as OperationContract but containing type isn't marked as ServiceContract | OperationContractWithoutServiceContract | resharper_operation_contract_without_service_contract_highlighting | Warning |
Method with optional or 'params' parameter is hidden by overload | MethodOverloadWithOptionalParameter | resharper_method_overload_with_optional_parameter_highlighting | Warning |
Method with 'params' is invoked while more specific method is available | PossiblyMistakenUseOfParamsMethod | resharper_possibly_mistaken_use_of_params_method_highlighting | Warning |
Mismatch optional parameter value in overridden method | OptionalParameterHierarchyMismatch | resharper_optional_parameter_hierarchy_mismatch_highlighting | Warning |
Multiple sequential 'OrderBy' invocation | MultipleOrderBy | resharper_multiple_order_by_highlighting | Warning |
Non-accessed field (non-private accessibility) | NotAccessedField.Global | resharper_not_accessed_field_global_highlighting | Suggestion |
Non-accessed field (private accessibility) | NotAccessedField.Local | resharper_not_accessed_field_local_highlighting | Warning |
Non-readonly type member referenced in 'GetHashCode()' | NonReadonlyMemberInGetHashCode | resharper_non_readonly_member_in_get_hash_code_highlighting | Warning |
'Object.ReferenceEquals' is always false because it is called with value type | ReferenceEqualsWithValueType | resharper_reference_equals_with_value_type_highlighting | Warning |
One way operations couldn't return values | OneWayOperationContractWithReturnType | resharper_one_way_operation_contract_with_return_type_highlighting | Warning |
Operator 'is'/'Type Of ... Is ...' can be used | OperatorIsCanBeUsed | resharper_operator_is_can_be_used_highlighting | Warning |
Overridden GetHashCode calls base 'Object.GetHashCode()' | BaseObjectGetHashCodeCallInGetHashCode | resharper_base_object_get_hash_code_call_in_get_hash_code_highlighting | Warning |
Parameter hides member | ParameterHidesMember | resharper_parameter_hides_member_highlighting | Warning |
Parameter name differs in partial method declaration | PartialMethodParameterNameMismatch | resharper_partial_method_parameter_name_mismatch_highlighting | Warning |
Possible ambiguity while accessing member by interface | PossibleInterfaceMemberAmbiguity | resharper_possible_interface_member_ambiguity_highlighting | Warning |
Possible compare of value type with 'null' | CompareNonConstrainedGenericWithNull | resharper_compare_non_constrained_generic_with_null_highlighting | Disabled |
Possible cyclic constructor call | ConstructorInitializerLoop | resharper_constructor_initializer_loop_highlighting | Warning |
Possible incorrect implementation of Double-Check Locking pattern. Possible multiple write access to checked field | PossibleMultipleWriteAccessInDoubleCheckLocking | resharper_possible_multiple_write_access_in_double_check_locking_highlighting | Warning |
Possible incorrect implementation of Double-Check Locking pattern. Read access to checked field | ReadAccessInDoubleCheckLocking | resharper_read_access_in_double_check_locking_highlighting | Warning |
Possible infinite inheritance | PossibleInfiniteInheritance | resharper_possible_infinite_inheritance_highlighting | Warning |
Possible loss of fraction | PossibleLossOfFraction | resharper_possible_loss_of_fraction_highlighting | Warning |
Possible multiple enumeration | PossibleMultipleEnumeration | resharper_possible_multiple_enumeration_highlighting | Warning |
Possible 'System.ArgumentOutOfRangeException'. Index must be a non-negative integer | NegativeIndex | resharper_negative_index_highlighting | Warning |
Possible 'System.ArgumentOutOfRangeException'. Start index should be less than or equal to end index | IndexingByInvalidRange | resharper_indexing_by_invalid_range_highlighting | Warning |
Possible 'System.InvalidCastException' | PossibleInvalidCastException | resharper_possible_invalid_cast_exception_highlighting | Warning |
Possible 'System.InvalidCastException' in foreach loop | PossibleInvalidCastExceptionInForeachLoop | resharper_possible_invalid_cast_exception_in_foreach_loop_highlighting | Warning |
Possible 'System.InvalidOperationException' | PossibleInvalidOperationException | resharper_possible_invalid_operation_exception_highlighting | Warning |
Possible 'System.NullReferenceException' | PossibleNullReferenceException | resharper_possible_null_reference_exception_highlighting | Warning |
Possible unassigned object created by 'new' expression | ObjectCreationAsStatement | resharper_object_creation_as_statement_highlighting | Warning |
Possible unintended reference comparison | PossibleUnintendedReferenceComparison | resharper_possible_unintended_reference_comparison_highlighting | Warning |
Possibly impure struct method is called on readonly variable: struct value always copied before invocation | PossiblyImpureMethodCallOnReadonlyVariable | resharper_possibly_impure_method_call_on_readonly_variable_highlighting | Warning |
Possibly misleading 'DefaultValueAttribute' usage to define optional parameter value | DefaultValueAttributeForOptionalParameter | resharper_default_value_attribute_for_optional_parameter_highlighting | Warning |
Possibly missing comma before indexer initializer | PossiblyMissingIndexerInitializerComma | resharper_possibly_missing_indexer_initializer_comma_highlighting | Warning |
Possibly unintended linear search in set | PossibleUnintendedLinearSearchInSet | resharper_possible_unintended_linear_search_in_set_highlighting | Warning |
Possibly unintended string interpolation instead of format string template. | PossiblyMistakenUseOfInterpolatedStringInsert | resharper_possibly_mistaken_use_of_interpolated_string_insert_highlighting | Warning |
'ref' or 'out' parameter with [Optional] attribute | OptionalParameterRefOut | resharper_optional_parameter_ref_out_highlighting | Warning |
Return value of [MustUseReturnValue] annotated method is not used | MustUseReturnValue | resharper_must_use_return_value_highlighting | Warning |
Return value of iterator is not used | IteratorMethodResultIsIgnored | resharper_iterator_method_result_is_ignored_highlighting | Warning |
Return value of pure method is not used | ReturnValueOfPureMethodIsNotUsed | resharper_return_value_of_pure_method_is_not_used_highlighting | Warning |
Right operand of dynamic shift operation should be convertible to 'int' | DynamicShiftRightOpIsNotInt | resharper_dynamic_shift_right_op_is_not_int_highlighting | Warning |
Safe cast expression always succeeds | TryCastAlwaysSucceeds | resharper_try_cast_always_succeeds_highlighting | Suggestion |
Shift expression with zero left operand equals zero. | ShiftExpressionZeroLeftOperand | resharper_shift_expression_zero_left_operand_highlighting | Warning |
Similar anonymous type detected nearby | SimilarAnonymousTypeNearby | resharper_similar_anonymous_type_nearby_highlighting | Hint |
Similar expressions comparison | EqualExpressionComparison | resharper_equal_expression_comparison_highlighting | Warning |
Some values of the enum are not processed inside switch statement | SwitchStatementMissingSomeCases | resharper_switch_statement_missing_some_cases_highlighting | Hint |
Static field or auto-property in generic type | StaticMemberInGenericType | resharper_static_member_in_generic_type_highlighting | Warning |
Static member initializer refers to static member below or in other part | StaticMemberInitializerReferesToMemberBelow | resharper_static_member_initializer_referes_to_member_below_highlighting | Warning |
String formatting method problems | FormatStringProblem | resharper_format_string_problem_highlighting | Warning |
Suspicious shift count for this type of left operand. | ShiftExpressionRightOperandNotEqualRealCount | resharper_shift_expression_right_operand_not_equal_real_count_highlighting | Warning |
Suspicious type conversion or check | SuspiciousTypeConversion.Global | resharper_suspicious_type_conversion_global_highlighting | Warning |
Symbol from module that might be missing at runtime | SymbolFromNotCopiedLocallyReferenceUsedWarning | resharper_symbol_from_not_copied_locally_reference_used_warning_highlighting | Warning |
Tail recursive call may be replaced with loop | TailRecursiveCall | resharper_tail_recursive_call_highlighting | Hint |
The given expression of 'is' operator is always of the provided type | IsExpressionAlwaysTrue | resharper_is_expression_always_true_highlighting | Warning |
The given expression of 'is' operator is never of the provided type | IsExpressionAlwaysFalse | resharper_is_expression_always_false_highlighting | Warning |
The source expression always matches the provided pattern | PatternAlwaysMatches | resharper_pattern_always_matches_highlighting | Disabled |
The source expression is always of pattern's type | PatternAlwaysOfType | resharper_pattern_always_of_type_highlighting | Warning |
The source expression never matches the provided pattern | PatternNeverMatches | resharper_pattern_never_matches_highlighting | Warning |
Thread static field has initializer | ThreadStaticFieldHasInitializer | resharper_thread_static_field_has_initializer_highlighting | Warning |
Try cast and check for null may be replaced with type check | SafeCastIsUsedAsTypeCheck | resharper_safe_cast_is_used_as_type_check_highlighting | Suggestion |
Type check and casts can be merged | MergeCastWithTypeCheck | resharper_merge_cast_with_type_check_highlighting | Suggestion |
Type pattern and casts can be merged | UseSwitchCasePatternVariable | resharper_use_switch_case_pattern_variable_highlighting | Suggestion |
Unassigned field (non-private accessibility) | UnassignedField.Global | resharper_unassigned_field_global_highlighting | Suggestion |
Unassigned field (private accessibility) | UnassignedField.Local | resharper_unassigned_field_local_highlighting | Warning |
Unassigned readonly field | UnassignedReadonlyField | resharper_unassigned_readonly_field_highlighting | Warning |
Usage of <inheritdoc /> is invalid. | InheritdocInvalidUsage | resharper_inheritdoc_invalid_usage_highlighting | Warning |
Use <inheritdoc /> on root level to inherit documentation from base candidate. | InheritdocConsiderUsage | resharper_inheritdoc_consider_usage_highlighting | Disabled |
Use collection's count property | UseCollectionCountProperty | resharper_use_collection_count_property_highlighting | Suggestion |
Use format specifier in format strings | UseFormatSpecifierInFormatString | resharper_use_format_specifier_in_format_string_highlighting | Suggestion |
Use format specifier in interpolated strings | UseFormatSpecifierInInterpolation | resharper_use_format_specifier_in_interpolation_highlighting | Suggestion |
Using stackalloc inside loop | StackAllocInsideLoop | resharper_stack_alloc_inside_loop_highlighting | Warning |
Value assigned to a property of non-variable qualifier expression can be lost | PossibleStructMemberModificationOfNonVariableStruct | resharper_possible_struct_member_modification_of_non_variable_struct_highlighting | Warning |
'value' parameter is not used | ValueParameterNotUsed | resharper_value_parameter_not_used_highlighting | Warning |
Variable in local function hides variable from outer scope | VariableHidesOuterVariable | resharper_variable_hides_outer_variable_highlighting | Warning |
Virtual member call in constructor | VirtualMemberCallInConstructor | resharper_virtual_member_call_in_constructor_highlighting | Warning |
'void' method is annotated by [MustUseReturnValue] attribute | VoidMethodWithMustUseReturnValueAttribute | resharper_void_method_with_must_use_return_value_attribute_highlighting | Warning |
'void' method is annotated by [Pure] attribute | PureAttributeOnVoidMethod | resharper_pure_attribute_on_void_method_highlighting | Warning |
Redundancies in Code (68 inspections)
Code inspections in this category look for redundancies and dead code, which affect code readability and style, and could be safely removed. Some code redundancies cannot be fixed automatically, and quick-fixes for them are performed in the interactive mode, requiring the user input. But the majority of the redundancies can be fixed without user interaction, using either fix in scope or code cleanup.Inspection | ID | EditorConfig property | Default severity |
---|---|---|---|
'??' condition is known to be null or not null | ConstantNullCoalescingCondition | resharper_constant_null_coalescing_condition_highlighting | Warning |
Anonymous method signature is not necessary | UnusedAnonymousMethodSignature | resharper_unused_anonymous_method_signature_highlighting | Warning |
Array creation can be replaced with array initializer | RedundantArrayCreationExpression | resharper_redundant_array_creation_expression_highlighting | Hint |
Assignment is not used | RedundantAssignment | resharper_redundant_assignment_highlighting | Warning |
Assignment results are fully discarded | AssignmentIsFullyDiscarded | resharper_assignment_is_fully_discarded_highlighting | Warning |
Conditional access qualifier expression is known to be null or not null | ConstantConditionalAccessQualifier | resharper_constant_conditional_access_qualifier_highlighting | Warning |
Double negation operator | DoubleNegationOperator | resharper_double_negation_operator_highlighting | Suggestion |
Empty 'for' loop is redundant | EmptyForStatement | resharper_empty_for_statement_highlighting | Warning |
Explicit delegate creation expression is redundant | RedundantDelegateCreation | resharper_redundant_delegate_creation_highlighting | Warning |
Expression is always 'null' | ExpressionIsAlwaysNull | resharper_expression_is_always_null_highlighting | Warning |
Expression is always 'true' or always 'false' | ConditionIsAlwaysTrueOrFalse | resharper_condition_is_always_true_or_false_highlighting | Warning |
Heuristically unreachable code | HeuristicUnreachableCode | resharper_heuristic_unreachable_code_highlighting | Warning |
Immediate delegate invocation | RedundantImmediateDelegateInvocation | resharper_redundant_immediate_delegate_invocation_highlighting | Suggestion |
Parentheses are redundant if attribute has no arguments | RedundantAttributeParentheses | resharper_redundant_attribute_parentheses_highlighting | Hint |
Private field can be converted to local variable | PrivateFieldCanBeConvertedToLocalVariable | resharper_private_field_can_be_converted_to_local_variable_highlighting | Warning |
Redundant [AttributeUsage] attribute property assignment | RedundantAttributeUsageProperty | resharper_redundant_attribute_usage_property_highlighting | Suggestion |
Redundant anonymous type property explicit name | RedundantAnonymousTypePropertyName | resharper_redundant_anonymous_type_property_name_highlighting | Warning |
Redundant argument with default value | RedundantArgumentDefaultValue | resharper_redundant_argument_default_value_highlighting | Warning |
Redundant arithmetic overflow checking context | RedundantOverflowCheckingContext | resharper_redundant_overflow_checking_context_highlighting | Warning |
Redundant 'base.' qualifier | RedundantBaseQualifier | resharper_redundant_base_qualifier_highlighting | Warning |
Redundant boolean comparison | RedundantBoolCompare | resharper_redundant_bool_compare_highlighting | Warning |
Redundant braces in collection initializer | RedundantCollectionInitializerElementBraces | resharper_redundant_collection_initializer_element_braces_highlighting | Hint |
Redundant 'case' label | RedundantCaseLabel | resharper_redundant_case_label_highlighting | Warning |
Redundant cast | RedundantCast | resharper_redundant_cast_highlighting | Warning |
Redundant cast to 'object' | RedundantCast.0 | resharper_redundant_cast_0_highlighting | Warning |
Redundant catch clause | RedundantCatchClause | resharper_redundant_catch_clause_highlighting | Warning |
Redundant comma in array/object/collection/anonymous type initializer | RedundantCommaInInitializer | resharper_redundant_comma_in_initializer_highlighting | Hint |
Redundant comma in attribute list | RedundantCommaInAttributeList | resharper_redundant_comma_in_attribute_list_highlighting | Hint |
Redundant comma in enum declaration | RedundantCommaInEnumDeclaration | resharper_redundant_comma_in_enum_declaration_highlighting | Hint |
Redundant condition check before assignments | RedundantCheckBeforeAssignment | resharper_redundant_check_before_assignment_highlighting | Warning |
Redundant conditional ternary expression usage | RedundantTernaryExpression | resharper_redundant_ternary_expression_highlighting | Warning |
Redundant control flow jump statement | RedundantJumpStatement | resharper_redundant_jump_statement_highlighting | Warning |
Redundant discard designation | RedundantDiscardDesignation | resharper_redundant_discard_designation_highlighting | Suggestion |
Redundant discarded property pattern | RedundantDiscardedPattern | resharper_redundant_discarded_pattern_highlighting | Suggestion |
Redundant 'else' keyword | RedundantIfElseBlock | resharper_redundant_if_else_block_highlighting | Hint |
Redundant empty argument list on object creation expression | RedundantEmptyObjectCreationArgumentList | resharper_redundant_empty_object_creation_argument_list_highlighting | Hint |
Redundant empty finally block | RedundantEmptyFinallyBlock | resharper_redundant_empty_finally_block_highlighting | Warning |
Redundant empty object or collection initializer | RedundantEmptyObjectOrCollectionInitializer | resharper_redundant_empty_object_or_collection_initializer_highlighting | Warning |
Redundant empty switch section | RedundantEmptySwitchSection | resharper_redundant_empty_switch_section_highlighting | Warning |
Redundant explicit array creation in argument of 'params' parameter | RedundantExplicitParamsArrayCreation | resharper_redundant_explicit_params_array_creation_highlighting | Suggestion |
Redundant explicit nullable type creation | RedundantExplicitNullableCreation | resharper_redundant_explicit_nullable_creation_highlighting | Warning |
Redundant explicit size specification in array creation | RedundantExplicitArraySize | resharper_redundant_explicit_array_size_highlighting | Warning |
Redundant explicit tuple component name | RedundantExplicitTupleComponentName | resharper_redundant_explicit_tuple_component_name_highlighting | Warning |
Redundant explicit type in array creation | RedundantExplicitArrayCreation | resharper_redundant_explicit_array_creation_highlighting | Warning |
Redundant fixed pointer declaration | RedundantFixedPointerDeclaration | resharper_redundant_fixed_pointer_declaration_highlighting | Suggestion |
Redundant 'IEnumerable.Cast<T>' or 'IEnumerable.OfType<T>' call | RedundantEnumerableCastCall | resharper_redundant_enumerable_cast_call_highlighting | Warning |
Redundant lambda expression parameter type specification | RedundantLambdaParameterType | resharper_redundant_lambda_parameter_type_highlighting | Warning |
Redundant lambda signature parentheses | RedundantLambdaSignatureParentheses | resharper_redundant_lambda_signature_parentheses_highlighting | Hint |
Redundant name qualifier | RedundantNameQualifier | resharper_redundant_name_qualifier_highlighting | Warning |
Redundant 'object.ToString()' call | RedundantToStringCall | resharper_redundant_to_string_call_highlighting | Warning |
Redundant 'object.ToString()' call for value types | RedundantToStringCallForValueType | resharper_redundant_to_string_call_for_value_type_highlighting | Hint |
Redundant operand in logical conditional expression | RedundantLogicalConditionalExpressionOperand | resharper_redundant_logical_conditional_expression_operand_highlighting | Warning |
Redundant 'orderby' clause 'ascending' keyword | RedundantQueryOrderByAscendingKeyword | resharper_redundant_query_order_by_ascending_keyword_highlighting | Hint |
Redundant property pattern clause | RedundantPropertyPatternClause | resharper_redundant_property_pattern_clause_highlighting | Suggestion |
Redundant range bound | RedundantRangeBound | resharper_redundant_range_bound_highlighting | Suggestion |
Redundant 'readonly' modifier | RedundantReadonlyModifier | resharper_redundant_readonly_modifier_highlighting | Suggestion |
Redundant semicolon after type or namespace declaration | RedundantDeclarationSemicolon | resharper_redundant_declaration_semicolon_highlighting | Hint |
Redundant string interpolation | RedundantStringInterpolation | resharper_redundant_string_interpolation_highlighting | Suggestion |
Redundant 'string.Format()' call | RedundantStringFormatCall | resharper_redundant_string_format_call_highlighting | Warning |
Redundant 'string.ToCharArray()' call | RedundantStringToCharArrayCall | resharper_redundant_string_to_char_array_call_highlighting | Warning |
Redundant type arguments of method | RedundantTypeArgumentsOfMethod | resharper_redundant_type_arguments_of_method_highlighting | Warning |
Redundant type specification in default expression | RedundantTypeSpecificationInDefaultExpression | resharper_redundant_type_specification_in_default_expression_highlighting | Suggestion |
Redundant using directive | RedundantUsingDirective | resharper_redundant_using_directive_highlighting | Warning |
Redundant verbatim prefix | RedundantVerbatimPrefix | resharper_redundant_verbatim_prefix_highlighting | Suggestion |
Redundant verbatim string prefix | RedundantVerbatimStringPrefix | resharper_redundant_verbatim_string_prefix_highlighting | Suggestion |
'true' is redundant as 'for'-statement condition | ForStatementConditionIsTrue | resharper_for_statement_condition_is_true_highlighting | Warning |
Type check for nullable type is equal to underlying type check | RedundantNullableTypeMark | resharper_redundant_nullable_type_mark_highlighting | Warning |
Unsafe context declaration is redundant | RedundantUnsafeContext | resharper_redundant_unsafe_context_highlighting | Warning |
Redundancies in Symbol Declarations (42 inspections)
This category includes code inspections, mostly with the warning severity level, which detect empty and unused symbol declarations.Inspection | ID | EditorConfig property | Default severity |
---|---|---|---|
Class with virtual(overridable) members never inherited (non-private accessibility) | ClassWithVirtualMembersNeverInherited.Global | resharper_class_with_virtual_members_never_inherited_global_highlighting | Suggestion |
Class with virtual(overridable) members never inherited (private accessibility) | ClassWithVirtualMembersNeverInherited.Local | resharper_class_with_virtual_members_never_inherited_local_highlighting | Suggestion |
Component of the tuple is never used | UnusedTupleComponentInReturnValue | resharper_unused_tuple_component_in_return_value_highlighting | Warning |
'DefaultParameterValueAttribute' should be used in conjunction with 'OptionalAttribute' | MeaninglessDefaultParameterValue | resharper_meaningless_default_parameter_value_highlighting | Warning |
Empty constructor | EmptyConstructor | resharper_empty_constructor_highlighting | Warning |
Empty destructor | EmptyDestructor | resharper_empty_destructor_highlighting | Warning |
Empty namespace declaration | EmptyNamespace | resharper_empty_namespace_highlighting | Warning |
Local entity is only used to capture its name | LocalNameCapturedOnly | resharper_local_name_captured_only_highlighting | Warning |
Local function is never used | UnusedLocalFunction | resharper_unused_local_function_highlighting | Warning |
Local function is never used | UnusedLocalFunction.Compiler | resharper_unused_local_function_compiler_highlighting | Warning |
Local function return value is never used | UnusedLocalFunctionReturnValue | resharper_unused_local_function_return_value_highlighting | Warning |
Method return value is never used (non-private accessibility) | UnusedMethodReturnValue.Global | resharper_unused_method_return_value_global_highlighting | Suggestion |
Method return value is never used (private accessibility) | UnusedMethodReturnValue.Local | resharper_unused_method_return_value_local_highlighting | Warning |
Non-accessed local variable | NotAccessedVariable | resharper_not_accessed_variable_highlighting | Warning |
Parameter is only used for precondition check (non-private accessibility) | ParameterOnlyUsedForPreconditionCheck.Global | resharper_parameter_only_used_for_precondition_check_global_highlighting | Suggestion |
Parameter is only used for precondition check (private accessibility) | ParameterOnlyUsedForPreconditionCheck.Local | resharper_parameter_only_used_for_precondition_check_local_highlighting | Warning |
'params' modifier is always ignored on overrides | RedundantParams | resharper_redundant_params_highlighting | Warning |
Redundant base constructor call | RedundantBaseConstructorCall | resharper_redundant_base_constructor_call_highlighting | Warning |
Redundant class or interface specification in base types list | RedundantExtendsListEntry | resharper_redundant_extends_list_entry_highlighting | Warning |
Redundant member initializer | RedundantDefaultMemberInitializer | resharper_redundant_default_member_initializer_highlighting | Warning |
Redundant member override | RedundantOverriddenMember | resharper_redundant_overridden_member_highlighting | Warning |
Redundant method overload (non-private accessibility) | RedundantOverload.Global | resharper_redundant_overload_global_highlighting | Suggestion |
Redundant method overload (private accessibility) | RedundantOverload.Local | resharper_redundant_overload_local_highlighting | Suggestion |
Redundant 'partial' modifier on method declaration | PartialMethodWithSinglePart | resharper_partial_method_with_single_part_highlighting | Warning |
Redundant 'partial' modifier on type declaration | PartialTypeWithSinglePart | resharper_partial_type_with_single_part_highlighting | Warning |
Sealed member in sealed class | SealedMemberInSealedClass | resharper_sealed_member_in_sealed_class_highlighting | Warning |
Type member is never accessed via base type (non-private accessibility) | UnusedMemberInSuper.Global | resharper_unused_member_in_super_global_highlighting | Suggestion |
Type member is never accessed via base type (private accessibility) | UnusedMemberInSuper.Local | resharper_unused_member_in_super_local_highlighting | Warning |
Type member is only used in overrides (non-private accessibility) | UnusedMemberHierarchy.Global | resharper_unused_member_hierarchy_global_highlighting | Suggestion |
Type member is only used in overrides (private accessibility) | UnusedMemberHierarchy.Local | resharper_unused_member_hierarchy_local_highlighting | Warning |
Type or member is never used (non-private accessibility) | UnusedMember.Global | resharper_unused_member_global_highlighting | Suggestion |
Type or member is never used (private accessibility) | UnusedMember.Local | resharper_unused_member_local_highlighting | Warning |
Underlying type of enum is 'int' | EnumUnderlyingTypeIsInt | resharper_enum_underlying_type_is_int_highlighting | Warning |
Unused label | UnusedLabel | resharper_unused_label_highlighting | Warning |
Unused local variable | UnusedVariable | resharper_unused_variable_highlighting | Warning |
Unused parameter (non-private accessibility) | UnusedParameter.Global | resharper_unused_parameter_global_highlighting | Suggestion |
Unused parameter (private accessibility) | UnusedParameter.Local | resharper_unused_parameter_local_highlighting | Warning |
Unused parameter in partial method | UnusedParameterInPartialMethod | resharper_unused_parameter_in_partial_method_highlighting | Warning |
Unused parameter of local function | UnusedLocalFunctionParameter | resharper_unused_local_function_parameter_highlighting | Warning |
Unused type parameter | UnusedTypeParameter | resharper_unused_type_parameter_highlighting | Warning |
Virtual(overridable) member is never overridden (non-private accessibility) | VirtualMemberNeverOverridden.Global | resharper_virtual_member_never_overridden_global_highlighting | Suggestion |
Virtual(overridable) member is never overridden (private accessibility) | VirtualMemberNeverOverridden.Local | resharper_virtual_member_never_overridden_local_highlighting | Suggestion |
Spelling issues (3 inspections)
These inspections detect typos in various contexts.Inspection | ID | EditorConfig property | Default severity |
---|---|---|---|
Typo in comment | CommentTypo | resharper_comment_typo_highlighting | Suggestion |
Typo in identifier | IdentifierTypo | resharper_identifier_typo_highlighting | Suggestion |
Typo in string literal | StringLiteralTypo | resharper_string_literal_typo_highlighting | Suggestion |
Xunit (1 inspection)
These inspections detect code issues related to xUnit.Net tests.Inspection | ID | EditorConfig property | Default severity |
---|---|---|---|
Console output in Xunit tests | Xunit.XunitTestWithConsoleOutput | resharper_xunit_xunit_test_with_console_output_highlighting | Warning |