ReSharper 2025.3 Help

C# 代码检查

在 C# 中,ReSharper 2025.3 提供两类代码检查:1243 项 错误检测检查 ,例如语法错误、未解析符号、编译器错误等(这些检查无法配置或禁用),以及 1068 项 专有代码检查 ,这些检查 可以禁用或更改其 严重性级别
这些 代码检查帮助您在 设计时检测所有打开文件中的代码问题,并且还允许您 在特定范围内查找代码问题

可配置的 C# 检查项如下所示,按其 类别分组。

代码通知(3 项检查)

此类别将严重性级别较低的代码检查分组。

检查
ID
EditorConfig 属性

默认严重性

C# 14 中使用 span 参数的重载解析中的重大变更
CSharp14OverloadResolutionWithSpanBreakingChange
resharper_c_sharp14_overload_resolution_with_span_breaking_change_highlighting

建议

方法调用被跳过
InvocationIsSkipped
resharper_invocation_is_skipped_highlighting

提示

部分代码无法解析
NonParsableElement
resharper_non_parsable_element_highlighting

警告

常见实践和代码改进(174 项检查)

此类别分组的检查主要查找中等严重性的问题,这些问题主要影响代码的可读性。

检查
ID
EditorConfig 属性

默认严重性

通过派生类型访问类型的静态成员
AccessToStaticMemberViaDerivedType
resharper_access_to_static_member_via_derived_type_highlighting

警告

忽略了 'Stream.Read()' 实际读取的字节数
StreamReadReturnValueIgnored
resharper_stream_read_return_value_ignored_highlighting

警告

在本地函数前添加显式 'return' 或 'continue'
SeparateLocalFunctionsWithJumpStatement
resharper_separate_local_functions_with_jump_statement_highlighting

提示

层次结构中的注解重复
AnnotationRedundancyInHierarchy
resharper_annotation_redundancy_in_hierarchy_highlighting

警告

自动属性可以设为仅 get(非私有可访问性)
AutoPropertyCanBeMadeGetOnly.Global
resharper_auto_property_can_be_made_get_only_global_highlighting

建议

自动属性可以设为仅 get(私有可访问性)
AutoPropertyCanBeMadeGetOnly.Local
resharper_auto_property_can_be_made_get_only_local_highlighting

建议

基类成员有 'params' 参数,但重写方法没有
BaseMemberHasParams
resharper_base_member_has_params_highlighting

警告

可在 'Add' 前简化 'Contains' 检查
CanSimplifySetAddingWithSingleCall
resharper_can_simplify_set_adding_with_single_call_highlighting

建议

类型转换表达式可替换为显式类型参数
CanReplaceCastWithTypeArgument
resharper_can_replace_cast_with_type_argument_highlighting

提示

类型转换表达式可替换为显式变量类型
CanReplaceCastWithVariableType
resharper_can_replace_cast_with_variable_type_highlighting

提示

类型转换表达式可替换为 lambda 返回类型
CanReplaceCastWithLambdaReturnType
resharper_can_replace_cast_with_lambda_return_type_highlighting

提示

类型转换表达式可替换为简化类型参数
CanReplaceCastWithShorterTypeArgument
resharper_can_replace_cast_with_shorter_type_argument_highlighting

建议

将锁字段类型更改为 'System.Threading.Lock'
ChangeFieldTypeToSystemThreadingLock
resharper_change_field_type_to_system_threading_lock_highlighting

建议

检查引用相等性
CheckForReferenceEqualityInstead.1
resharper_check_for_reference_equality_instead_1_highlighting

建议

检查引用相等性
CheckForReferenceEqualityInstead.3
resharper_check_for_reference_equality_instead_3_highlighting

建议

检查引用相等性
CheckForReferenceEqualityInstead.2
resharper_check_for_reference_equality_instead_2_highlighting

建议

检查引用相等性
CheckForReferenceEqualityInstead.4
resharper_check_for_reference_equality_instead_4_highlighting

建议

类可以设为密封(不可继承)(非私有可访问性)
ClassCanBeSealed.Global
resharper_class_can_be_sealed_global_highlighting

已禁用

类可以设为密封(不可继承)(私有可访问性)
ClassCanBeSealed.Local
resharper_class_can_be_sealed_local_highlighting

已禁用

易混淆的类似代码块语句
MisleadingBodyLikeStatement
resharper_misleading_body_like_statement_highlighting

警告

容器可空性属性用于非容器类型的声明
ContainerAnnotationRedundancy
resharper_container_annotation_redundancy_highlighting

警告

将 'if do while' 转换为 'while'
ConvertIfDoToWhile
resharper_convert_if_do_to_while_highlighting

建议

将 'if' 转换为 '||'
ConvertIfToOrExpression
resharper_convert_if_to_or_expression_highlighting

建议

将局部变量或字段转换为常量(非私有可访问性)
ConvertToConstant.Global
resharper_convert_to_constant_global_highlighting

提示

将局部变量或字段转换为常量(私有可访问性)
ConvertToConstant.Local
resharper_convert_to_constant_local_highlighting

提示

声明可空性已推断(参数被推断为非 null)
AnnotateNotNullParameter
resharper_annotate_not_null_parameter_highlighting

已禁用

声明可空性已推断(参数被推断为可空)
AnnotateCanBeNullParameter
resharper_annotate_can_be_null_parameter_highlighting

已禁用

声明可空性已推断(类型成员被推断为非 null)
AnnotateNotNullTypeMember
resharper_annotate_not_null_type_member_highlighting

已禁用

声明可空性已推断(类型成员被推断为可空)
AnnotateCanBeNullTypeMember
resharper_annotate_can_be_null_type_member_highlighting

已禁用

字典项移除可用单个 'Remove' 简化
CanSimplifyDictionaryRemovingWithSingleCall
resharper_can_simplify_dictionary_removing_with_single_call_highlighting

建议

字典查找可用 'GetValueOrDefault' 简化
CanSimplifyDictionaryTryGetValueWithGetValueOrDefault
resharper_can_simplify_dictionary_try_get_value_with_get_value_or_default_highlighting

建议

字典查找可用 'TryAdd' 简化
CanSimplifyDictionaryLookupWithTryAdd
resharper_can_simplify_dictionary_lookup_with_try_add_highlighting

建议

字典查找可用 'TryGetValue' 简化
CanSimplifyDictionaryLookupWithTryGetValue
resharper_can_simplify_dictionary_lookup_with_try_get_value_highlighting

建议

空语句是多余的
EmptyStatement
resharper_empty_statement_highlighting

警告

提取通用属性模式
ExtractCommonPropertyPattern
resharper_extract_common_property_pattern_highlighting

提示

字段可以设为 readonly(非私有可访问性)
FieldCanBeMadeReadOnly.Global
resharper_field_can_be_made_read_only_global_highlighting

建议

字段可以设为 readonly(私有可访问性)
FieldCanBeMadeReadOnly.Local
resharper_field_can_be_made_read_only_local_highlighting

建议

仅 get 的自动属性从未被赋值
UnassignedGetOnlyAutoProperty
resharper_unassigned_get_only_auto_property_highlighting

警告

取反条件
InvertCondition.1
resharper_invert_condition_1_highlighting

提示

迭代变量可声明为更具体的类型
MoreSpecificForeachVariableTypeAvailable
resharper_more_specific_foreach_variable_type_available_highlighting

建议

合并局部变量声明和赋值
JoinDeclarationAndInitializer
resharper_join_declaration_and_initializer_highlighting

建议

本地函数可设为 static
LocalFunctionCanBeMadeStatic
resharper_local_function_can_be_made_static_highlighting

已禁用

局部变量声明范围过宽
TooWideLocalVariableScope
resharper_too_wide_local_variable_scope_highlighting

建议

将抽象类中的构造函数设为 protected
PublicConstructorInAbstractClass
resharper_public_constructor_in_abstract_class_highlighting

建议

成员可以设为私有(非私有可访问性)
MemberCanBePrivate.Global
resharper_member_can_be_private_global_highlighting

建议

成员可以设为私有(私有可访问性)
MemberCanBePrivate.Local
resharper_member_can_be_private_local_highlighting

建议

成员可以设为受保护(非私有可访问性)
MemberCanBeProtected.Global
resharper_member_can_be_protected_global_highlighting

建议

成员可以设为受保护(私有可访问性)
MemberCanBeProtected.Local
resharper_member_can_be_protected_local_highlighting

建议

成员可以设为静态(共享)(非私有可访问性)
MemberCanBeMadeStatic.Global
resharper_member_can_be_made_static_global_highlighting

提示

成员可以设为静态(共享)(私有可访问性)
MemberCanBeMadeStatic.Local
resharper_member_can_be_made_static_local_highlighting

提示

成员或类型可以设为内部(友元)
MemberCanBeInternal
resharper_member_can_be_internal_highlighting

已禁用

方法有异步重载
MethodHasAsyncOverload
resharper_method_has_async_overload_highlighting

建议

方法有支持取消的异步重载
MethodHasAsyncOverloadWithCancellation
resharper_method_has_async_overload_with_cancellation_highlighting

建议

方法支持取消操作
MethodSupportsCancellation
resharper_method_supports_cancellation_highlighting

建议

缺少 private 或 internal 类型或成员的 XML 注释
InternalOrPrivateMemberNotDocumented
resharper_internal_or_private_member_not_documented_highlighting

已禁用

多重可空属性的使用
MultipleNullableAttributesUsage
resharper_multiple_nullable_attributes_usage_highlighting

警告

嵌套字符串插值可内联
NestedStringInterpolation
resharper_nested_string_interpolation_highlighting

建议

可空性属性用于 void 或值类型的声明
AnnotationRedundancyAtValueType
resharper_annotation_redundancy_at_value_type_highlighting

警告

可空性属性用于无法被其他代码直接引用的声明
NotObservableAnnotationRedundancy
resharper_not_observable_annotation_redundancy_highlighting

警告

参数可以声明为基类型
SuggestBaseTypeForParameter
resharper_suggest_base_type_for_parameter_highlighting

已禁用

构造函数的参数可以声明为基类型
SuggestBaseTypeForParameterInConstructor
resharper_suggest_base_type_for_parameter_in_constructor_highlighting

已禁用

参数类型可以是 IEnumerable<T>(非私有可访问性)
ParameterTypeCanBeEnumerable.Global
resharper_parameter_type_can_be_enumerable_global_highlighting

已禁用

参数类型可以是 IEnumerable<T>(私有可访问性)
ParameterTypeCanBeEnumerable.Local
resharper_parameter_type_can_be_enumerable_local_highlighting

已禁用

建议优先使用具体值而非 'default' 或 'new()'
PreferConcreteValueOverDefault
resharper_prefer_concrete_value_over_default_highlighting

建议

属性可以设为仅 init(非私有可访问性)
PropertyCanBeMadeInitOnly.Global
resharper_property_can_be_made_init_only_global_highlighting

建议

属性可以设为仅 init(私有可访问性)
PropertyCanBeMadeInitOnly.Local
resharper_property_can_be_made_init_only_local_highlighting

建议

将本地函数放在 'return' 或 'continue' 之后
MoveLocalFunctionAfterJumpStatement
resharper_move_local_function_after_jump_statement_highlighting

提示

多余的 'is'
RedundantIsBeforeRelationalPattern
resharper_redundant_is_before_relational_pattern_highlighting

建议

移除构造函数调用
RemoveConstructorInvocation
resharper_remove_constructor_invocation_highlighting

已禁用

移除多余语句
RemoveRedundantOrStatement.False
resharper_remove_redundant_or_statement_false_highlighting

建议

移除多余语句
RemoveRedundantOrStatement.True
resharper_remove_redundant_or_statement_true_highlighting

建议

移除 ToList()
RemoveToList.1
resharper_remove_to_list_1_highlighting

建议

移除 ToList()
RemoveToList.2
resharper_remove_to_list_2_highlighting

建议

用返回 'Task' 的 'async' 代码替换
ReplaceAsyncWithTaskReturn
resharper_replace_async_with_task_return_highlighting

已禁用

替换为 FirstOrDefault($args$)
ReplaceWithFirstOrDefault.1
resharper_replace_with_first_or_default_1_highlighting

建议

替换为 FirstOrDefault($args$)
ReplaceWithFirstOrDefault.2
resharper_replace_with_first_or_default_2_highlighting

建议

替换为 FirstOrDefault($args$)
ReplaceWithFirstOrDefault.3
resharper_replace_with_first_or_default_3_highlighting

建议

替换为 FirstOrDefault($args$)
ReplaceWithFirstOrDefault.4
resharper_replace_with_first_or_default_4_highlighting

建议

替换为 LastOrDefault($args$)
ReplaceWithLastOrDefault.1
resharper_replace_with_last_or_default_1_highlighting

建议

替换为 LastOrDefault($args$)
ReplaceWithLastOrDefault.2
resharper_replace_with_last_or_default_2_highlighting

建议

替换为 LastOrDefault($args$)
ReplaceWithLastOrDefault.3
resharper_replace_with_last_or_default_3_highlighting

建议

替换为 LastOrDefault($args$)
ReplaceWithLastOrDefault.4
resharper_replace_with_last_or_default_4_highlighting

建议

替换为 OfType<T>()
ReplaceWithOfType.1
resharper_replace_with_of_type_1_highlighting

建议

替换为 OfType<T>()
ReplaceWithOfType.2
resharper_replace_with_of_type_2_highlighting

建议

替换为 OfType<T>()
ReplaceWithOfType.3
resharper_replace_with_of_type_3_highlighting

建议

替换为 OfType<T>().Any()
ReplaceWithOfType.Any.1
resharper_replace_with_of_type_any_1_highlighting

建议

替换为 OfType<T>().Any()(替换为 OfType<T>().Any(..))
ReplaceWithOfType.Any.2
resharper_replace_with_of_type_any_2_highlighting

建议

替换为 OfType<T>().Count()
ReplaceWithOfType.Count.1
resharper_replace_with_of_type_count_1_highlighting

建议

替换为 OfType<T>().Count()(替换为 OfType<T>().Count(..))
ReplaceWithOfType.Count.2
resharper_replace_with_of_type_count_2_highlighting

建议

替换为 OfType<T>().First()
ReplaceWithOfType.First.1
resharper_replace_with_of_type_first_1_highlighting

建议

替换为 OfType<T>().First()(替换为 OfType<T>().First(..))
ReplaceWithOfType.First.2
resharper_replace_with_of_type_first_2_highlighting

建议

替换为 OfType<T>().FirstOrDefault()
ReplaceWithOfType.FirstOrDefault.1
resharper_replace_with_of_type_first_or_default_1_highlighting

建议

替换为 OfType<T>().FirstOrDefault()(替换为 OfType<T>().FirstOrDefault(..))
ReplaceWithOfType.FirstOrDefault.2
resharper_replace_with_of_type_first_or_default_2_highlighting

建议

替换为 OfType<T>().Last()
ReplaceWithOfType.Last.1
resharper_replace_with_of_type_last_1_highlighting

建议

替换为 OfType<T>().Last()(替换为 OfType<T>().Last(..))
ReplaceWithOfType.Last.2
resharper_replace_with_of_type_last_2_highlighting

建议

替换为 OfType<T>().LastOrDefault()
ReplaceWithOfType.LastOrDefault.1
resharper_replace_with_of_type_last_or_default_1_highlighting

建议

替换为 OfType<T>().LastOrDefault()(替换为 OfType<T>().LastOrDefault(..))
ReplaceWithOfType.LastOrDefault.2
resharper_replace_with_of_type_last_or_default_2_highlighting

建议

替换为 OfType<T>().LongCount()
ReplaceWithOfType.LongCount
resharper_replace_with_of_type_long_count_highlighting

建议

替换为 OfType<T>().Single()
ReplaceWithOfType.Single.1
resharper_replace_with_of_type_single_1_highlighting

建议

替换为 OfType<T>().Single()(替换为 OfType<T>().Single(..))
ReplaceWithOfType.Single.2
resharper_replace_with_of_type_single_2_highlighting

建议

替换为 OfType<T>().SingleOrDefault()
ReplaceWithOfType.SingleOrDefault.1
resharper_replace_with_of_type_single_or_default_1_highlighting

建议

替换为 OfType<T>().SingleOrDefault()(替换为 OfType<T>().SingleOrDefault(..))
ReplaceWithOfType.SingleOrDefault.2
resharper_replace_with_of_type_single_or_default_2_highlighting

建议

替换为 OfType<T>().Where()(替换为 OfType<T>().Where(..))
ReplaceWithOfType.Where
resharper_replace_with_of_type_where_highlighting

建议

替换为简单赋值
ReplaceWithSimpleAssignment.True
resharper_replace_with_simple_assignment_true_highlighting

建议

替换为简单赋值
ReplaceWithSimpleAssignment.False
resharper_replace_with_simple_assignment_false_highlighting

建议

替换为单次赋值
ReplaceWithSingleAssignment.False
resharper_replace_with_single_assignment_false_highlighting

建议

替换为单次赋值
ReplaceWithSingleAssignment.True
resharper_replace_with_single_assignment_true_highlighting

建议

替换为单次调用 Any(..)
ReplaceWithSingleCallToAny
resharper_replace_with_single_call_to_any_highlighting

建议

替换为单次调用 Count(..)
ReplaceWithSingleCallToCount
resharper_replace_with_single_call_to_count_highlighting

建议

替换为单次调用 First(..)
ReplaceWithSingleCallToFirst
resharper_replace_with_single_call_to_first_highlighting

建议

替换为单次调用 FirstOrDefault(..)
ReplaceWithSingleCallToFirstOrDefault
resharper_replace_with_single_call_to_first_or_default_highlighting

建议

替换为单次调用 Last(..)
ReplaceWithSingleCallToLast
resharper_replace_with_single_call_to_last_highlighting

建议

替换为单次调用 LastOrDefault(..)
ReplaceWithSingleCallToLastOrDefault
resharper_replace_with_single_call_to_last_or_default_highlighting

建议

替换为单次调用 Single(..)
ReplaceWithSingleCallToSingle
resharper_replace_with_single_call_to_single_highlighting

建议

替换为单次调用 SingleOrDefault(..)
ReplaceWithSingleCallToSingleOrDefault
resharper_replace_with_single_call_to_single_or_default_highlighting

建议

替换为 SingleOrDefault($args$)
ReplaceWithSingleOrDefault.1
resharper_replace_with_single_or_default_1_highlighting

建议

替换为 SingleOrDefault($args$)
ReplaceWithSingleOrDefault.2
resharper_replace_with_single_or_default_2_highlighting

建议

替换为 SingleOrDefault($args$)
ReplaceWithSingleOrDefault.3
resharper_replace_with_single_or_default_3_highlighting

建议

替换为 SingleOrDefault($args$)
ReplaceWithSingleOrDefault.4
resharper_replace_with_single_or_default_4_highlighting

建议

返回类型可以是 IEnumerable<T>(非私有可访问性)
ReturnTypeCanBeEnumerable.Global
resharper_return_type_can_be_enumerable_global_highlighting

已禁用

返回类型可以是 IEnumerable<T>(私有可访问性)
ReturnTypeCanBeEnumerable.Local
resharper_return_type_can_be_enumerable_local_highlighting

已禁用

简化条件三元表达式
SimplifyConditionalTernaryExpression
resharper_simplify_conditional_ternary_expression_highlighting

建议

简化 'IsInstanceOfType()' 调用
CanSimplifyIsAssignableFrom
resharper_can_simplify_is_assignable_from_highlighting

建议

简化 LINQ 表达式(使用 'All')
SimplifyLinqExpressionUseAll
resharper_simplify_linq_expression_use_all_highlighting

建议

简化 LINQ 表达式(使用 'Any')
SimplifyLinqExpressionUseAny
resharper_simplify_linq_expression_use_any_highlighting

建议

简化取反模式
DoubleNegationInPattern
resharper_double_negation_in_pattern_highlighting

建议

简化取反关系模式
NegationOfRelationalPattern
resharper_negation_of_relational_pattern_highlighting

建议

简化负等式表达式
NegativeEqualityExpression
resharper_negative_equality_expression_highlighting

建议

显式指定字符串比较
SpecifyStringComparison
resharper_specify_string_comparison_highlighting

提示

显式指定字符串区域性
SpecifyACultureInStringConversionExplicitly
resharper_specify_a_culture_in_string_conversion_explicitly_highlighting

警告

字符串字面量可内联
StringLiteralAsInterpolationArgument
resharper_string_literal_as_interpolation_argument_highlighting

建议

String.Compare 是与文化相关的(string.Compare(string, int, string, int) 是与文化相关的)
StringCompareIsCultureSpecific.4
resharper_string_compare_is_culture_specific_4_highlighting

警告

String.Compare 是与文化相关的(string.Compare(string, int, string, int, bool) 是与文化相关的)
StringCompareIsCultureSpecific.5
resharper_string_compare_is_culture_specific_5_highlighting

警告

String.Compare 是与文化相关的(string.Compare(string, int, string, int, bool) 是与文化相关的)
StringCompareIsCultureSpecific.6
resharper_string_compare_is_culture_specific_6_highlighting

警告

String.Compare 是与文化相关的(string.Compare(string, string) 是与文化相关的)
StringCompareIsCultureSpecific.1
resharper_string_compare_is_culture_specific_1_highlighting

警告

String.Compare 是与文化相关的(string.Compare(string, string, bool) 是与文化相关的)
StringCompareIsCultureSpecific.2
resharper_string_compare_is_culture_specific_2_highlighting

警告

String.Compare 是与文化相关的(string.Compare(string, string, bool) 是与文化相关的)
StringCompareIsCultureSpecific.3
resharper_string_compare_is_culture_specific_3_highlighting

警告

String.CompareTo 是与文化相关的
StringCompareToIsCultureSpecific
resharper_string_compare_to_is_culture_specific_highlighting

警告

String.EndsWith 是与文化相关的(string.EndsWith(string) 是与文化相关的)
StringEndsWithIsCultureSpecific
resharper_string_ends_with_is_culture_specific_highlighting

已禁用

String.IndexOf 是与文化相关的(string.IndexOf(string) 是与文化相关的)
StringIndexOfIsCultureSpecific.1
resharper_string_index_of_is_culture_specific_1_highlighting

警告

String.IndexOf 是与文化相关的(string.IndexOf(string, int) 是与文化相关的)
StringIndexOfIsCultureSpecific.2
resharper_string_index_of_is_culture_specific_2_highlighting

警告

String.IndexOf 是与文化相关的(string.IndexOf(string, int) 是与文化相关的)
StringIndexOfIsCultureSpecific.3
resharper_string_index_of_is_culture_specific_3_highlighting

警告

String.LastIndexOf 是与文化相关的(string.LastIndexOf(string) 是与文化相关的)
StringLastIndexOfIsCultureSpecific.1
resharper_string_last_index_of_is_culture_specific_1_highlighting

警告

String.LastIndexOf 是与文化相关的(string.LastIndexOf(string, int) 是与文化相关的)
StringLastIndexOfIsCultureSpecific.2
resharper_string_last_index_of_is_culture_specific_2_highlighting

警告

String.LastIndexOf 是与文化相关的(string.LastIndexOf(string, int) 是与文化相关的)
StringLastIndexOfIsCultureSpecific.3
resharper_string_last_index_of_is_culture_specific_3_highlighting

警告

String.StartsWith 是与文化相关的(string.StartsWith(string) 是与文化相关的)
StringStartsWithIsCultureSpecific
resharper_string_starts_with_is_culture_specific_highlighting

已禁用

结构体可以设为 readonly
StructCanBeMadeReadOnly
resharper_struct_can_be_made_read_only_highlighting

建议

结构体缺少 'IEquatable' 实现(非私有可访问性)
StructLacksIEquatable.Global
resharper_struct_lacks_i_equatable_global_highlighting

警告

结构体缺少 'IEquatable' 实现(私有可访问性)
StructLacksIEquatable.Local
resharper_struct_lacks_i_equatable_local_highlighting

警告

结构体成员可以设为 readonly
StructMemberCanBeMadeReadOnly
resharper_struct_member_can_be_made_read_only_highlighting

已禁用

具有默认相等成员的结构体用于比较(非私有可访问性)
DefaultStructEqualityIsUsed.Global
resharper_default_struct_equality_is_used_global_highlighting

警告

具有默认相等成员的结构体用于比较(私有可访问性)
DefaultStructEqualityIsUsed.Local
resharper_default_struct_equality_is_used_local_highlighting

警告

try-catch 和 try-finally 语句可以合并
TryStatementsCanBeMerged
resharper_try_statements_can_be_merged_highlighting

提示

类型可设为文件级私有
MemberCanBeFileLocal
resharper_member_can_be_file_local_highlighting

已禁用

类型参数可声明为协变或逆变
TypeParameterCanBeVariant
resharper_type_parameter_can_be_variant_highlighting

建议

具有可疑相等性的类型用于记录(非私有可访问性)
TypeWithSuspiciousEqualityIsUsedInRecord.Global
resharper_type_with_suspicious_equality_is_used_in_record_global_highlighting

警告

具有可疑相等性的类型用于记录(私有可访问性)
TypeWithSuspiciousEqualityIsUsedInRecord.Local
resharper_type_with_suspicious_equality_is_used_in_record_local_highlighting

警告

使用默认结构体相等性
UsageOfDefaultStructEquality
resharper_usage_of_default_struct_equality_highlighting

警告

使用 'ArgumentNullException.ThrowIfNull'
UseThrowIfNullMethod
resharper_use_throw_if_null_method_highlighting

已禁用

使用数组创建表达式
UseArrayCreationExpression.1
resharper_use_array_creation_expression_1_highlighting

建议

使用数组创建表达式
UseArrayCreationExpression.2
resharper_use_array_creation_expression_2_highlighting

建议

使用 'Array.Empty<T>()'
UseArrayEmptyMethod
resharper_use_array_empty_method_highlighting

建议

使用取消令牌
UseCancellationTokenForIAsyncEnumerable
resharper_use_cancellation_token_for_i_async_enumerable_highlighting

建议

使用编译器支持的可空属性
UseNullableAttributesSupportedByCompiler
resharper_use_nullable_attributes_supported_by_compiler_highlighting

建议

使用 'EventArgs.Empty'
UseEventArgsEmptyField
resharper_use_event_args_empty_field_highlighting

建议

使用索引属性
UseIndexedProperty
resharper_use_indexed_property_highlighting

建议

使用 'is' 运算符
CanSimplifyIsInstanceOfType
resharper_can_simplify_is_instance_of_type_highlighting

建议

使用方法 Any()
UseMethodAny.0
resharper_use_method_any_0_highlighting

建议

使用方法 Any()
UseMethodAny.1
resharper_use_method_any_1_highlighting

建议

使用方法 Any()
UseMethodAny.2
resharper_use_method_any_2_highlighting

建议

使用方法 Any()
UseMethodAny.3
resharper_use_method_any_3_highlighting

建议

使用方法 Any()
UseMethodAny.4
resharper_use_method_any_4_highlighting

建议

使用 'String.IsNullOrEmpty'
ReplaceWithStringIsNullOrEmpty
resharper_replace_with_string_is_null_or_empty_highlighting

建议

使用 'Type.EmptyTypes'
UseEmptyTypesField
resharper_use_empty_types_field_highlighting

建议

编译器警告(211 项检查)

此类别中的检查会在编译前检测编译器警告。

检查
ID
EditorConfig 属性

默认严重性

'#warning' 指令
CSharpWarnings::CS1030
resharper_c_sharp_warnings_cs1030_highlighting

警告

[InterpolatedStringHandlerArgument] 应用于 lambda 参数时无效,调用处将被忽略。
CSharpWarnings::CS8971
resharper_c_sharp_warnings_cs8971_highlighting

警告

为 'ref readonly' 参数指定了默认值,但 'ref readonly' 仅应用于引用类型。 建议将参数声明为 'in'。
CSharpWarnings::CS9200
resharper_c_sharp_warnings_cs9200_highlighting

警告

局部变量以引用方式返回,但其初始化值无法以引用方式返回。
CSharpWarnings::CS9082
resharper_c_sharp_warnings_cs9082_highlighting

警告

变量的成员以引用方式返回,但其初始化值无法以引用方式返回
CSharpWarnings::CS9083
resharper_c_sharp_warnings_cs9083_highlighting

警告

带有 [DoesNotReturn] 标记的方法不应有返回值。
CSharpWarnings::CS8763
resharper_c_sharp_warnings_cs8763_highlighting

警告

可能的 null 值不应用于带有 [NotNull] 或 [DisallowNull] 标记的类型。
CSharpWarnings::CS8607
resharper_c_sharp_warnings_cs8607_highlighting

警告

前面的 catch 子句已捕获所有异常
CSharpWarnings::CS1058
resharper_c_sharp_warnings_cs1058_highlighting

警告

在此上下文中 stackalloc 表达式的结果可能会暴露到包含方法之外。
CSharpWarnings::CS9081
resharper_c_sharp_warnings_cs9081_highlighting

警告

日志消息中的模板在日志方法定义中没有对应的参数
CSharpWarnings::SYSLIB1014
resharper_c_sharp_warnings_syslib1014_highlighting

警告

类型为 'System.Threading.Lock' 的值转换为其他类型时,在 'lock' 语句中可能会使用非预期的基于监视器的锁定机制
CSharpWarnings::CS9216
resharper_c_sharp_warnings_cs9216_highlighting

警告

通过匿名方法、lambda 表达式、查询表达式或迭代器中的 'base' 关键字访问成员会导致无法验证的代码
CSharpWarnings::CS1911
resharper_c_sharp_warnings_cs1911_highlighting

警告

对齐值 'value' 的绝对值大于 'magnitude limit',可能导致格式化字符串过大。
CSharpWarnings::CS8094
resharper_c_sharp_warnings_cs8094_highlighting

警告

XML 注释中存在歧义引用
CSharpWarnings::CS1574
resharper_c_sharp_warnings_cs1574_highlighting

警告

由于引用类型的可空性不同,参数无法作为输出用于对应参数。
CSharpWarnings::CS8624
resharper_c_sharp_warnings_cs8624_highlighting

警告

由于引用类型的可空性不同,参数无法用于对应参数。
CSharpWarnings::CS8620
resharper_c_sharp_warnings_cs8620_highlighting

警告

参数应为变量,因为其被传递给 'ref readonly' 参数。
CSharpWarnings::CS9193
resharper_c_sharp_warnings_cs9193_highlighting

警告

参数应使用 'in' 关键字传递。
CSharpWarnings::CS9195
resharper_c_sharp_warnings_cs9195_highlighting

警告

条件表达式中的赋值操作
CSharpWarnings::CS0665
resharper_c_sharp_warnings_cs0665_highlighting

警告

对同一变量进行了赋值
CSharpWarnings::CS1717
resharper_c_sharp_warnings_cs1717_highlighting

警告

异步函数未包含 await 表达式
CSharpWarnings::CS1998
resharper_c_sharp_warnings_cs1998_highlighting

警告

异步方法调用未包含 await 表达式
CSharpWarnings::CS4014
resharper_c_sharp_warnings_cs4014_highlighting

警告

异步 'Main' 方法不会被用作入口点,因为已找到同步入口点。
CSharpWarnings::CS8892
resharper_c_sharp_warnings_cs8892_highlighting

警告

异步迭代器包含一个或多个类型为 'CancellationToken' 的参数,但均未使用 'EnumeratorCancellation' 属性标注。
CSharpWarnings::CS8425
resharper_c_sharp_warnings_cs8425_highlighting

警告

'attribute modifier' 不是有效的属性位置。 此代码块中的所有属性都将被忽略
CSharpWarnings::CS0658
resharper_c_sharp_warnings_cs0658_highlighting

警告

'attribute modifier' 不是此声明的有效属性位置。 此代码块中的所有属性都将被忽略
CSharpWarnings::CS0657
resharper_c_sharp_warnings_cs0657_highlighting

警告

包含注释文件中的 XML 格式错误
CSharpWarnings::CS1592
resharper_c_sharp_warnings_cs1592_highlighting

警告

对符号扩展操作数使用按位或运算符
CSharpWarnings::CS0675
resharper_c_sharp_warnings_cs0675_highlighting

警告

从 'readonly' 成员调用非 readonly 成员会导致 'this' 被隐式复制
CSharpWarnings::CS8656
resharper_c_sharp_warnings_cs8656_highlighting

警告

无法将 null 字面量转换为非可空引用类型。
CSharpWarnings::CS8625
resharper_c_sharp_warnings_cs8625_highlighting

警告

无法解析 XML 注释中的引用
CSharpWarnings::CS1574,CS1584,CS1581,CS1580
resharper_c_sharp_warnings_cs1574_cs1584_cs1581_cs1580_highlighting

警告

类重写了 Object.Equals(object o) 但未重写 Object.GetHashCode()
CSharpWarnings::CS0659
resharper_c_sharp_warnings_cs0659_highlighting

警告

代码不可达
CSharpWarnings::CS0162
resharper_c_sharp_warnings_cs0162_highlighting

警告

集合表达式可能导致意外的堆分配
CSharpWarnings::CS9208
resharper_c_sharp_warnings_cs9208_highlighting

警告

集合表达式因使用 '..' 展开可能导致意外的堆分配
CSharpWarnings::CS9209
resharper_c_sharp_warnings_cs9209_highlighting

警告

与可空值类型的 null 比较始终为 'false'
CSharpWarnings::CS0464
resharper_c_sharp_warnings_cs0464_highlighting

警告

与整型常量的比较无意义;该常量超出了类型 'type' 的取值范围。
CSharpWarnings::CS0652
resharper_c_sharp_warnings_cs0652_highlighting

警告

将方法组转换为非委托类型 'object'.
CSharpWarnings::CS8974
resharper_c_sharp_warnings_cs8974_highlighting

警告

将 null 字面量或可能为 null 的值转换为非可空类型。
CSharpWarnings::CS8600
resharper_c_sharp_warnings_cs8600_highlighting

警告

在 sealed 类中声明新的 protected 成员等同于声明为 private
CSharpWarnings::CS0628
resharper_c_sharp_warnings_cs0628_highlighting

警告

为参数指定的默认值无效,因为该参数应用于不允许可选参数的成员
CSharpWarnings::CS1066
resharper_c_sharp_warnings_cs1066_highlighting

警告

可能对 null 引用进行了解引用操作。
CSharpWarnings::CS8602
resharper_c_sharp_warnings_cs8602_highlighting

警告

XML 注释中存在重复的 param 标签
CSharpWarnings::CS1571
resharper_c_sharp_warnings_cs1571_highlighting

警告

XML 注释中存在重复的 typeparam 标签
CSharpWarnings::CS1710
resharper_c_sharp_warnings_cs1710_highlighting

警告

空的 switch 代码块
CSharpWarnings::CS1522
resharper_c_sharp_warnings_cs1522_highlighting

警告

字段从未使用
UnusedField.Compiler
resharper_unused_field_compiler_highlighting

警告

筛选表达式为常量,建议移除筛选条件
CSharpWarnings::CS7095
resharper_c_sharp_warnings_cs7095_highlighting

警告

给定表达式始终匹配所提供的模式
CSharpWarnings::CS8794
resharper_c_sharp_warnings_cs8794_highlighting

警告

给定表达式始终为所提供的类型
CSharpWarnings::CS0183
resharper_c_sharp_warnings_cs0183_highlighting

警告

给定表达式从不是所提供的类型
CSharpWarnings::CS0184
resharper_c_sharp_warnings_cs0184_highlighting

警告

'goto case' 的值无法隐式转换为所需类型
CSharpWarnings::CS0469
resharper_c_sharp_warnings_cs0469_highlighting

警告

在语言版本预览中,'field' 关键字绑定到属性的合成后备字段
CSharpWarnings::CS9258
resharper_c_sharp_warnings_cs9258_highlighting

警告

XML 注释中的签名不正确
CSharpWarnings::CS1580
resharper_c_sharp_warnings_cs1580_highlighting

警告

内联数组转换运算符不会用于从声明类型的表达式进行转换。
CSharpWarnings::CS9183
resharper_c_sharp_warnings_cs9183_highlighting

警告

内联数组索引器不会用于元素访问表达式。
CSharpWarnings::CS9181
resharper_c_sharp_warnings_cs9181_highlighting

警告

内联数组 'Slice' 方法不会用于元素访问表达式。
CSharpWarnings::CS9182
resharper_c_sharp_warnings_cs9182_highlighting

警告

对于元素字段为 'ref' 字段或类型参数无效的内联数组类型,不支持 'Inline arrays' 语言特性。
CSharpWarnings::CS9184
resharper_c_sharp_warnings_cs9184_highlighting

警告

引入 'Finalize' 方法可能会干扰析构函数的调用
CSharpWarnings::CS0465
resharper_c_sharp_warnings_cs0465_highlighting

警告

XML 注释中包含无效的 XML
CSharpWarnings::CS1570
resharper_c_sharp_warnings_cs1570_highlighting

警告

XML 注释中包含无效的 include 元素
CSharpWarnings::CS1590
resharper_c_sharp_warnings_cs1590_highlighting

警告

'new' 关键字是多余的
CSharpWarnings::CS0109
resharper_c_sharp_warnings_cs0109_highlighting

警告

需要 'new' 关键字
CSharpWarnings::CS0108,CS0114
resharper_c_sharp_warnings_cs0108_cs0114_highlighting

警告

成员不能在此属性中使用。
CSharpWarnings::CS8776
resharper_c_sharp_warnings_cs8776_highlighting

警告

成员在函数退出时必须有条件地为非 null 值。
CSharpWarnings::CS8775
resharper_c_sharp_warnings_cs8775_highlighting

警告

成员在退出时必须为非 null 值。
CSharpWarnings::CS8774
resharper_c_sharp_warnings_cs8774_highlighting

警告

成员重写了已过时的成员
CSharpWarnings::CS0672
resharper_c_sharp_warnings_cs0672_highlighting

警告

方法缺少 '[DoesNotReturn]' 注解,无法与实现或重写的成员匹配。
CSharpWarnings::CS8770
resharper_c_sharp_warnings_cs8770_highlighting

警告

公开可见类型或成员缺少 XML 注释
CSharpWarnings::CS1591
resharper_c_sharp_warnings_cs1591_highlighting

警告

运行时存在多个重写候选项
CSharpWarnings::CS1957
resharper_c_sharp_warnings_cs1957_highlighting

警告

发现多个同名 Shader
ShaderLabShaderReferenceMultipleCandidates
resharper_shader_lab_shader_reference_multiple_candidates_highlighting

警告

命名空间应为此项目的默认命名空间
CSharpWarnings::WME006
resharper_c_sharp_warnings_wme006_highlighting

警告

未访问的字段
NotAccessedField.Compiler
resharper_not_accessed_field_compiler_highlighting

警告

未访问的局部变量
NotAccessedVariable.Compiler
resharper_not_accessed_variable_compiler_highlighting

警告

非可空后备字段未初始化。
CSharpWarnings::CS9264
resharper_c_sharp_warnings_cs9264_highlighting

警告

非可空成员未初始化。
CSharpWarnings::CS8618
resharper_c_sharp_warnings_cs8618_highlighting

警告

类型参数约束中的可空性不匹配。
CSharpWarnings::CS8633
resharper_c_sharp_warnings_cs8633_highlighting

警告

显式接口说明符中的引用类型可空性与类型实现的接口不匹配。
CSharpWarnings::CS8643
resharper_c_sharp_warnings_cs8643_highlighting

警告

基类实现的接口中的引用类型可空性不匹配。
CSharpWarnings::CS8644
resharper_c_sharp_warnings_cs8644_highlighting

警告

返回类型中的引用类型可空性与实现的成员不匹配。
CSharpWarnings::CS8616
resharper_c_sharp_warnings_cs8616_highlighting

警告

返回类型中的引用类型可空性与隐式实现的成员不匹配。
CSharpWarnings::CS8613
resharper_c_sharp_warnings_cs8613_highlighting

警告

返回类型中的引用类型可空性与重写的成员不匹配。
CSharpWarnings::CS8609
resharper_c_sharp_warnings_cs8609_highlighting

警告

返回类型中的引用类型可空性与 partial 方法声明不匹配。
CSharpWarnings::CS8819
resharper_c_sharp_warnings_cs8819_highlighting

警告

返回类型中引用类型的可空性与目标委托不匹配(可能由于可空性属性导致)。
CSharpWarnings::CS8621
resharper_c_sharp_warnings_cs8621_highlighting

警告

拦截器方法中返回类型的引用类型可空性与可拦截方法不匹配
CSharpWarnings::CS9159
resharper_c_sharp_warnings_cs9159_highlighting

警告

源类型中引用类型的可空性与目标类型不匹配。
CSharpWarnings::CS8619
resharper_c_sharp_warnings_cs8619_highlighting

警告

类型中引用类型的可空性与已实现成员不匹配。
CSharpWarnings::CS8615
resharper_c_sharp_warnings_cs8615_highlighting

警告

类型中引用类型的可空性与隐式实现的成员不匹配。
CSharpWarnings::CS8612
resharper_c_sharp_warnings_cs8612_highlighting

警告

类型中引用类型的可空性与重写的成员不匹配。
CSharpWarnings::CS8608
resharper_c_sharp_warnings_cs8608_highlighting

警告

参数类型中引用类型的可空性与目标委托不匹配(可能由于可空性属性导致)。
CSharpWarnings::CS8622
resharper_c_sharp_warnings_cs8622_highlighting

警告

参数类型中引用类型的可空性与已实现成员不匹配。
CSharpWarnings::CS8617
resharper_c_sharp_warnings_cs8617_highlighting

警告

参数类型中引用类型的可空性与隐式实现的成员不匹配。
CSharpWarnings::CS8614
resharper_c_sharp_warnings_cs8614_highlighting

警告

参数类型中引用类型的可空性与可拦截方法不匹配
CSharpWarnings::CS9158
resharper_c_sharp_warnings_cs9158_highlighting

警告

参数类型中引用类型的可空性与重写的成员不匹配。
CSharpWarnings::CS8610
resharper_c_sharp_warnings_cs8610_highlighting

警告

参数类型中引用类型的可空性与 partial 成员声明不匹配。
CSharpWarnings::CS8611
resharper_c_sharp_warnings_cs8611_highlighting

警告

返回类型的可空性与已实现成员不匹配(可能由于可空性属性导致)。
CSharpWarnings::CS8768
resharper_c_sharp_warnings_cs8768_highlighting

警告

返回类型的可空性与隐式实现的成员不匹配(可能由于可空性属性导致)。
CSharpWarnings::CS8766
resharper_c_sharp_warnings_cs8766_highlighting

警告

返回类型的可空性与重写的成员不匹配(可能由于可空性属性导致)。
CSharpWarnings::CS8764
resharper_c_sharp_warnings_cs8764_highlighting

警告

类型参数的可空性与 'class' 约束不匹配。
CSharpWarnings::CS8634
resharper_c_sharp_warnings_cs8634_highlighting

警告

类型参数的可空性与约束类型不匹配。
CSharpWarnings::CS8631
resharper_c_sharp_warnings_cs8631_highlighting

警告

类型参数的可空性与 'notnull' 约束不匹配。
CSharpWarnings::CS8714
resharper_c_sharp_warnings_cs8714_highlighting

警告

参数类型的可空性与已实现成员不匹配(可能由于可空性属性导致)。
CSharpWarnings::CS8769
resharper_c_sharp_warnings_cs8769_highlighting

警告

参数类型的可空性与隐式实现的成员不匹配(可能由于可空性属性导致)。
CSharpWarnings::CS8767
resharper_c_sharp_warnings_cs8767_highlighting

警告

参数类型的可空性与重写的成员不匹配(可能由于可空性属性导致)。
CSharpWarnings::CS8765
resharper_c_sharp_warnings_cs8765_highlighting

警告

可空值类型可能为 null。
CSharpWarnings::CS8629
resharper_c_sharp_warnings_cs8629_highlighting

警告

对象或集合初始化器隐式解引用了可能为 null 的成员。
CSharpWarnings::CS8670
resharper_c_sharp_warnings_cs8670_highlighting

警告

已过时成员重写了非过时成员
CSharpWarnings::CS0809
resharper_c_sharp_warnings_cs0809_highlighting

警告

不应强制要求已过时的成员。
CSharpWarnings::CS9042
resharper_c_sharp_warnings_cs9042_highlighting

警告

运算符 '==' 或 '!=' 未重写 'Object.Equals(object o)' 和 'Object.GetHashCode()'
CSharpWarnings::CS0660,CS0661
resharper_c_sharp_warnings_cs0660_cs0661_highlighting

警告

在使用预览功能前请先选择加入。
CSharpWarnings::CA2252
resharper_c_sharp_warnings_ca2252_highlighting

错误

参数在 XML 注释中没有匹配的 param 标签
CSharpWarnings::CS1573
resharper_c_sharp_warnings_cs1573_highlighting

警告

lambda 中的参数有 params 修饰符,但目标委托类型没有。
CSharpWarnings::CS9100
resharper_c_sharp_warnings_cs9100_highlighting

警告

参数被捕获到封闭类型的状态中,其值也会传递给基类构造函数。 该值也可能被基类捕获。
CSharpWarnings::CS9107
resharper_c_sharp_warnings_cs9107_highlighting

警告

参数被捕获到封闭类型的状态中,其值也用于初始化字段、属性或事件。
CSharpWarnings::CS9124
resharper_c_sharp_warnings_cs9124_highlighting

警告

参数在函数退出时必须有条件地为非 null 值。
CSharpWarnings::CS8762
resharper_c_sharp_warnings_cs8762_highlighting

警告

因 [NotNullIfNotNull] 注解中提及的参数为非 null,参数在退出时必须为非 null 值。
CSharpWarnings::CS8824
resharper_c_sharp_warnings_cs8824_highlighting

警告

参数在退出时必须为非 null 值。
CSharpWarnings::CS8777
resharper_c_sharp_warnings_cs8777_highlighting

警告

参数在参数列表中位于插值字符串处理程序参数之后。
CSharpWarnings::CS8947
resharper_c_sharp_warnings_cs8947_highlighting

警告

Partial 成员声明的签名不一致。
CSharpWarnings::CS9256
resharper_c_sharp_warnings_cs9256_highlighting

警告

partial 方法声明的类型参数可空性不一致。
CSharpWarnings::CS8667
resharper_c_sharp_warnings_cs8667_highlighting

警告

可能误用的空语句
CSharpWarnings::CS0642
resharper_c_sharp_warnings_cs0642_highlighting

警告

参数可能为 null 引用参数。
CSharpWarnings::CS8604
resharper_c_sharp_warnings_cs8604_highlighting

警告

可能为 null 的引用赋值。
CSharpWarnings::CS8601
resharper_c_sharp_warnings_cs8601_highlighting

警告

可能为 null 的引用返回值。
CSharpWarnings::CS8603
resharper_c_sharp_warnings_cs8603_highlighting

警告

可能为非预期的引用比较
CSharpWarnings::CS0252,CS0253
resharper_c_sharp_warnings_cs0252_cs0253_highlighting

警告

对作为 'using' 或 'lock' 语句参数的局部变量可能赋值不正确
CSharpWarnings::CS0728
resharper_c_sharp_warnings_cs0728_highlighting

警告

主构造函数参数被基类成员遮蔽。
CSharpWarnings::CS9179
resharper_c_sharp_warnings_cs9179_highlighting

警告

record 类型定义了 'Equals' 但未定义 'GetHashCode'
CSharpWarnings::CS8851
resharper_c_sharp_warnings_cs8851_highlighting

警告

参数的引用类型修饰符与被隐藏成员中的对应参数不匹配。
CSharpWarnings::CS9197
resharper_c_sharp_warnings_cs9197_highlighting

警告

参数的引用类型修饰符与重写或实现成员中的对应参数不匹配。
CSharpWarnings::CS9196
resharper_c_sharp_warnings_cs9196_highlighting

警告

参数的引用类型修饰符与目标中的对应参数不匹配。
CSharpWarnings::CS9198
resharper_c_sharp_warnings_cs9198_highlighting

警告

对 volatile 字段的引用不会被视为 volatile
CSharpWarnings::CS0420
resharper_c_sharp_warnings_cs0420_highlighting

警告

因 [NotNullIfNotNull] 注解中提及的参数为非 null,返回值必须为非 null。
CSharpWarnings::CS8825
resharper_c_sharp_warnings_cs8825_highlighting

警告

可拦截方法与拦截器方法的签名不匹配
CSharpWarnings::CS9154
resharper_c_sharp_warnings_cs9154_highlighting

警告

源文件已超出 PDB 可表示的 16,707,565 行限制;调试信息将不正确
CSharpWarnings::CS1687
resharper_c_sharp_warnings_cs1687_highlighting

警告

'is' 或 'as' 运算符中的静态类型。
CSharpWarnings::CS7023
resharper_c_sharp_warnings_cs7023_highlighting

警告

结构体成员以引用方式返回 'this' 或其他实例成员。
CSharpWarnings::CS9084
resharper_c_sharp_warnings_cs9084_highlighting

警告

XML 注释中的语法错误
CSharpWarnings::CS1584
resharper_c_sharp_warnings_cs1584_highlighting

警告

对 marshal-by-reference 类字段取地址
CSharpWarnings::CS0197
resharper_c_sharp_warnings_cs0197_highlighting

警告

模板应是静态表达式
CSharpWarnings::CA2254
resharper_c_sharp_warnings_ca2254_highlighting

提示

在异步方法中不应对参数或局部变量使用 '&' 运算符。
CSharpWarnings::CS9123
resharper_c_sharp_warnings_cs9123_highlighting

警告

可空引用类型的注解应仅在 '#nullable' 注解上下文中的代码中使用。
CSharpWarnings::CS8632
resharper_c_sharp_warnings_cs8632_highlighting

警告

可空引用类型的注解应仅在 '#nullable' 注解上下文中的代码中使用。 自动生成的代码需要在源文件中显式添加 '#nullable' 指令。
CSharpWarnings::CS8669
resharper_c_sharp_warnings_cs8669_highlighting

警告

ref 条件运算符的分支引用了声明作用域不兼容的变量。
CSharpWarnings::CS9086
resharper_c_sharp_warnings_cs9086_highlighting

警告

应用于参数的 CallerArgumentExpressionAttribute 无效,因为它是自引用的
CSharpWarnings::CS8965
resharper_c_sharp_warnings_cs8965_highlighting

警告

CallerArgumentExpressionAttribute 应用于无效的参数名。
CSharpWarnings::CS8963
resharper_c_sharp_warnings_cs8963_highlighting

警告

CallerArgumentExpressionAttribute 无效,因为其应用于不允许可选参数的成员
CSharpWarnings::CS8966
resharper_c_sharp_warnings_cs8966_highlighting

警告

CallerArgumentExpressionAttribute 无效;已被 CallerFilePathAttribute 覆盖
CSharpWarnings::CS8961
resharper_c_sharp_warnings_cs8961_highlighting

警告

CallerArgumentExpressionAttribute 无效;已被 CallerLineNumberAttribute 覆盖
CSharpWarnings::CS8960
resharper_c_sharp_warnings_cs8960_highlighting

警告

CallerArgumentExpressionAttribute 无效;已被 CallerMemberNameAttribute 覆盖
CSharpWarnings::CS8962
resharper_c_sharp_warnings_cs8962_highlighting

警告

CallerFilePathAttribute 将无效;其被 CallerLineNumberAttribute 覆盖
CSharpWarnings::CS7082
resharper_c_sharp_warnings_cs7082_highlighting

警告

CallerFilePathAttribute 将无效,因为其应用于不允许可选参数的上下文中使用的成员
CSharpWarnings::CS4025
resharper_c_sharp_warnings_cs4025_highlighting

警告

CallerLineNumberAttribute 将无效,因为其应用于不允许可选参数的上下文中使用的成员
CSharpWarnings::CS4024
resharper_c_sharp_warnings_cs4024_highlighting

警告

CallerMemberNameAttribute 将无效,因为其应用于不允许可选参数的上下文中使用的成员
CSharpWarnings::CS4026
resharper_c_sharp_warnings_cs4026_highlighting

警告

CallerMemberNameAttribute 将无效;其被 CallerFilePathAttribute 覆盖
CSharpWarnings::CS7080
resharper_c_sharp_warnings_cs7080_highlighting

警告

CallerMemberNameAttribute 将无效;其被 CallerLineNumberAttribute 覆盖
CSharpWarnings::CS7081
resharper_c_sharp_warnings_cs7081_highlighting

警告

目标委托类型中的默认参数值不匹配。
CSharpWarnings::CS9099
resharper_c_sharp_warnings_cs9099_highlighting

警告

'EnumeratorCancellation' 属性仅在返回 'IAsyncEnumerable<>' 的异步迭代器方法中应用于类型为 'CancellationToken' 的参数时有效。
CSharpWarnings::CS8424
resharper_c_sharp_warnings_cs8424_highlighting

警告

给定表达式始终匹配所提供的常量。
CSharpWarnings::CS8520
resharper_c_sharp_warnings_cs8520_highlighting

警告

给定表达式从不匹配所提供的模式。
CSharpWarnings::CS8519
resharper_c_sharp_warnings_cs8519_highlighting

警告

'l' 后缀容易与数字 '1' 混淆
CSharpWarnings::CS0078
resharper_c_sharp_warnings_cs0078_highlighting

警告

由于存在顶级语句的编译单元,'Main' 方法不会被用作入口点。
CSharpWarnings::CS7022
resharper_c_sharp_warnings_cs7022_highlighting

警告

与 'in' 参数对应的参数的 'ref' 修饰符等同于 'in'。 建议改用 'in'。
CSharpWarnings::CS9191
resharper_c_sharp_warnings_cs9191_highlighting

警告

与 'in' 参数对应的参数的 'ref' 修饰符等同于 'in'。 建议改用 'in'。
CSharpWarnings::CS9192
resharper_c_sharp_warnings_cs9192_highlighting

警告

该表达式的结果始终为可空类型的 'null'
CSharpWarnings::CS0458
resharper_c_sharp_warnings_cs0458_highlighting

警告

该表达式的结果始终为 'true' 或 'false',因为值类型的值永远不等于 'null'
CSharpWarnings::CS0472
resharper_c_sharp_warnings_cs0472_highlighting

警告

该表达式的结果始终为 'true' 或 'false',因为值类型的值永远不等于 'null'
CSharpWarnings::CS8073
resharper_c_sharp_warnings_cs8073_highlighting

警告

参数的 'scoped' 修饰符与目标委托不匹配。
CSharpWarnings::CS9073
resharper_c_sharp_warnings_cs9073_highlighting

警告

参数的 'scoped' 修饰符与重写或实现的成员不匹配。
CSharpWarnings::CS9074
resharper_c_sharp_warnings_cs9074_highlighting

警告

switch 表达式未处理所有可能的输入(不完整)。
CSharpWarnings::CS8509
resharper_c_sharp_warnings_cs8509_highlighting

警告

switch 表达式未处理其输入类型的所有可能值(不完整)。 不过,带有 'when' 子句的模式可能会成功匹配该值。
CSharpWarnings::CS8846
resharper_c_sharp_warnings_cs8846_highlighting

警告

switch 表达式未处理部分 null 输入(不完整)。
CSharpWarnings::CS8655
resharper_c_sharp_warnings_cs8655_highlighting

警告

switch 表达式未处理部分 null 输入(不完整)。 不过,带有 'when' 子句的模式可能会成功匹配该值。
CSharpWarnings::CS8847
resharper_c_sharp_warnings_cs8847_highlighting

警告

switch 表达式未处理输入类型的部分值(不完整),涉及未命名的枚举值。
CSharpWarnings::CS8524
resharper_c_sharp_warnings_cs8524_highlighting

警告

元组元素名称被忽略,因为目标类型指定了不同的名称或未指定名称。
CSharpWarnings::CS8123
resharper_c_sharp_warnings_cs8123_highlighting

警告

元组 == 或 != 运算符另一侧指定了不同的名称或未指定名称,因此元组元素名称被忽略。
CSharpWarnings::CS8383
resharper_c_sharp_warnings_cs8383_highlighting

警告

类型名称仅包含小写 ASCII 字符。 此类名称可能会被语言保留使用
CSharpWarnings::CS8981
resharper_c_sharp_warnings_cs8981_highlighting

警告

partial 结构体的多次声明之间的字段没有定义顺序。 如需指定顺序,所有实例字段必须在同一声明中。
CSharpWarnings::CS0282
resharper_c_sharp_warnings_cs0282_highlighting

警告

该访问器应使用 'field',因为另一个访问器使用了它。
CSharpWarnings::CS9266
resharper_c_sharp_warnings_cs9266_highlighting

警告

此 ref 赋值的值只能通过 return 语句从当前方法中逸出。
CSharpWarnings::CS9093
resharper_c_sharp_warnings_cs9093_highlighting

警告

此 ref 赋值的值的逸出范围比目标更广,允许通过目标为逸出范围更窄的值赋值。
CSharpWarnings::CS9097
resharper_c_sharp_warnings_cs9097_highlighting

警告

此 ref 赋值将表达式赋给了逸出范围更窄的变量。
CSharpWarnings::CS9085
resharper_c_sharp_warnings_cs9085_highlighting

警告

此操作以引用方式返回了局部变量的成员,但该变量不是 ref 局部变量。
CSharpWarnings::CS9092
resharper_c_sharp_warnings_cs9092_highlighting

警告

此操作以引用方式返回了参数,但该参数不是 ref 参数。
CSharpWarnings::CS9087
resharper_c_sharp_warnings_cs9087_highlighting

警告

此操作以引用方式返回了参数,但其作用域仅限于当前方法。
CSharpWarnings::CS9088
resharper_c_sharp_warnings_cs9088_highlighting

警告

此操作通过 ref 参数以引用方式返回了参数;但只能在 return 语句中安全返回。
CSharpWarnings::CS9094
resharper_c_sharp_warnings_cs9094_highlighting

警告

此操作以引用方式返回了参数的成员,但该参数不是 ref 或 out 参数。
CSharpWarnings::CS9089
resharper_c_sharp_warnings_cs9089_highlighting

警告

此操作以引用方式返回了作用域仅限于当前方法的参数成员。
CSharpWarnings::CS9090
resharper_c_sharp_warnings_cs9090_highlighting

警告

此操作通过 ref 参数以引用方式返回了参数的成员;但只能在 return 语句中安全返回。
CSharpWarnings::CS9095
resharper_c_sharp_warnings_cs9095_highlighting

警告

此操作以引用方式返回了局部变量,但该变量不是 ref 局部变量。
CSharpWarnings::CS9091
resharper_c_sharp_warnings_cs9091_highlighting

警告

此操作对托管类型取地址、获取大小或声明指针。
CSharpWarnings::CS8500
resharper_c_sharp_warnings_cs8500_highlighting

警告

抛出的值可能为 null。
CSharpWarnings::CS8597
resharper_c_sharp_warnings_cs8597_highlighting

警告

类型已在接口列表中列出,但引用类型的可空性不同。
CSharpWarnings::CS8645
resharper_c_sharp_warnings_cs8645_highlighting

警告

该类型仅用于评估目的,未来更新中可能会更改或移除。
CSharpWarnings::CS8305
resharper_c_sharp_warnings_cs8305_highlighting

警告

此类型仅用于评估目的,可能会在未来更新中更改或移除。 抑制此诊断以继续。
CSharpWarnings::CS9204
resharper_c_sharp_warnings_cs9204_highlighting

警告

类型参数在 XML 注释中没有匹配的 typeparam 标签
CSharpWarnings::CS1712
resharper_c_sharp_warnings_cs1712_highlighting

警告

类型参数与外部类型的类型参数同名
CSharpWarnings::CS0693
resharper_c_sharp_warnings_cs0693_highlighting

警告

类型及别名不应命名为 'record'
CSharpWarnings::CS8860
resharper_c_sharp_warnings_cs8860_highlighting

警告

无法包含 XML 片段
CSharpWarnings::CS1589
resharper_c_sharp_warnings_cs1589_highlighting

警告

未分配的字段
UnassignedField.Compiler
resharper_unassigned_field_compiler_highlighting

警告

未分配的 readonly 字段
UnassignedReadonlyField.Compiler
resharper_unassigned_readonly_field_compiler_highlighting

警告

对可能为 null 的值进行拆箱操作。
CSharpWarnings::CS8605
resharper_c_sharp_warnings_cs8605_highlighting

警告

未解析的 Shader 名称
ShaderLabShaderReferenceNotResolved
resharper_shader_lab_shader_reference_not_resolved_highlighting

警告

未使用的局部变量
UnusedVariable.Compiler
resharper_unused_variable_compiler_highlighting

警告

在此上下文中使用变量可能导致引用的变量暴露到其声明作用域之外。
CSharpWarnings::CS9080
resharper_c_sharp_warnings_cs9080_highlighting

警告

使用了已过时的符号
CSharpWarnings::CS0618
resharper_c_sharp_warnings_cs0618_highlighting

警告

使用了已过时的符号(无消息)
CSharpWarnings::CS0612
resharper_c_sharp_warnings_cs0612_highlighting

警告

使用 'is' 检查与 'dynamic' 的兼容性实际上等同于与 'Object' 的兼容性检查,对所有非 null 值均为 true
CSharpWarnings::CS1981
resharper_c_sharp_warnings_cs1981_highlighting

警告

XML 注释中存在 'Parameter' 的 param 标签,但没有同名参数
CSharpWarnings::CS1572
resharper_c_sharp_warnings_cs1572_highlighting

警告

XML 注释中存在 'TypeParameter' 的 typeparam 标签,但没有同名类型参数
CSharpWarnings::CS1711
resharper_c_sharp_warnings_cs1711_highlighting

警告

XML 注释的 cref 属性引用了类型参数
CSharpWarnings::CS1723
resharper_c_sharp_warnings_cs1723_highlighting

警告

XML 注释未放置在有效的语言元素上
CSharpWarnings::CS1587
resharper_c_sharp_warnings_cs1587_highlighting

警告

约束违规(11 项检查)

此类别包括代码检查,主要具有 警告 严重性级别,用于检测与符号属性相关的违规行为,包括 ReSharper 的代码注解 和其他类似问题。

检查
ID
EditorConfig 属性

默认严重性

需要基类类型
RequiredBaseTypesIsNotInherited
resharper_required_base_types_is_not_inherited_highlighting

警告

BaseTypeRequired 属性仅支持类和接口
UnsupportedRequiredBaseType
resharper_unsupported_required_base_type_highlighting

警告

命名不一致
InconsistentNaming
resharper_inconsistent_naming_highlighting

警告

命名空间与文件位置不对应
CheckNamespace
resharper_check_namespace_highlighting

警告

非可空或必需成员在构造函数退出时未初始化
NotNullOrRequiredMemberIsNotInitialized
resharper_not_null_or_required_member_is_not_initialized_highlighting

警告

可能将 'null' 分配给非空实体
AssignNullToNotNullAttribute
resharper_assign_null_to_not_null_attribute_highlighting

警告

可能违反 'ValueRange'/'NonNegativeValue' 属性
ValueRangeAttributeViolation
resharper_value_range_attribute_violation_highlighting

警告

契约注解定义存在问题
ContractAnnotationNotParsed
resharper_contract_annotation_not_parsed_highlighting

警告

必需基类类型与其他类型冲突
RequiredBaseTypesConflict
resharper_required_base_types_conflict_highlighting

警告

'[BaseTypeRequired]' 属性中指定的类型与其他类型冲突
RequiredBaseTypesDirectConflict
resharper_required_base_types_direct_conflict_highlighting

警告

带有 'CannotApplyEqualityOperatorAttribute' 标记的类型值应使用 'Equals()' 进行比较
CannotApplyEqualityOperatorToType
resharper_cannot_apply_equality_operator_to_type_highlighting

警告

Entity Framework(8 项检查)

此类别分组的代码检查用于校验 Entity Framework 及其派生类型的类型和成员的用法。

检查
ID
EditorConfig 属性

默认严重性

数据库函数不得在非数据库上下文中调用
EntityFramework.ClientSideDbFunctionCall
resharper_entity_framework_client_side_db_function_call_highlighting

警告

函数无法转换为 SQL,且不得在数据库上下文中调用
EntityFramework.UnsupportedServerSideFunctionCall
resharper_entity_framework_unsupported_server_side_function_call_highlighting

警告

可能对数据库发起多次查询(N+1 问题)
EntityFramework.NPlusOne.Usage
resharper_entity_framework_n_plus_one_usage_highlighting

警告

相关实体的数据库查询可能导致多次查询(N+1 问题)
EntityFramework.NPlusOne.Query
resharper_entity_framework_n_plus_one_query_highlighting

建议

字符串长度无限制可能导致性能问题
EntityFramework.ModelValidation.UnlimitedStringLength
resharper_entity_framework_model_validation_unlimited_string_length_highlighting

警告

查询相关实体时可能返回不完整数据
EntityFramework.NPlusOne.IncompleteDataQuery
resharper_entity_framework_n_plus_one_incomplete_data_query_highlighting

建议

此属性定义的关系导致依赖循环
EntityFramework.ModelValidation.CircularDependency
resharper_entity_framework_model_validation_circular_dependency_highlighting

提示

使用导航属性可能返回不完整数据
EntityFramework.NPlusOne.IncompleteDataUsage
resharper_entity_framework_n_plus_one_incomplete_data_usage_highlighting

警告

格式化(41 项检查)

此类别中的检查 检测代码格式问题

检查
ID
EditorConfig 属性

默认严重性

空行不正确(其他位置缺少空行)
MissingBlankLines
resharper_missing_blank_lines_highlighting

已禁用

空行不正确(其他位置空行多余)
RedundantBlankLines
resharper_redundant_blank_lines_highlighting

已禁用

空行不正确(大括号附近空行数不正确)
IncorrectBlankLinesNearBraces
resharper_incorrect_blank_lines_near_braces_highlighting

已禁用

缩进不正确(子语句周围)
BadChildStatementIndent
resharper_bad_child_statement_indent_highlighting

警告

缩进不正确(声明大括号周围)
BadDeclarationBracesIndent
resharper_bad_declaration_braces_indent_highlighting

已禁用

缩进不正确(表达式大括号周围)
BadExpressionBracesIndent
resharper_bad_expression_braces_indent_highlighting

已禁用

缩进不正确(命名空间大括号周围)
BadNamespaceBracesIndent
resharper_bad_namespace_braces_indent_highlighting

已禁用

缩进不正确(预处理指令周围)
BadPreprocessorIndent
resharper_bad_preprocessor_indent_highlighting

已禁用

缩进不正确(语句大括号周围)
BadControlBracesIndent
resharper_bad_control_braces_indent_highlighting

建议

缩进不正确(switch 语句周围)
BadSwitchBracesIndent
resharper_bad_switch_braces_indent_highlighting

已禁用

缩进不正确(缩进大小不正确)
WrongIndentSize
resharper_wrong_indent_size_highlighting

已禁用

缩进不正确(缩进级别未恢复)
OutdentIsOffPrevLevel
resharper_outdent_is_off_prev_level_highlighting

已禁用

缩进不正确(其他位置缺少缩进/取消缩进)
MissingIndent
resharper_missing_indent_highlighting

已禁用

缩进不正确(其他位置缩进/取消缩进多余)
BadIndent
resharper_bad_indent_highlighting

已禁用

缩进不正确(制表符/空格不匹配)
TabsAndSpacesMismatch
resharper_tabs_and_spaces_mismatch_highlighting

已禁用

换行不正确(列表中逗号周围)
BadListLineBreaks
resharper_bad_list_line_breaks_highlighting

已禁用

换行不正确(声明大括号周围)
BadDeclarationBracesLineBreaks
resharper_bad_declaration_braces_line_breaks_highlighting

已禁用

换行不正确(空大括号周围)
BadEmptyBracesLineBreaks
resharper_bad_empty_braces_line_breaks_highlighting

已禁用

换行不正确(表达式大括号周围)
BadExpressionBracesLineBreaks
resharper_bad_expression_braces_line_breaks_highlighting

已禁用

换行不正确(LINQ 查询周围)
BadLinqLineBreaks
resharper_bad_linq_line_breaks_highlighting

已禁用

换行不正确(括号周围)
BadParensLineBreaks
resharper_bad_parens_line_breaks_highlighting

已禁用

换行不正确(语句大括号周围)
BadControlBracesLineBreaks
resharper_bad_control_braces_line_breaks_highlighting

已禁用

换行不正确(其他位置缺少换行)
MissingLinebreak
resharper_missing_linebreak_highlighting

已禁用

换行不正确(其他位置存在多余换行)
RedundantLinebreak
resharper_redundant_linebreak_highlighting

已禁用

换行不正确(一行有多条语句)
MultipleStatementsOnOneLine
resharper_multiple_statements_on_one_line_highlighting

已禁用

换行不正确(一行有多个类型成员)
MultipleTypeMembersOnOneLine
resharper_multiple_type_members_on_one_line_highlighting

已禁用

缩进不正确(属性周围)
BadAttributeBracketsSpaces
resharper_bad_attribute_brackets_spaces_highlighting

已禁用

空格使用不正确(大括号周围)
BadBracesSpaces
resharper_bad_braces_spaces_highlighting

已禁用

空格使用不正确(冒号周围)
BadColonSpaces
resharper_bad_colon_spaces_highlighting

已禁用

空格使用不正确(逗号周围)
BadCommaSpaces
resharper_bad_comma_spaces_highlighting

已禁用

缩进不正确(泛型括号周围)
BadGenericBracketsSpaces
resharper_bad_generic_brackets_spaces_highlighting

已禁用

空格使用不正确(成员访问符号周围)
BadMemberAccessSpaces
resharper_bad_member_access_spaces_highlighting

已禁用

空格使用不正确(运算符号周围)
BadSymbolSpaces
resharper_bad_symbol_spaces_highlighting

已禁用

空格使用不正确(括号周围)
BadParensSpaces
resharper_bad_parens_spaces_highlighting

已禁用

空格使用不正确(分号周围)
BadSemicolonSpaces
resharper_bad_semicolon_spaces_highlighting

已禁用

空格使用不正确(语句中的方括号周围)
BadSquareBracketsSpaces
resharper_bad_square_brackets_spaces_highlighting

已禁用

空格使用不正确(关键字与括号之间)
BadSpacesAfterKeyword
resharper_bad_spaces_after_keyword_highlighting

已禁用

空格使用不正确(禁止多个空格)
MultipleSpaces
resharper_multiple_spaces_highlighting

已禁用

空格使用不正确(其他位置缺少空格)
MissingSpace
resharper_missing_space_highlighting

已禁用

空格使用不正确(其他位置存在多余空格)
RedundantSpace
resharper_redundant_space_highlighting

已禁用

缩进不正确(此处禁止使用制表符)
TabsOutsideIndent
resharper_tabs_outside_indent_highlighting

已禁用

语法问题(4 项检查)

此类别中的检查报告字符串字面量和文档注释中的 语法问题

检查
ID
EditorConfig 属性

默认严重性

注释中的语法错误
GrammarMistakeInComment
resharper_grammar_mistake_in_comment_highlighting

建议

标记属性值中的语法错误
GrammarMistakeInMarkupAttribute
resharper_grammar_mistake_in_markup_attribute_highlighting

建议

标记文本中的语法错误
GrammarMistakeInMarkupText
resharper_grammar_mistake_in_markup_text_highlighting

建议

字符串字面量中的语法错误
GrammarMistakeInStringLiteral
resharper_grammar_mistake_in_string_literal_highlighting

已禁用

语言用法优化建议(87 项检查)

此类别包括代码检查,主要具有 建议严重性级别,当可以使用更高级的语言结构时会通知您。 这些检查检测过时语言版本的语法,并建议使用更现代语言版本的功能。 对于大多数支持的语言,语言版本 可以自动检测或手动设置

检查
ID
EditorConfig 属性

默认严重性

追加到集合表达式
AppendToCollectionExpression
resharper_append_to_collection_expression_highlighting

建议

类无法实例化
ClassCannotBeInstantiated
resharper_class_cannot_be_instantiated_highlighting

警告

条件表达式可重写为 null 合并运算符
ReplaceConditionalExpressionWithNullCoalescing
resharper_replace_conditional_expression_with_null_coalescing_highlighting

建议

将 'as' 表达式类型检查及后续 null 检查转换为取反模式匹配
UseNegatedPatternMatching
resharper_use_negated_pattern_matching_highlighting

提示

将 'as' 表达式类型检查及后续 null 检查转换为模式匹配
UsePatternMatching
resharper_use_pattern_matching_highlighting

建议

将构造函数转换为成员初始化器
ConvertConstructorToMemberInitializers
resharper_convert_constructor_to_member_initializers_highlighting

建议

将构造函数转换为主构造函数
ConvertToPrimaryConstructor
resharper_convert_to_primary_constructor_highlighting

建议

将委托变量转换为局部函数
ConvertToLocalFunction
resharper_convert_to_local_function_highlighting

建议

将扩展方法转换为扩展块
ConvertToExtensionBlock
resharper_convert_to_extension_block_highlighting

建议

将 'if' 语句转换为 'switch'
ConvertIfStatementToSwitchStatement
resharper_convert_if_statement_to_switch_statement_highlighting

提示

转换为 'await using' 语句或声明
UseAwaitUsing
resharper_use_await_using_highlighting

建议

转换为 lambda 表达式
ConvertToLambdaExpression
resharper_convert_to_lambda_expression_highlighting

建议

转换为静态类
ConvertToStaticClass
resharper_convert_to_static_class_highlighting

建议

转换为 'using' 声明
ConvertToUsingDeclaration
resharper_convert_to_using_declaration_highlighting

建议

将 lambda 表达式转换为方法组
ConvertClosureToMethodGroup
resharper_convert_closure_to_method_group_highlighting

建议

将取反的 'is' 表达式转换为带取反模式的 'is' 表达式
UseNegatedPatternInIsExpression
resharper_use_negated_pattern_in_is_expression_highlighting

提示

将 'Nullable<T>' 转换为 'T?'
ConvertNullableToShortForm
resharper_convert_nullable_to_short_form_highlighting

建议

将属性转换为自动属性
ConvertToAutoProperty
resharper_convert_to_auto_property_highlighting

建议

将属性转换为自动属性(如可行)
ConvertToAutoPropertyWhenPossible
resharper_convert_to_auto_property_when_possible_highlighting

提示

将属性转换为带 private setter 的自动属性
ConvertToAutoPropertyWithPrivateSetter
resharper_convert_to_auto_property_with_private_setter_highlighting

提示

将静态方法调用转换为扩展方法调用
InvokeAsExtensionMethod
resharper_invoke_as_extension_method_highlighting

建议

Foreach 循环可以转换为 LINQ 表达式,但将使用另一个 'GetEnumerator' 方法
ForeachCanBeConvertedToQueryUsingAnotherGetEnumerator
resharper_foreach_can_be_converted_to_query_using_another_get_enumerator_highlighting

提示

for 循环可转换为 foreach 循环
ForCanBeConvertedToForeach
resharper_for_can_be_converted_to_foreach_highlighting

建议

'if' 语句可重写为 '?:' 表达式
ConvertIfStatementToConditionalTernaryExpression
resharper_convert_if_statement_to_conditional_ternary_expression_highlighting

建议

'if' 语句可重写为 '??' 表达式
ConvertIfStatementToNullCoalescingExpression
resharper_convert_if_statement_to_null_coalescing_expression_highlighting

建议

'if' 语句可重写为 '??=' 赋值
ConvertIfStatementToNullCoalescingAssignment
resharper_convert_if_statement_to_null_coalescing_assignment_highlighting

建议

'if-return' 语句可重写为 'return' 语句
ConvertIfStatementToReturnStatement
resharper_convert_if_statement_to_return_statement_highlighting

提示

内联 'out' 变量声明
InlineOutVariableDeclaration
resharper_inline_out_variable_declaration_highlighting

建议

内联临时变量
InlineTemporaryVariable
resharper_inline_temporary_variable_highlighting

提示

引入可选参数(非 private 可访问性)
IntroduceOptionalParameters.Global
resharper_introduce_optional_parameters_global_highlighting

建议

引入可选参数(private 可访问性)
IntroduceOptionalParameters.Local
resharper_introduce_optional_parameters_local_highlighting

建议

反转 'if' 语句以减少嵌套
InvertIf
resharper_invert_if_highlighting

提示

合并 null 检查与赋值
JoinNullCheckWithUsage
resharper_join_null_check_with_usage_highlighting

建议

Lambda 表达式/匿名方法可设为 'static'
LambdaExpressionCanBeMadeStatic
resharper_lambda_expression_can_be_made_static_highlighting

已禁用

为避免分配,Lambda 表达式/匿名方法必须为 'static'
LambdaExpressionMustBeStatic
resharper_lambda_expression_must_be_static_highlighting

建议

Lambda 表达式/匿名方法不得捕获其所在上下文
LambdaShouldNotCaptureContext
resharper_lambda_should_not_capture_context_highlighting

警告

可通过使用逐字字符串减少字面量长度
UseVerbatimString
resharper_use_verbatim_string_highlighting

提示

循环可以转换为 LINQ 表达式
LoopCanBeConvertedToQuery
resharper_loop_can_be_converted_to_query_highlighting

提示

合并 'and' 模式
MergeAndPattern
resharper_merge_and_pattern_highlighting

建议

将条件 ?: 表达式合并为条件访问
MergeConditionalExpression
resharper_merge_conditional_expression_highlighting

建议

将取反的 null/模式检查合并为复杂模式
MergeIntoNegatedPattern
resharper_merge_into_negated_pattern_highlighting

提示

合并嵌套属性模式
MergeNestedPropertyPatterns
resharper_merge_nested_property_patterns_highlighting

建议

合并 null/模式检查为复杂模式
MergeIntoPattern
resharper_merge_into_pattern_highlighting

建议

合并 null/模式/值检查为 'or'/'and' 模式
MergeIntoLogicalPattern
resharper_merge_into_logical_pattern_highlighting

提示

将顺序检查合并为单个条件访问检查
MergeSequentialChecks
resharper_merge_sequential_checks_highlighting

提示

移动到已存在的位置解构模式
MoveToExistingPositionalDeconstructionPattern
resharper_move_to_existing_positional_deconstruction_pattern_highlighting

提示

移动到扩展块
MoveToExtensionBlock
resharper_move_to_extension_block_highlighting

建议

将变量声明移入循环条件内
MoveVariableDeclarationInsideLoopCondition
resharper_move_variable_declaration_inside_loop_condition_highlighting

建议

Foreach 循环的一部分可以转换为 LINQ 表达式,但将使用另一个 'GetEnumerator' 方法
ForeachCanBePartlyConvertedToQueryUsingAnotherGetEnumerator
resharper_foreach_can_be_partly_converted_to_query_using_another_get_enumerator_highlighting

提示

循环体的一部分可以转换为 LINQ 表达式
LoopCanBePartlyConvertedToQuery
resharper_loop_can_be_partly_converted_to_query_highlighting

已禁用

传递字符串插值表达式
PassStringInterpolation
resharper_pass_string_interpolation_highlighting

提示

多余的访问器主体
RedundantAccessorBody
resharper_redundant_accessor_body_highlighting

建议

多余的展开元素
RedundantSpreadElement
resharper_redundant_spread_element_highlighting

建议

用计算属性替换自动属性
ReplaceAutoPropertyWithComputedProperty
resharper_replace_auto_property_with_computed_property_highlighting

提示

用 null 传播代码替换 if 语句
UseNullPropagation
resharper_use_null_propagation_highlighting

提示

用 'var' 模式替换未执行任何额外检查的对象模式
ReplaceObjectPatternWithVarPattern
resharper_replace_object_pattern_with_var_pattern_highlighting

建议

用常量模式替换 'SequenceEqual'
ReplaceSequenceEqualWithConstantPattern
resharper_replace_sequence_equal_with_constant_pattern_highlighting

建议

用区间索引器替换 'Slice'
ReplaceSliceWithRangeIndexer
resharper_replace_slice_with_range_indexer_highlighting

提示

用区间索引器替换 'Substring'
ReplaceSubstringWithRangeIndexer
resharper_replace_substring_with_range_indexer_highlighting

提示

用 'switch' 表达式替换 'switch' 语句
ConvertSwitchStatementToSwitchExpression
resharper_convert_switch_statement_to_switch_expression_highlighting

提示

用 'switch' 表达式替换三元表达式
ConvertConditionalTernaryExpressionToSwitchExpression
resharper_convert_conditional_ternary_expression_to_switch_expression_highlighting

提示

替换为 'field' 关键字
ReplaceWithFieldKeyword
resharper_replace_with_field_keyword_highlighting

建议

替换为主构造函数参数
ReplaceWithPrimaryConstructorParameter
resharper_replace_with_primary_constructor_parameter_highlighting

建议

使用别名
UseSymbolAlias
resharper_use_symbol_alias_highlighting

提示

使用集合表达式语法
UseCollectionExpression
resharper_use_collection_expression_highlighting

建议

使用复合赋值
ConvertToCompoundAssignment
resharper_convert_to_compound_assignment_highlighting

提示

使用复合赋值
ConvertToNullCoalescingCompoundAssignment
resharper_convert_to_null_coalescing_compound_assignment_highlighting

建议

使用解构
UseDeconstruction
resharper_use_deconstruction_highlighting

提示

使用解构交换变量
SwapViaDeconstruction
resharper_swap_via_deconstruction_highlighting

建议

使用丢弃赋值
UseDiscardAssignment
resharper_use_discard_assignment_highlighting

建议

使用末尾索引表达式
UseIndexFromEndExpression
resharper_use_index_from_end_expression_highlighting

建议

使用 'nameof' 表达式引用枚举成员名
UseNameOfInsteadOfToString
resharper_use_name_of_instead_of_to_string_highlighting

建议

使用 'nameof' 表达式引用名称
UseNameofExpression
resharper_use_nameof_expression_highlighting

建议

在字符串字面量部分使用 'nameof' 表达式引用名称
UseNameofExpressionForPartOfTheString
resharper_use_nameof_expression_for_part_of_the_string_highlighting

已禁用

使用 'nameof' 表达式引用类型名
UseNameOfInsteadOfTypeOf
resharper_use_name_of_instead_of_type_of_highlighting

建议

注册 DependencyProperty 时使用 'nameof' 表达式
UseNameofForDependencyProperty
resharper_use_nameof_for_dependency_property_highlighting

建议

尽可能使用对象或集合初始化器
UseObjectOrCollectionInitializer
resharper_use_object_or_collection_initializer_highlighting

建议

使用位置解构模式
UsePositionalDeconstructionPattern
resharper_use_positional_deconstruction_pattern_highlighting

已禁用

使用原始字符串
UseRawString
resharper_use_raw_string_highlighting

提示

使用字符串插值表达式
UseStringInterpolation
resharper_use_string_interpolation_highlighting

建议

使用类型注解语法
UseNullableReferenceTypesAnnotationSyntax
resharper_use_nullable_reference_types_annotation_syntax_highlighting

警告

使用无符号右移运算符 '>>>'
UseUnsignedRightShiftOperator
resharper_use_unsigned_right_shift_operator_highlighting

建议

使用 UTF-8 字符串字面量
UseUtf8StringLiteral
resharper_use_utf8_string_literal_highlighting

建议

使用 'with' 表达式复制匿名对象
UseWithExpressionToCopyAnonymousObject
resharper_use_with_expression_to_copy_anonymous_object_highlighting

建议

使用 'with' 表达式复制 record
UseWithExpressionToCopyRecord
resharper_use_with_expression_to_copy_record_highlighting

建议

使用 'with' 表达式复制结构体
UseWithExpressionToCopyStruct
resharper_use_with_expression_to_copy_struct_highlighting

建议

使用 'with' 表达式复制元组
UseWithExpressionToCopyTuple
resharper_use_with_expression_to_copy_tuple_highlighting

建议

NUnit(30 项检查)

这些检查检测与 NUnit 测试相关的代码问题。

检查
ID
EditorConfig 属性

默认严重性

NUnit。 异步测试方法必须返回 Task 或 Task<T>
NUnit.AsyncMethodMustBeTask
resharper_n_unit_async_method_must_be_task_highlighting

警告

NUnit。 存在重复值。
NUnit.DuplicateValues
resharper_n_unit_duplicate_values_highlighting

警告

NUnit。 参数属性被忽略。
NUnit.IgnoredParameterAttribute
resharper_n_unit_ignored_parameter_attribute_highlighting

警告

NUnit。 隐式未指定的 null 值。
NUnit.ImplicitUnspecifiedNullValues
resharper_n_unit_implicit_unspecified_null_values_highlighting

警告

NUnit。 参数类型不兼容或参数值不正确。
NUnit.IncorrectArgumentType
resharper_n_unit_incorrect_argument_type_highlighting

警告

NUnit。 期望结果类型不兼容或值不正确。
NUnit.IncorrectExpectedResultType
resharper_n_unit_incorrect_expected_result_type_highlighting

警告

NUnit。 范围边界不正确。 'to' 必须大于或等于 'from'。
NUnit.IncorrectRangeBounds
resharper_n_unit_incorrect_range_bounds_highlighting

警告

NUnit。 区间步长符号不匹配。
NUnit.RangeStepSignMismatch
resharper_n_unit_range_step_sign_mismatch_highlighting

警告

NUnit。 TestCase 属性缺少参数。
NUnit.MissingArgumentsInTestCaseAttribute
resharper_n_unit_missing_arguments_in_test_case_attribute_highlighting

警告

NUnit。 测试方法声明缺少 'CancelAfter' 属性。
NUnit.MissingCancelAfterAttribute
resharper_n_unit_missing_cancel_after_attribute_highlighting

警告

NUnit。 非 void 测试方法缺少期望结果。
NUnit.TestCaseAttributeRequiresExpectedResult
resharper_n_unit_test_case_attribute_requires_expected_result_highlighting

警告

NUnit。 属性中未提供任何值。
NUnit.NoValuesProvided
resharper_n_unit_no_values_provided_highlighting

警告

NUnit。 非公有测试方法。
NUnit.NonPublicMethodWithTestAttribute
resharper_n_unit_non_public_method_with_test_attribute_highlighting

警告

NUnit。 区间 'step' 参数值必须为非零。
NUnit.RangeStepValueMustNotBeZero
resharper_n_unit_range_step_value_must_not_be_zero_highlighting

警告

NUnit。 TestCase 属性中存在多余参数。
NUnit.RedundantArgumentInTestCaseAttribute
resharper_n_unit_redundant_argument_in_test_case_attribute_highlighting

警告

NUnit。 存在多余参数,未用作 ExpectedResult。
NUnit.RedundantArgumentInsteadOfExpectedResult
resharper_n_unit_redundant_argument_instead_of_expected_result_highlighting

警告

NUnit。 void 测试方法存在多余的期望结果。
NUnit.RedundantExpectedResultInTestCaseAttribute
resharper_n_unit_redundant_expected_result_in_test_case_attribute_highlighting

警告

NUnit。 指定的属性值生成的测试用例过多。
NUnit.AttributeProducesTooManyTests
resharper_n_unit_attribute_produces_too_many_tests_highlighting

已禁用

NUnit。 指定的值与测试参数类型不兼容。
NUnit.ParameterTypeIsNotCompatibleWithAttribute
resharper_n_unit_parameter_type_is_not_compatible_with_attribute_highlighting

警告

NUnit。 测试用例 Result 属性与 ExpectedResult 重复。
NUnit.TestCaseResultPropertyDuplicatesExpectedResult
resharper_n_unit_test_case_result_property_duplicates_expected_result_highlighting

警告

NUnit。 测试用例 Result 属性已过时。
NUnit.TestCaseResultPropertyIsObsolete
resharper_n_unit_test_case_result_property_is_obsolete_highlighting

警告

NUnit。 测试用例源必须为字段、属性或方法。
NUnit.TestCaseSourceMustBeFieldPropertyMethod
resharper_n_unit_test_case_source_must_be_field_property_method_highlighting

警告

NUnit。 测试用例源必须为非抽象类型并实现 IEnumerable。
NUnit.TestCaseSourceShouldImplementIEnumerable
resharper_n_unit_test_case_source_should_implement_i_enumerable_highlighting

警告

NUnit。 测试用例源必须为静态成员。
NUnit.TestCaseSourceMustBeStatic
resharper_n_unit_test_case_source_must_be_static_highlighting

警告

NUnit。 使用该步长值无法达到最大区间值。
NUnit.RangeToValueIsNotReachable
resharper_n_unit_range_to_value_is_not_reachable_highlighting

警告

NUnit。 未为测试方法参数提供值。
NUnit.MethodWithParametersAndTestAttribute
resharper_n_unit_method_with_parameters_and_test_attribute_highlighting

警告

NUnit。 区间内的值不适用于测试参数类型。
NUnit.RangeAttributeBoundsAreOutOfRange
resharper_n_unit_range_attribute_bounds_are_out_of_range_highlighting

警告

NUnit.AutoFixture。 参数类型不兼容或参数值不正确。
NUnit.AutoFixture.IncorrectArgumentType
resharper_n_unit_auto_fixture_incorrect_argument_type_highlighting

警告

NUnit.AutoFixture。 缺少 Test 或 TestFixture 属性。
NUnit.AutoFixture.MissedTestOrTestFixtureAttribute
resharper_n_unit_auto_fixture_missed_test_or_test_fixture_attribute_highlighting

警告

NUnit.AutoFixture。 InlineAutoData 属性中存在多余参数。
NUnit.AutoFixture.RedundantArgumentInInlineAutoDataAttribute
resharper_n_unit_auto_fixture_redundant_argument_in_inline_auto_data_attribute_highlighting

警告

潜在代码质量问题(224 项检查)

此类别包括检测关键问题(代码异味)的检查,主要具有 错误警告 级别。 此类别还包括 确保本地化支持的检查

检查
ID
EditorConfig 属性

默认严重性

'?:' 表达式的 true 和 false 分支相同
ConditionalTernaryEqualBranch
resharper_conditional_ternary_equal_branch_highlighting

警告

[MustDisposeResource] 注解不会从基类构造函数继承,应显式添加
ConstructorWithMustDisposeResourceAttributeBaseIsNotAnnotated
resharper_constructor_with_must_dispose_resource_attribute_base_is_not_annotated_highlighting

警告

[ThreadStatic] 不适用于实例字段
ThreadStaticAtInstanceField
resharper_thread_static_at_instance_field_highlighting

警告

已抑制的可空性警告可能隐藏潜在问题
NullableWarningSuppressionIsUsed
resharper_nullable_warning_suppression_is_used_highlighting

已禁用

抽象或虚拟(可重写)事件从未被调用
EventNeverInvoked.Global
resharper_event_never_invoked_global_highlighting

建议

访问已释放的捕获变量
AccessToDisposedClosure
resharper_access_to_disposed_closure_highlighting

警告

在闭包中访问 foreach 变量
AccessToForEachVariableInClosure
resharper_access_to_for_each_variable_in_closure_highlighting

警告

访问已修改的捕获变量
AccessToModifiedClosure
resharper_access_to_modified_closure_highlighting

警告

根据位掩码的值,表达式结果始终相同
NonConstantEqualityExpressionHasConstantResult
resharper_non_constant_equality_expression_has_constant_result_highlighting

警告

实际移位数为零
ShiftExpressionRealShiftCountIsZero
resharper_shift_expression_real_shift_count_is_zero_highlighting

警告

文本参数中存在歧义符号
MultipleResolveCandidatesInText
resharper_multiple_resolve_candidates_in_text_highlighting

警告

层次结构中的注解冲突
AnnotationConflictInHierarchy
resharper_annotation_conflict_in_hierarchy_highlighting

警告

条件表达式中的赋值操作
AssignmentInConditionalExpression
resharper_assignment_in_conditional_expression_highlighting

警告

异步迭代器调用未使用 'await foreach'
AsyncIteratorInvocationWithoutAwaitForeach
resharper_async_iterator_invocation_without_await_foreach_highlighting

警告

自动属性访问器从未使用(非私有可访问性)
UnusedAutoPropertyAccessor.Global
resharper_unused_auto_property_accessor_global_highlighting

警告

自动属性访问器从未使用(私有可访问性)
UnusedAutoPropertyAccessor.Local
resharper_unused_auto_property_accessor_local_highlighting

警告

避免混用变长转义序列与文本
VariableLengthStringHexEscapeSequence
resharper_variable_length_string_hex_escape_sequence_highlighting

警告

避免对返回类型为 'void' 且具有 'System.EventArgs' 类型参数的方法和函数使用 'async'
AsyncVoidEventHandlerMethod
resharper_async_void_event_handler_method_highlighting

建议

避免对返回类型为 'void' 且没有 'System.EventArgs' 类型参数的方法和函数使用 'async'
AsyncVoidMethod
resharper_async_void_method_highlighting

建议

避免在委托类型返回 'void' 时使用 'async' lambda
AsyncVoidLambda
resharper_async_void_lambda_highlighting

警告

后备字段已赋值但从未被使用
PropertyFieldKeywordIsNeverUsed
resharper_property_field_keyword_is_never_used_highlighting

警告

后备字段被使用但从未赋值
PropertyFieldKeywordIsNeverAssigned
resharper_property_field_keyword_is_never_assigned_highlighting

警告

对未标记 [Flags] 属性的枚举进行按位运算
BitwiseOperatorOnEnumWithoutFlags
resharper_bitwise_operator_on_enum_without_flags_highlighting

警告

调用具有隐式默认参数的基成员
BaseMethodCallWithDefaultParameter
resharper_base_method_call_with_default_parameter_highlighting

警告

调用 'base.Equals(...)' 是引用相等
BaseObjectEqualsIsObjectEquals
resharper_base_object_equals_is_object_equals_highlighting

警告

文本参数中无法访问静态符号
StaticProblemInText
resharper_static_problem_in_text_highlighting

警告

文本参数中无法访问符号
AccessRightsInText
resharper_access_rights_in_text_highlighting

警告

无法解析属性
PropertyNotResolved
resharper_property_not_resolved_highlighting

错误

无法解析资源
ResourceNotResolved
resharper_resource_not_resolved_highlighting

错误

无法解析资源项
ResourceItemNotResolved
resharper_resource_item_not_resolved_highlighting

错误

无法解析文本参数中的符号
NotResolvedInText
resharper_not_resolved_in_text_highlighting

警告

捕获的 marshal-by-reference 类字段引用可能导致运行时异常
AddressOfMarshalByRefObject
resharper_address_of_marshal_by_ref_object_highlighting

警告

捕获的主构造函数参数可变
CapturedPrimaryConstructorParameterIsMutable
resharper_captured_primary_constructor_parameter_is_mutable_highlighting

警告

捕获的 'volatile' 字段引用不会被视为 'volatile'
ByRefArgumentIsVolatileField
resharper_by_ref_argument_is_volatile_field_highlighting

警告

Char 可能被无意中当作整数使用
ConfusingCharAsIntegerInConstructor
resharper_confusing_char_as_integer_in_constructor_highlighting

警告

类从未被实例化(非私有可访问性)
ClassNeverInstantiated.Global
resharper_class_never_instantiated_global_highlighting

建议

类从未被实例化(私有可访问性)
ClassNeverInstantiated.Local
resharper_class_never_instantiated_local_highlighting

建议

集合内容从未被查询(非私有可访问性)
CollectionNeverQueried.Global
resharper_collection_never_queried_global_highlighting

警告

集合内容从未被查询(私有可访问性)
CollectionNeverQueried.Local
resharper_collection_never_queried_local_highlighting

警告

集合从未被更新(非私有可访问性)
CollectionNeverUpdated.Global
resharper_collection_never_updated_global_highlighting

警告

集合从未被更新(私有可访问性)
CollectionNeverUpdated.Local
resharper_collection_never_updated_local_highlighting

警告

冲突的 CQRS 属性
ConflictCqrsAttribute
resharper_conflict_cqrs_attribute_highlighting

警告

常量移位表达式的操作数均非零但结果为零
ShiftExpressionResultEqualsZero
resharper_shift_expression_result_equals_zero_highlighting

警告

协变数组转换
CoVariantArrayConversion
resharper_co_variant_array_conversion_highlighting

警告

CQRS 上下文交叉。 Command 从 Query 上下文中调用。 (显示在声明中)
CommandInvasionDeclaration.Global
resharper_command_invasion_declaration_global_highlighting

警告

CQRS 上下文交叉。 Command 从 Query 上下文中调用。 (显示在用法中)
CommandInvasionUsage.Global
resharper_command_invasion_usage_global_highlighting

警告

CQRS 上下文交叉。 Query 从 Command 上下文中调用。 (显示在声明中)
QueryInvasionDeclaration.Global
resharper_query_invasion_declaration_global_highlighting

警告

CQRS 上下文交叉。 Query 从 Command 上下文中调用。 (显示在用法中)
QueryInvasionUsage.Global
resharper_query_invasion_usage_global_highlighting

警告

已被 'using' 语句捕获的变量被释放
DisposeOnUsingVariable
resharper_dispose_on_using_variable_highlighting

警告

至少有一条执行路径存在除零操作
IntDivisionByZero
resharper_int_division_by_zero_highlighting

警告

请勿在 'async void' 方法和函数中重新抛出异常
AsyncVoidThrowException
resharper_async_void_throw_exception_highlighting

建议

请勿在 readonly 字段中存储 SpinLock
SpinLockInReadonlyField
resharper_spin_lock_in_readonly_field_highlighting

警告

请勿对 'using' 变量使用对象初始化器
UsingStatementResourceInitialization
resharper_using_statement_resource_initialization_highlighting

警告

请勿对 'using' 变量使用对象初始化器(对象初始化器表达式在初始化 'using' 变量时可能抛出异常)
UsingStatementResourceInitializationExpression
resharper_using_statement_resource_initialization_expression_highlighting

提示

在格式字符串中格式说明符后不要使用右大括号
FormatSpecifierCapturesRightBraces
resharper_format_specifier_captures_right_braces_highlighting

警告

字典/集合初始化中存在重复键
DuplicateKeyCollectionInitialization
resharper_duplicate_key_collection_initialization_highlighting

警告

链式 'if' 分支重复
DuplicatedChainedIfBodies
resharper_duplicated_chained_if_bodies_highlighting

提示

顺序 'if' 分支重复
DuplicatedSequentialIfBodies
resharper_duplicated_sequential_if_bodies_highlighting

提示

重复的 'switch' 分支项
DuplicatedSwitchExpressionArms
resharper_duplicated_switch_expression_arms_highlighting

提示

重复的 'switch' 分支体
DuplicatedSwitchSectionBodies
resharper_duplicated_switch_section_bodies_highlighting

提示

元素是可本地化的
LocalizableElement
resharper_localizable_element_highlighting

警告

空的通用 catch 子句
EmptyGeneralCatchClause
resharper_empty_general_catch_clause_highlighting

警告

空的 'with' 表达式是多余的
RedundantWithExpression
resharper_redundant_with_expression_highlighting

建议

在显式 unchecked 上下文中调用 'Enumerable.Sum'
EnumerableSumInExplicitUncheckedContext
resharper_enumerable_sum_in_explicit_unchecked_context_highlighting

警告

浮点数的相等性比较
CompareOfFloatsByEqualityOperator
resharper_compare_of_floats_by_equality_operator_highlighting

警告

转义序列可简化
CanSimplifyStringEscapeSequence
resharper_can_simplify_string_escape_sequence_highlighting

提示

事件从未被订阅(非私有可访问性)
EventNeverSubscribedTo.Global
resharper_event_never_subscribed_to_global_highlighting

建议

事件从未被订阅(私有可访问性)
EventNeverSubscribedTo.Local
resharper_event_never_subscribed_to_local_highlighting

建议

事件从未被调用
EventNeverInvoked
resharper_event_never_invoked_highlighting

警告

通过匿名委托取消事件订阅
EventUnsubscriptionViaAnonymousDelegate
resharper_event_unsubscription_via_anonymous_delegate_highlighting

警告

可能是有意的异常重新抛出
PossibleIntendedRethrow
resharper_possible_intended_rethrow_highlighting

警告

显式参数传递给带有调用者信息属性的参数
ExplicitCallerInfoArgument
resharper_explicit_caller_info_argument_highlighting

警告

提取通用代码
ExtractCommonBranchingCode
resharper_extract_common_branching_code_highlighting

提示

字段隐藏了接口中带默认实现的属性
FieldHidesInterfacePropertyWithDefaultImplementation
resharper_field_hides_interface_property_with_default_implementation_highlighting

警告

已指定格式,但插值字符串表达式不是 IFormattable
InterpolatedStringExpressionIsNotIFormattable
resharper_interpolated_string_expression_is_not_i_formattable_highlighting

警告

函数体过于复杂,无法分析
FunctionComplexityOverflow
resharper_function_complexity_overflow_highlighting

已禁用

函数在所有执行路径上均为递归调用
FunctionRecursiveOnAllPaths
resharper_function_recursive_on_all_paths_highlighting

警告

函数从未返回
FunctionNeverReturns
resharper_function_never_returns_highlighting

警告

调用 'GC.SuppressFinalize' 的类型没有析构函数
GCSuppressFinalizeForTypeWithoutDestructor
resharper_gc_suppress_finalize_for_type_without_destructor_highlighting

警告

根据整数分析,该分支在启发式上不可达
UnreachableSwitchCaseDueToIntegerAnalysis
resharper_unreachable_switch_case_due_to_integer_analysis_highlighting

警告

根据整数分析,switch 分支在启发式上不可达
UnreachableSwitchArmDueToIntegerAnalysis
resharper_unreachable_switch_arm_due_to_integer_analysis_highlighting

警告

传递给 'Math.Clamp()' 方法的参数不一致
MathClampMinGreaterThanMax
resharper_math_clamp_min_greater_than_max_highlighting

警告

加锁顺序不一致
InconsistentOrderOfLocks
resharper_inconsistent_order_of_locks_highlighting

警告

字段上的同步操作不一致
InconsistentlySynchronizedField
resharper_inconsistently_synchronized_field_highlighting

警告

错误使用 'ConstantExpected' 特性
IncorrectConstantExpectedAnnotation
resharper_incorrect_constant_expected_annotation_highlighting

错误

末尾索引必须大于零;请使用 '^1' 表示最后一个元素
ZeroIndexFromEnd
resharper_zero_index_from_end_highlighting

警告

标记为 ServiceContract 的接口应至少声明一个 OperationContract
ServiceContractWithoutOperations
resharper_service_contract_without_operations_highlighting

警告

无效的 XML 文档注释
InvalidXmlDocComment
resharper_invalid_xml_doc_comment_highlighting

警告

多态字段式事件的调用
PolymorphicFieldLikeEventInvocation
resharper_polymorphic_field_like_event_invocation_highlighting

警告

IQueryable 可能被无意中当作 IEnumerable 使用
PossibleUnintendedQueryableAsEnumerable
resharper_possible_unintended_queryable_as_enumerable_highlighting

建议

迭代器从未返回
IteratorNeverReturns
resharper_iterator_never_returns_highlighting

警告

局部函数隐藏了方法
LocalFunctionHidesMethod
resharper_local_function_hides_method_highlighting

警告

局部变量隐藏了成员
LocalVariableHidesMember
resharper_local_variable_hides_member_highlighting

警告

局部变量隐藏了主构造函数参数
LocalVariableHidesPrimaryConstructorParameter
resharper_local_variable_hides_primary_constructor_parameter_highlighting

警告

循环控制变量在循环体内从未被更改
LoopVariableIsNeverChangedInsideLoop
resharper_loop_variable_is_never_changed_inside_loop_highlighting

警告

对输出参数使用 [HandlesResourceDisposal] 注解无意义
OutParameterWithHandlesResourceDisposalAttribute
resharper_out_parameter_with_handles_resource_disposal_attribute_highlighting

警告

对输入参数使用 [MustDisposeResource] 注解无意义
InParameterWithMustDisposeResourceAttribute
resharper_in_parameter_with_must_dispose_resource_attribute_highlighting

警告

成员隐藏了外部类中的静态成员
MemberHidesStaticFromOuterClass
resharper_member_hides_static_from_outer_class_highlighting

警告

成员初始化值被忽略
MemberInitializerValueIgnored
resharper_member_initializer_value_ignored_highlighting

警告

方法从两个 CQRS 上下文中被调用(显示在声明中)
BothContextCallDeclaration.Global
resharper_both_context_call_declaration_global_highlighting

警告

方法从两个 CQRS 上下文中被调用(显示在用法中)
BothContextCallUsage.Global
resharper_both_context_call_usage_global_highlighting

警告

方法已标记为 OperationContract,但其所属类型未标记为 ServiceContract
OperationContractWithoutServiceContract
resharper_operation_contract_without_service_contract_highlighting

警告

带有可选或 'params' 参数的方法被重载隐藏
MethodOverloadWithOptionalParameter
resharper_method_overload_with_optional_parameter_highlighting

警告

重写方法中的可选参数值不匹配
OptionalParameterHierarchyMismatch
resharper_optional_parameter_hierarchy_mismatch_highlighting

警告

库代码中的异步可释放对象缺少 '.ConfigureAwait(false)'
UseConfigureAwaitFalseForAsyncDisposable
resharper_use_configure_await_false_for_async_disposable_highlighting

已禁用

库代码中缺少 '.ConfigureAwait(false)'
UseConfigureAwaitFalse
resharper_use_configure_await_false_highlighting

建议

请将 shebang 指令移动到文件开头
ShebangDirectiveBadPlacement
resharper_shebang_directive_bad_placement_highlighting

警告

多次连续调用 'OrderBy'
MultipleOrderBy
resharper_multiple_order_by_highlighting

警告

未访问的字段(非私有可访问性)
NotAccessedField.Global
resharper_not_accessed_field_global_highlighting

建议

未访问的字段(私有可访问性)
NotAccessedField.Local
resharper_not_accessed_field_local_highlighting

警告

未访问的位置属性(非私有可访问性)
NotAccessedPositionalProperty.Global
resharper_not_accessed_positional_property_global_highlighting

警告

未访问的位置属性(私有可访问性)
NotAccessedPositionalProperty.Local
resharper_not_accessed_positional_property_local_highlighting

警告

实现类中的非公有成员隐藏了接口中的默认实现
MemberHidesInterfaceMemberWithDefaultImplementation
resharper_member_hides_interface_member_with_default_implementation_highlighting

警告

在 'GetHashCode()' 中引用的非 readonly 类型成员
NonReadonlyMemberInGetHashCode
resharper_non_readonly_member_in_get_hash_code_highlighting

警告

可空性与层级结构中的注解冲突
NullnessAnnotationConflictWithJetBrainsAnnotations
resharper_nullness_annotation_conflict_with_jet_brains_annotations_highlighting

警告

可空性警告抑制运算符可能与取反的 'is' 表达式混淆
SuppressNullableWarningExpressionAsInvertedIsExpression
resharper_suppress_nullable_warning_expression_as_inverted_is_expression_highlighting

警告

'Object.ReferenceEquals' 始终为 false,因为它是用值类型调用的
ReferenceEqualsWithValueType
resharper_reference_equals_with_value_type_highlighting

警告

单向操作不得返回值
OneWayOperationContractWithReturnType
resharper_one_way_operation_contract_with_return_type_highlighting

警告

可以使用运算符 'is'/'Type Of ... Is ...'
OperatorIsCanBeUsed
resharper_operator_is_can_be_used_highlighting

警告

运算符未配对 checked 运算符
OperatorWithoutMatchedCheckedOperator
resharper_operator_without_matched_checked_operator_highlighting

警告

重写的 GetHashCode 调用了基类 'Object.GetHashCode()'
BaseObjectGetHashCodeCallInGetHashCode
resharper_base_object_get_hash_code_call_in_get_hash_code_highlighting

警告

参数隐藏了成员
ParameterHidesMember
resharper_parameter_hides_member_highlighting

警告

参数隐藏了主构造函数参数
ParameterHidesPrimaryConstructorParameter
resharper_parameter_hides_primary_constructor_parameter_highlighting

警告

partial 成员声明中的参数名不同
PartialMethodParameterNameMismatch
resharper_partial_method_parameter_name_mismatch_highlighting

警告

通过接口访问成员时可能存在歧义
PossibleInterfaceMemberAmbiguity
resharper_possible_interface_member_ambiguity_highlighting

警告

可能对值类型与 'null' 进行比较
CompareNonConstrainedGenericWithNull
resharper_compare_non_constrained_generic_with_null_highlighting

已禁用

可能存在循环构造函数调用
ConstructorInitializerLoop
resharper_constructor_initializer_loop_highlighting

警告

可能的双重检查锁定模式的错误实现。 可能对检查字段的多次写访问。
PossibleMultipleWriteAccessInDoubleCheckLocking
resharper_possible_multiple_write_access_in_double_check_locking_highlighting

警告

可能的双重检查锁定模式的错误实现。 对检查字段的读取访问。
ReadAccessInDoubleCheckLocking
resharper_read_access_in_double_check_locking_highlighting

警告

可能的无限继承
PossibleInfiniteInheritance
resharper_possible_infinite_inheritance_highlighting

警告

可能存在小数部分丢失
PossibleLossOfFraction
resharper_possible_loss_of_fraction_highlighting

警告

可能错误地传递了类型为 'System.Type' 的参数
PossibleMistakenSystemTypeArgument
resharper_possible_mistaken_system_type_argument_highlighting

警告

可能错误调用了 'GetType()'
PossibleMistakenCallToGetType
resharper_possible_mistaken_call_to_get_type_highlighting

警告

可能的多次枚举
PossibleMultipleEnumeration
resharper_possible_multiple_enumeration_highlighting

警告

可能发生溢出
IntVariableOverflow
resharper_int_variable_overflow_highlighting

警告

在 checked 上下文中可能发生溢出
IntVariableOverflowInCheckedContext
resharper_int_variable_overflow_in_checked_context_highlighting

警告

在 unchecked 上下文中可能发生溢出
IntVariableOverflowInUncheckedContext
resharper_int_variable_overflow_in_unchecked_context_highlighting

警告

可能抛出 'System.ArgumentOutOfRangeException'。 索引必须为非负整数。
NegativeIndex
resharper_negative_index_highlighting

警告

可能抛出 'System.ArgumentOutOfRangeException'。 起始索引必须小于或等于结束索引。
IndexingByInvalidRange
resharper_indexing_by_invalid_range_highlighting

警告

可能抛出 'System.InvalidCastException'
PossibleInvalidCastException
resharper_possible_invalid_cast_exception_highlighting

警告

在 foreach 循环中可能抛出 'System.InvalidCastException'
PossibleInvalidCastExceptionInForeachLoop
resharper_possible_invalid_cast_exception_in_foreach_loop_highlighting

警告

可能抛出 'System.InvalidOperationException'
PossibleInvalidOperationException
resharper_possible_invalid_operation_exception_highlighting

警告

可能抛出 'System.InvalidOperationException: Collection was modified'
PossibleInvalidOperationExceptionCollectionWasModified
resharper_possible_invalid_operation_exception_collection_was_modified_highlighting

警告

可能抛出 'System.NullReferenceException'
PossibleNullReferenceException
resharper_possible_null_reference_exception_highlighting

警告

通过 'new' 表达式创建的对象可能未被赋值
ObjectCreationAsStatement
resharper_object_creation_as_statement_highlighting

警告

可能为非预期的引用比较
PossibleUnintendedReferenceComparison
resharper_possible_unintended_reference_comparison_highlighting

警告

可能在 readonly 变量上调用非纯结构体方法:结构体值在调用前始终被复制
PossiblyImpureMethodCallOnReadonlyVariable
resharper_possibly_impure_method_call_on_readonly_variable_highlighting

警告

使用 'DefaultValueAttribute' 定义可选参数值可能存在误导
DefaultValueAttributeForOptionalParameter
resharper_default_value_attribute_for_optional_parameter_highlighting

警告

索引器初始化器前可能缺少逗号
PossiblyMissingIndexerInitializerComma
resharper_possibly_missing_indexer_initializer_comma_highlighting

警告

可能错误使用了 'CancellationToken'
PossiblyMistakenUseOfCancellationToken
resharper_possibly_mistaken_use_of_cancellation_token_highlighting

警告

集合中可能为非预期的线性查找
PossibleUnintendedLinearSearchInSet
resharper_possible_unintended_linear_search_in_set_highlighting

警告

条件调用中可能为非预期的修改操作
PossiblyUnintendedSideEffectsInsideConditionalInvocation
resharper_possibly_unintended_side_effects_inside_conditional_invocation_highlighting

警告

可能为非预期的字符串插值,而非格式字符串模板
PossiblyMistakenUseOfInterpolatedStringInsert
resharper_possibly_mistaken_use_of_interpolated_string_insert_highlighting

警告

可能错误的字符串比较:仅当 span 指向同一内存位置时才相等
StringSpanComparison
resharper_string_span_comparison_highlighting

警告

lambda 或局部函数中的参数名可能具有误导性
AllUnderscoreLocalParameterName
resharper_all_underscore_local_parameter_name_highlighting

警告

建议显式提供元组组件名称
PreferExplicitlyProvidedTupleComponentName
resharper_prefer_explicitly_provided_tuple_component_name_highlighting

提示

禁止捕获主构造函数参数
PrimaryConstructorParameterCaptureDisallowed
resharper_primary_constructor_parameter_capture_disallowed_highlighting

已禁用

带 [Optional] 属性的 'ref' 或 'out' 参数
OptionalParameterRefOut
resharper_optional_parameter_ref_out_highlighting

警告

返回由 'using' 捕获对象生成的 task
ReturnOfTaskProducedByUsingVariable
resharper_return_of_task_produced_by_using_variable_highlighting

警告

返回被 'using' 语句捕获的变量
ReturnOfUsingVariable
resharper_return_of_using_variable_highlighting

警告

函数的返回类型可设为非可空类型
ReturnTypeCanBeNotNullable
resharper_return_type_can_be_not_nullable_highlighting

警告

带有 [MustUseReturnValue] 注解的方法的返回值未被使用
MustUseReturnValue
resharper_must_use_return_value_highlighting

警告

带有 [MustDisposeResource] 注解的方法的返回值从未被释放
NotDisposedResource
resharper_not_disposed_resource_highlighting

警告

属性的返回值必须由调用方释放
NotDisposedResourceIsReturnedByProperty
resharper_not_disposed_resource_is_returned_by_property_highlighting

警告

'GetEnumerator' 方法调用的返回值从未被释放
GenericEnumeratorNotDisposed
resharper_generic_enumerator_not_disposed_highlighting

警告

迭代器的返回值未被使用
IteratorMethodResultIsIgnored
resharper_iterator_method_result_is_ignored_highlighting

警告

纯方法的返回值未被使用
ReturnValueOfPureMethodIsNotUsed
resharper_return_value_of_pure_method_is_not_used_highlighting

警告

返回值应被释放,但方法或函数未加 [MustDisposeResource] 注解
NotDisposedResourceIsReturned
resharper_not_disposed_resource_is_returned_highlighting

建议

安全类型转换表达式始终成功
TryCastAlwaysSucceeds
resharper_try_cast_always_succeeds_highlighting

建议

左操作数为零的移位表达式结果为零
ShiftExpressionZeroLeftOperand
resharper_shift_expression_zero_left_operand_highlighting

警告

检测到附近存在相似的匿名类型
SimilarAnonymousTypeNearby
resharper_similar_anonymous_type_nearby_highlighting

提示

相似表达式比较
EqualExpressionComparison
resharper_equal_expression_comparison_highlighting

警告

枚举的部分值未在 'switch' 表达式中处理,而是在默认分支通过异常处理
SwitchExpressionHandlesSomeKnownEnumValuesWithExceptionInDefault
resharper_switch_expression_handles_some_known_enum_values_with_exception_in_default_highlighting

提示

枚举的部分值未在 'switch' 语句中处理
SwitchStatementMissingSomeEnumCasesNoDefault
resharper_switch_statement_missing_some_enum_cases_no_default_highlighting

提示

枚举的部分值未在 'switch' 语句中处理,而是在默认分支处理
SwitchStatementHandlesSomeKnownEnumValuesWithDefault
resharper_switch_statement_handles_some_known_enum_values_with_default_highlighting

提示

泛型类型中的静态字段或自动属性
StaticMemberInGenericType
resharper_static_member_in_generic_type_highlighting

警告

静态成员初始化器引用了下面或其他部分的静态成员
StaticMemberInitializerReferesToMemberBelow
resharper_static_member_initializer_referes_to_member_below_highlighting

警告

字符串格式化方法问题
FormatStringProblem
resharper_format_string_problem_highlighting

警告

结构化日志消息项重复或仅大小写不同
DuplicateItemInLoggerTemplate
resharper_duplicate_item_in_logger_template_highlighting

警告

结构化消息模板问题
StructuredMessageTemplateProblem
resharper_structured_message_template_problem_highlighting

警告

对同步原语加锁存在可疑情况
SuspiciousLockOverSynchronizationPrimitive
resharper_suspicious_lock_over_synchronization_primitive_highlighting

警告

ArgumentNullException 中的参数名可疑
SuspiciousParameterNameInArgumentNullException
resharper_suspicious_parameter_name_in_argument_null_exception_highlighting

警告

此类型左操作数的移位数可疑
ShiftExpressionRightOperandNotEqualRealCount
resharper_shift_expression_right_operand_not_equal_real_count_highlighting

警告

可疑的类型转换或检查
SuspiciousTypeConversion.Global
resharper_suspicious_type_conversion_global_highlighting

警告

使用了类似丢弃名称的变量,存在可疑情况
AssignmentInsteadOfDiscard
resharper_assignment_instead_of_discard_highlighting

警告

可疑的 'volatile' 字段用法:复合操作不是原子的。 可改用 'Interlocked' 类。
NonAtomicCompoundOperator
resharper_non_atomic_compound_operator_highlighting

警告

模块中可能在运行时缺失的符号
SymbolFromNotCopiedLocallyReferenceUsedWarning
resharper_symbol_from_not_copied_locally_reference_used_warning_highlighting

警告

尾递归调用可替换为循环
TailRecursiveCall
resharper_tail_recursive_call_highlighting

提示

'is' 运算符的表达式从不是所提供的类型
IsExpressionAlwaysFalse
resharper_is_expression_always_false_highlighting

警告

'is' 运算符的给定表达式始终为所提供的类型
IsExpressionAlwaysTrue
resharper_is_expression_always_true_highlighting

警告

该参数期望为常量,以获得最佳性能
ConstantExpected
resharper_constant_expected_highlighting

建议

该模式是多余的,不会产生任何运行时检查
PatternIsRedundant
resharper_pattern_is_redundant_highlighting

警告

源表达式始终匹配所提供的模式
PatternAlwaysMatches
resharper_pattern_always_matches_highlighting

警告

源表达式从不匹配所提供的模式
PatternNeverMatches
resharper_pattern_never_matches_highlighting

警告

线程静态字段具有初始化器
ThreadStaticFieldHasInitializer
resharper_thread_static_field_has_initializer_highlighting

警告

尝试类型转换并检查 null 可用类型检查替代
SafeCastIsUsedAsTypeCheck
resharper_safe_cast_is_used_as_type_check_highlighting

建议

类型检查和强制转换可以合并
MergeCastWithTypeCheck
resharper_merge_cast_with_type_check_highlighting

建议

类型模式与类型转换可合并
UseSwitchCasePatternVariable
resharper_use_switch_case_pattern_variable_highlighting

建议

未分配的字段(非私有可访问性)
UnassignedField.Global
resharper_unassigned_field_global_highlighting

建议

未分配的字段(私有可访问性)
UnassignedField.Local
resharper_unassigned_field_local_highlighting

警告

未分配的 readonly 字段
UnassignedReadonlyField
resharper_unassigned_readonly_field_highlighting

警告

未识别的 CQRS 实体
MultipleCqrsEntity
resharper_multiple_cqrs_entity_highlighting

警告

未知的 Razor 布局
Razor.LayoutNotResolved
resharper_razor_layout_not_resolved_highlighting

错误

未知的 Razor 区段
Razor.SectionNotResolved
resharper_razor_section_not_resolved_highlighting

错误

<inheritdoc /> 的用法无效
InheritdocInvalidUsage
resharper_inheritdoc_invalid_usage_highlighting

警告

在根级别使用 <inheritdoc /> 以从基类候选项继承文档
InheritdocConsiderUsage
resharper_inheritdoc_consider_usage_highlighting

已禁用

使用集合的 count 属性
UseCollectionCountProperty
resharper_use_collection_count_property_highlighting

建议

在格式字符串中使用格式说明符
UseFormatSpecifierInFormatString
resharper_use_format_specifier_in_format_string_highlighting

建议

在插值字符串中使用格式说明符
SimplifyStringInterpolation
resharper_simplify_string_interpolation_highlighting

建议

请使用 null 检查替代对任意非 null 值均为真的类型检查
ConvertTypeCheckToNullCheck
resharper_convert_type_check_to_null_check_highlighting

警告

请使用 null 检查模式替代对任意非 null 值均为真的类型检查
ConvertTypeCheckPatternToNullCheck
resharper_convert_type_check_pattern_to_null_check_highlighting

警告

请使用可空注解替代属性
UseNullableAnnotationInsteadOfAttribute
resharper_use_nullable_annotation_instead_of_attribute_highlighting

建议

无意义的算术运算
UselessBinaryOperation
resharper_useless_binary_operation_highlighting

警告

在循环中使用 stackalloc
StackAllocInsideLoop
resharper_stack_alloc_inside_loop_highlighting

警告

赋值给非变量限定符表达式的属性的值可能会丢失
PossibleStructMemberModificationOfNonVariableStruct
resharper_possible_struct_member_modification_of_non_variable_struct_highlighting

警告

'value' 参数未被使用
ValueParameterNotUsed
resharper_value_parameter_not_used_highlighting

警告

变量可声明为非可空类型
VariableCanBeNotNullable
resharper_variable_can_be_not_nullable_highlighting

警告

局部函数中的变量隐藏了外部作用域的变量
VariableHidesOuterVariable
resharper_variable_hides_outer_variable_highlighting

警告

构造函数中调用虚成员
VirtualMemberCallInConstructor
resharper_virtual_member_call_in_constructor_highlighting

警告

'void' 方法带有 [MustDisposeResource] 属性注解
VoidMethodWithMustDisposeResourceAttribute
resharper_void_method_with_must_dispose_resource_attribute_highlighting

警告

'void' 方法带有 [MustUseReturnValue] 属性注解
VoidMethodWithMustUseReturnValueAttribute
resharper_void_method_with_must_use_return_value_attribute_highlighting

警告

'void' 方法带有 [Pure] 属性注解
PureAttributeOnVoidMethod
resharper_pure_attribute_on_void_method_highlighting

警告

使用 'with' 表达式替代对象初始化器
WithExpressionInsteadOfInitializer
resharper_with_expression_instead_of_initializer_highlighting

建议

'with' 表达式修改了所有可访问的实例成员
WithExpressionModifiesAllMembers
resharper_with_expression_modifies_all_members_highlighting

警告

代码冗余(102 项检查)

此类别中的代码检查会查找冗余和无用代码,这些代码会影响代码的可读性和风格,并且可以安全地移除。 某些代码冗余无法自动修复,其快速修复需要在交互模式下完成,需用户输入。 但大多数冗余可以在无需用户交互的情况下修复,使用 范围内修复代码清理

检查
ID
EditorConfig 属性

默认严重性

'??' 条件已知为 null 或非 null
ConstantNullCoalescingCondition
resharper_constant_null_coalescing_condition_highlighting

警告

根据可空引用类型注解,'??' 条件永不为 null
NullCoalescingConditionIsAlwaysNotNullAccordingToAPIContract
resharper_null_coalescing_condition_is_always_not_null_according_to_api_contract_highlighting

警告

[NotNull] 或 [CanBeNull] 属性应用于已由可空引用类型注解标记的类型
RedundantNullnessAttributeWithNullableReferenceTypes
resharper_redundant_nullness_attribute_with_nullable_reference_types_highlighting

警告

匿名方法签名是多余的
UnusedAnonymousMethodSignature
resharper_unused_anonymous_method_signature_highlighting

警告

数组创建可替换为数组初始化器
RedundantArrayCreationExpression
resharper_redundant_array_creation_expression_highlighting

提示

赋值未被使用
RedundantAssignment
resharper_redundant_assignment_highlighting

警告

赋值结果被完全丢弃
AssignmentIsFullyDiscarded
resharper_assignment_is_fully_discarded_highlighting

警告

与整型常量的比较无意义
UselessComparisonToIntegralConstant
resharper_useless_comparison_to_integral_constant_highlighting

警告

条件访问限定表达式已知为 null 或非 null
ConstantConditionalAccessQualifier
resharper_constant_conditional_access_qualifier_highlighting

警告

根据可空引用类型注解,条件访问限定表达式不为 null
ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
resharper_conditional_access_qualifier_is_non_nullable_according_to_api_contract_highlighting

警告

在向字典添加项前调用 'ContainsKey' 是多余的
RedundantDictionaryContainsKeyBeforeAdding
resharper_redundant_dictionary_contains_key_before_adding_highlighting

警告

CQRS 属性是冗余的,可予以删除
RedundantCqrsAttribute
resharper_redundant_cqrs_attribute_highlighting

警告

双重取反运算符
DoubleNegationOperator
resharper_double_negation_operator_highlighting

建议

语句重复
DuplicatedStatements
resharper_duplicated_statements_highlighting

警告

空的扩展声明
EmptyExtensionBlock
resharper_empty_extension_declaration_highlighting

警告

空的 for 循环是多余的
EmptyForStatement
resharper_empty_for_statement_highlighting

警告

空的区域
EmptyRegion
resharper_empty_region_highlighting

建议

显式委托创建表达式是多余的
RedundantDelegateCreation
resharper_redundant_delegate_creation_highlighting

警告

表达式始终为 'null'
ExpressionIsAlwaysNull
resharper_expression_is_always_null_highlighting

警告

表达式始终为 'true' 或始终为 'false'
ConditionIsAlwaysTrueOrFalse
resharper_condition_is_always_true_or_false_highlighting

警告

根据可空引用类型注解,表达式始终为 'true' 或 'false'
ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
resharper_condition_is_always_true_or_false_according_to_nullable_api_contract_highlighting

警告

启发式不可达代码
HeuristicUnreachableCode
resharper_heuristic_unreachable_code_highlighting

警告

立即调用委托
RedundantImmediateDelegateInvocation
resharper_redundant_immediate_delegate_invocation_highlighting

建议

Math.Abs() 的参数始终为非负数
MathAbsMethodIsRedundant
resharper_math_abs_method_is_redundant_highlighting

警告

Math.Sign() 方法始终返回相同结果
SuspiciousMathSignMethod
resharper_suspicious_math_sign_method_highlighting

警告

如果属性没有参数,括号是多余的
RedundantAttributeParentheses
resharper_redundant_attribute_parentheses_highlighting

提示

模式始终为 'true' 或始终为 'false'
PatternIsAlwaysTrueOrFalse
resharper_pattern_is_always_true_or_false_highlighting

警告

私有字段可转换为局部变量
PrivateFieldCanBeConvertedToLocalVariable
resharper_private_field_can_be_converted_to_local_variable_highlighting

警告

原始字符串可简化
RawStringCanBeSimplified
resharper_raw_string_can_be_simplified_highlighting

提示

多余的 [AttributeUsage] 属性属性赋值
RedundantAttributeUsageProperty
resharper_redundant_attribute_usage_property_highlighting

建议

多余的 'abstract' 修饰符
RedundantAbstractModifier
resharper_redundant_abstract_modifier_highlighting

警告

匿名类型属性显式命名多余
RedundantAnonymousTypePropertyName
resharper_redundant_anonymous_type_property_name_highlighting

警告

传递给调用者参数表达式参数的多余参数
RedundantCallerArgumentExpressionDefaultValue
resharper_redundant_caller_argument_expression_default_value_highlighting

警告

带默认值的参数多余
RedundantArgumentDefaultValue
resharper_redundant_argument_default_value_highlighting

警告

算术溢出检查上下文多余
RedundantOverflowCheckingContext
resharper_redundant_overflow_checking_context_highlighting

警告

'Attribute' 后缀多余
RedundantAttributeSuffix
resharper_redundant_attribute_suffix_highlighting

警告

'base.' 限定符多余
RedundantBaseQualifier
resharper_redundant_base_qualifier_highlighting

警告

布尔值比较多余
RedundantBoolCompare
resharper_redundant_bool_compare_highlighting

警告

集合初始化器中的大括号多余
RedundantCollectionInitializerElementBraces
resharper_redundant_collection_initializer_element_braces_highlighting

提示

'case' 标签多余
RedundantCaseLabel
resharper_redundant_case_label_highlighting

警告

在 default 分支前的 'case' 标签多余
RedundantEnumCaseLabelForDefaultSection
resharper_redundant_enum_case_label_for_default_section_highlighting

已禁用

多余的强制转换
RedundantCast
resharper_redundant_cast_highlighting

警告

catch 子句多余
RedundantCatchClause
resharper_redundant_catch_clause_highlighting

警告

record 声明中的 'class' 关键字多余
RedundantRecordClassKeyword
resharper_redundant_record_class_keyword_highlighting

警告

集合复制多余
RedundantCollectionCopyCall
resharper_redundant_collection_copy_call_highlighting

警告

赋值前的条件检查多余
RedundantCheckBeforeAssignment
resharper_redundant_check_before_assignment_highlighting

警告

条件三元表达式用法多余
RedundantTernaryExpression
resharper_redundant_ternary_expression_highlighting

警告

使用 'ConfigureAwait' 捕获上下文多余
RedundantConfigureAwait
resharper_redundant_configure_await_highlighting

建议

多余的控制流跳转语句
RedundantJumpStatement
resharper_redundant_jump_statement_highlighting

警告

丢弃标识多余
RedundantDiscardDesignation
resharper_redundant_discard_designation_highlighting

建议

多余的 'else' 关键字
RedundantIfElseBlock
resharper_redundant_if_else_block_highlighting

提示

对象创建表达式中的空参数列表多余
RedundantEmptyObjectCreationArgumentList
resharper_redundant_empty_object_creation_argument_list_highlighting

提示

冗余的空 finally 块
RedundantEmptyFinallyBlock
resharper_redundant_empty_finally_block_highlighting

警告

空的对象或集合初始化器多余
RedundantEmptyObjectOrCollectionInitializer
resharper_redundant_empty_object_or_collection_initializer_highlighting

警告

空的 switch 分支多余
RedundantEmptySwitchSection
resharper_redundant_empty_switch_section_highlighting

警告

在 'params' 参数的参数中显式创建集合是多余的
RedundantExplicitParamsArrayCreation
resharper_redundant_explicit_params_array_creation_highlighting

建议

显式创建可空类型是多余的
RedundantExplicitNullableCreation
resharper_redundant_explicit_nullable_creation_highlighting

警告

显式声明位置属性是多余的
RedundantExplicitPositionalPropertyDeclaration
resharper_redundant_explicit_positional_property_declaration_highlighting

警告

数组创建中的多余显式大小指定
RedundantExplicitArraySize
resharper_redundant_explicit_array_size_highlighting

警告

元组组件名称显式指定是多余的
RedundantExplicitTupleComponentName
resharper_redundant_explicit_tuple_component_name_highlighting

警告

数组创建时显式指定类型是多余的
RedundantExplicitArrayCreation
resharper_redundant_explicit_array_creation_highlighting

警告

fixed 指针声明是多余的
RedundantFixedPointerDeclaration
resharper_redundant_fixed_pointer_declaration_highlighting

建议

全局 using 指令是多余的
RedundantUsingDirective.Global
resharper_redundant_using_directive_global_highlighting

警告

'IEnumerable.Cast<T>' 或 'IEnumerable.OfType<T>' 调用是多余的
RedundantEnumerableCastCall
resharper_redundant_enumerable_cast_call_highlighting

警告

lambda 表达式参数类型说明是多余的
RedundantLambdaParameterType
resharper_redundant_lambda_parameter_type_highlighting

警告

lambda 签名括号是多余的
RedundantLambdaSignatureParentheses
resharper_redundant_lambda_signature_parentheses_highlighting

提示

名称限定符是多余的
RedundantNameQualifier
resharper_redundant_name_qualifier_highlighting

警告

对已由非可空基类约束的类型参数使用 'notnull' 约束是多余的
RedundantNotNullConstraint
resharper_redundant_not_null_constraint_highlighting

警告

对已由另一个非可空基类约束的类型参数的基类约束使用可空注解是多余的
RedundantNullableAnnotationOnTypeConstraintHasNonNullableBaseType
resharper_redundant_nullable_annotation_on_type_constraint_has_non_nullable_base_type_highlighting

警告

对具有非可空类型种类的类型参数的基类约束使用可空注解是多余的
RedundantNullableAnnotationOnTypeConstraintHasNonNullableTypeKind
resharper_redundant_nullable_annotation_on_type_constraint_has_non_nullable_type_kind_highlighting

警告

对已由非可空基类约束的类型参数的 'class?' 约束使用可空注解是多余的
RedundantNullableAnnotationOnReferenceTypeConstraint
resharper_redundant_nullable_annotation_on_reference_type_constraint_highlighting

警告

可空属性是多余的
RedundantNullableFlowAttribute
resharper_redundant_nullable_flow_attribute_highlighting

警告

可空指令是多余的
RedundantNullableDirective
resharper_redundant_nullable_directive_highlighting

警告

可空警告抑制表达式是多余的
RedundantSuppressNullableWarningExpression
resharper_redundant_suppress_nullable_warning_expression_highlighting

警告

'object.ToString()' 调用是多余的
RedundantToStringCall
resharper_redundant_to_string_call_highlighting

警告

对值类型的 'object.ToString()' 调用是多余的
RedundantToStringCallForValueType
resharper_redundant_to_string_call_for_value_type_highlighting

提示

逻辑条件表达式中的多余操作数
RedundantLogicalConditionalExpressionOperand
resharper_redundant_logical_conditional_expression_operand_highlighting

警告

'orderby' 子句中的 'ascending' 关键字多余
RedundantQueryOrderByAscendingKeyword
resharper_redundant_query_order_by_ascending_keyword_highlighting

提示

属性模式子句多余
RedundantPropertyPatternClause
resharper_redundant_property_pattern_clause_highlighting

建议

区间边界多余
RedundantRangeBound
resharper_redundant_range_bound_highlighting

建议

'readonly' 修饰符多余
RedundantReadonlyModifier
resharper_redundant_readonly_modifier_highlighting

建议

'scoped' 参数修饰符多余
RedundantScopedParameterModifier
resharper_redundant_scoped_parameter_modifier_highlighting

警告

类型或命名空间声明后的分号多余
RedundantDeclarationSemicolon
resharper_redundant_declaration_semicolon_highlighting

提示

字符串插值多余
RedundantStringInterpolation
resharper_redundant_string_interpolation_highlighting

建议

'string.Format()' 调用多余
RedundantStringFormatCall
resharper_redundant_string_format_call_highlighting

警告

'string.ToCharArray()' 调用多余
RedundantStringToCharArrayCall
resharper_redundant_string_to_char_array_call_highlighting

警告

冗余的 'switch' 表达式分支项
RedundantSwitchExpressionArms
resharper_redundant_switch_expression_arms_highlighting

警告

'nameof' 内的类型参数多余
RedundantTypeArgumentsInsideNameof
resharper_redundant_type_arguments_inside_nameof_highlighting

建议

方法的类型参数多余
RedundantTypeArgumentsOfMethod
resharper_redundant_type_arguments_of_method_highlighting

警告

模式中的类型检查多余
RedundantTypeCheckInPattern
resharper_redundant_type_check_in_pattern_highlighting

警告

类型声明体多余
RedundantTypeDeclarationBody
resharper_redundant_type_declaration_body_highlighting

建议

冗余的 using 指令
RedundantUsingDirective
resharper_redundant_using_directive_highlighting

警告

逐字前缀多余
RedundantVerbatimPrefix
resharper_redundant_verbatim_prefix_highlighting

建议

逐字字符串前缀多余
RedundantVerbatimStringPrefix
resharper_redundant_verbatim_string_prefix_highlighting

建议

'virtual' 修饰符多余
RedundantVirtualModifier
resharper_redundant_virtual_modifier_highlighting

警告

'WithCancellation()' 调用多余
RedundantWithCancellation
resharper_redundant_with_cancellation_highlighting

警告

移除多余的模式匹配括号
RedundantPatternParentheses
resharper_redundant_pattern_parentheses_highlighting

提示

始终匹配的子模式多余
RedundantAlwaysMatchSubpattern
resharper_redundant_always_match_subpattern_highlighting

建议

'true' 作为 for 语句条件多余
ForStatementConditionIsTrue
resharper_for_statement_condition_is_true_highlighting

警告

对可空类型的类型检查等同于对其基础类型的类型检查
RedundantNullableTypeMark
resharper_redundant_nullable_type_mark_highlighting

警告

不安全上下文声明多余
RedundantUnsafeContext
resharper_redundant_unsafe_context_highlighting

警告

未使用的可空指令
UnusedNullableDirective
resharper_unused_nullable_directive_highlighting

警告

符号声明中的冗余(51 项检查)

此类别包括代码检查,主要为 警告严重性级别,用于检测空的和未使用的符号声明。

检查
ID
EditorConfig 属性

默认严重性

具有虚拟(可重写)成员的类从未被继承(非私有可访问性)
ClassWithVirtualMembersNeverInherited.Global
resharper_class_with_virtual_members_never_inherited_global_highlighting

建议

具有虚拟(可重写)成员的类从未被继承(私有可访问性)
ClassWithVirtualMembersNeverInherited.Local
resharper_class_with_virtual_members_never_inherited_local_highlighting

建议

元组的组成部分从未使用
UnusedTupleComponentInReturnValue
resharper_unused_tuple_component_in_return_value_highlighting

警告

必须将 'DefaultParameterValueAttribute' 与 'OptionalAttribute' 结合使用
MeaninglessDefaultParameterValue
resharper_meaningless_default_parameter_value_highlighting

警告

空构造函数
EmptyConstructor
resharper_empty_constructor_highlighting

警告

空析构函数
EmptyDestructor
resharper_empty_destructor_highlighting

警告

“partial void”方法的空实现是多余的
RedundantPartialMethodEmptyImplementation
resharper_redundant_partial_method_empty_implementation_highlighting

警告

空命名空间声明
EmptyNamespace
resharper_empty_namespace_highlighting

警告

实体仅用于捕获其名称(非私有可访问性)
EntityNameCapturedOnly.Global
resharper_entity_name_captured_only_global_highlighting

警告

实体仅用于捕获其名称(私有可访问性)
EntityNameCapturedOnly.Local
resharper_entity_name_captured_only_local_highlighting

警告

局部函数从未使用
UnusedLocalFunction
resharper_unused_local_function_highlighting

警告

局部函数从未使用
UnusedLocalFunction.Compiler
resharper_unused_local_function_compiler_highlighting

警告

局部函数的返回值从未使用
UnusedLocalFunctionReturnValue
resharper_unused_local_function_return_value_highlighting

警告

方法返回值从未使用(非私有可访问性)
UnusedMethodReturnValue.Global
resharper_unused_method_return_value_global_highlighting

建议

方法返回值从未使用(私有可访问性)
UnusedMethodReturnValue.Local
resharper_unused_method_return_value_local_highlighting

警告

未访问的局部变量
NotAccessedVariable
resharper_not_accessed_variable_highlighting

警告

未访问的局部变量仅用于丢弃 'out' 参数值
NotAccessedOutParameterVariable
resharper_not_accessed_out_parameter_variable_highlighting

警告

未访问的主构造函数参数
NotAccessedPrimaryConstructorParameterCompiler
resharper_not_accessed_primary_constructor_parameter_compiler_highlighting

警告

参数仅用于前置条件检查(非私有可访问性)
ParameterOnlyUsedForPreconditionCheck.Global
resharper_parameter_only_used_for_precondition_check_global_highlighting

建议

参数仅用于前置条件检查(私有可访问性)
ParameterOnlyUsedForPreconditionCheck.Local
resharper_parameter_only_used_for_precondition_check_local_highlighting

警告

参数输出值始终被丢弃(非私有可访问性)
OutParameterValueIsAlwaysDiscarded.Global
resharper_out_parameter_value_is_always_discarded_global_highlighting

建议

参数输出值始终被丢弃(私有可访问性)
OutParameterValueIsAlwaysDiscarded.Local
resharper_out_parameter_value_is_always_discarded_local_highlighting

警告

重写方法中始终忽略 'params' 修饰符
RedundantParams
resharper_redundant_params_highlighting

警告

冗余属性 [SetsRequiredMembers]
RedundantSetsRequiredMembersAttribute
resharper_redundant_sets_required_members_attribute_highlighting

警告

多余的基类构造函数调用
RedundantBaseConstructorCall
resharper_redundant_base_constructor_call_highlighting

警告

基类型列表中多余的类或接口声明
RedundantExtendsListEntry
resharper_redundant_extends_list_entry_highlighting

警告

多余的成员初始化器
RedundantDefaultMemberInitializer
resharper_redundant_default_member_initializer_highlighting

警告

多余的成员重写
RedundantOverriddenMember
resharper_redundant_overridden_member_highlighting

警告

多余的方法重载(非 private 可访问性)
RedundantOverload.Global
resharper_redundant_overload_global_highlighting

建议

多余的方法重载(private 可访问性)
RedundantOverload.Local
resharper_redundant_overload_local_highlighting

建议

方法声明中的 'partial' 修饰符是多余的
PartialMethodWithSinglePart
resharper_partial_method_with_single_part_highlighting

警告

类型声明中的 'partial' 修饰符是多余的
PartialTypeWithSinglePart
resharper_partial_type_with_single_part_highlighting

警告

sealed 类中的 sealed 成员
SealedMemberInSealedClass
resharper_sealed_member_in_sealed_class_highlighting

警告

类型从未使用(非私有可访问性)
UnusedType.Global
resharper_unused_type_global_highlighting

建议

类型从未使用(私有可访问性)
UnusedType.Local
resharper_unused_type_local_highlighting

警告

类型成员从未通过基类型访问(非私有可访问性)
UnusedMemberInSuper.Global
resharper_unused_member_in_super_global_highlighting

建议

类型成员从未通过基类型访问(私有可访问性)
UnusedMemberInSuper.Local
resharper_unused_member_in_super_local_highlighting

警告

类型成员从未使用(非私有可访问性)
UnusedMember.Global
resharper_unused_member_global_highlighting

建议

类型成员从未使用(私有可访问性)
UnusedMember.Local
resharper_unused_member_local_highlighting

警告

类型成员仅在重写中使用(非私有可访问性)
UnusedMemberHierarchy.Global
resharper_unused_member_hierarchy_global_highlighting

建议

类型成员仅在重写中使用(私有可访问性)
UnusedMemberHierarchy.Local
resharper_unused_member_hierarchy_local_highlighting

警告

enum 的基础类型为 'int'
EnumUnderlyingTypeIsInt
resharper_enum_underlying_type_is_int_highlighting

警告

未使用的标签
UnusedLabel
resharper_unused_label_highlighting

警告

未使用的局部变量
UnusedVariable
resharper_unused_variable_highlighting

警告

未使用的参数(非私有可访问性)
UnusedParameter.Global
resharper_unused_parameter_global_highlighting

建议

未使用的参数(私有可访问性)
UnusedParameter.Local
resharper_unused_parameter_local_highlighting

警告

部分方法中未使用的参数
UnusedParameterInPartialMethod
resharper_unused_parameter_in_partial_method_highlighting

警告

未使用的位置参数
UnusedPositionalParameterCompiler
resharper_unused_positional_parameter_compiler_highlighting

警告

未使用的类型参数
UnusedTypeParameter
resharper_unused_type_parameter_highlighting

警告

虚拟(可重写)成员从未被重写(非私有可访问性)
VirtualMemberNeverOverridden.Global
resharper_virtual_member_never_overridden_global_highlighting

建议

虚拟(可重写)成员从未被重写(私有可访问性)
VirtualMemberNeverOverridden.Local
resharper_virtual_member_never_overridden_local_highlighting

建议

安全性(1 项检查)

此类别中的检查会根据 Mend.io 报告存在漏洞的 NuGet 包。

检查
ID
EditorConfig 属性

默认严重性

存在安全漏洞的 API 使用
VulnerableApi
resharper_vulnerable_api_highlighting

警告

拼写问题(3 项检查)

这些检查 检测各种上下文中的拼写错误

检查
ID
EditorConfig 属性

默认严重性

注释中的拼写错误
CommentTypo
resharper_comment_typo_highlighting

建议

标识符中的拼写错误
IdentifierTypo
resharper_identifier_typo_highlighting

建议

字符串字面量中的拼写错误
StringLiteralTypo
resharper_string_literal_typo_highlighting

建议

语法风格(46 项检查)

此类别中的检查检测 代码语法样式的违规。 与大多数代码检查不同,这些检查是否将相同的代码结构检测为代码问题取决于在 ReSharper 选项 的 代码编辑 | C# | 语法样式 页面上配置的相应代码风格规则 Alt+R, O 。 您还可以使用 代码清理修复这些检查检测到的问题。

检查
ID
EditorConfig 属性

默认严重性

为避免优先级不明显请添加括号
ArrangeMissingParentheses
resharper_arrange_missing_parentheses_highlighting

已禁用

为静态成员添加/移除限定符
ArrangeStaticMemberQualifier
resharper_arrange_static_member_qualifier_highlighting

提示

添加/移除 'this.' 限定符
ArrangeThisQualifier
resharper_arrange_this_qualifier_highlighting

提示

调整修饰符声明顺序
ArrangeModifiersOrder
resharper_arrange_modifiers_order_highlighting

建议

整理 null 检查模式
ArrangeNullCheckingPattern
resharper_arrange_null_checking_pattern_highlighting

提示

合并或拆分区段中的属性
ArrangeAttributes
resharper_arrange_attributes_highlighting

已禁用

解构声明中合并或拆分 'var'
ArrangeVarKeywordsInDeconstructingDeclaration
resharper_arrange_var_keywords_in_deconstructing_declaration_highlighting

建议

将赋值表达式放入代码块
PlaceAssignmentExpressionIntoBlock
resharper_place_assignment_expression_into_block_highlighting

已禁用

移除多余的括号
ArrangeRedundantParentheses
resharper_arrange_redundant_parentheses_highlighting

提示

用 CLR 类型名或关键字替换内置类型引用
BuiltInTypeReferenceStyle
resharper_built_in_type_reference_style_highlighting

提示

在静态成员访问表达式中用 CLR 类型名或关键字替换内置类型引用
BuiltInTypeReferenceStyleForMemberAccess
resharper_built_in_type_reference_style_for_member_access_highlighting

提示

用空行分隔流程转移语句
SeparateControlTransferStatement
resharper_separate_control_transfer_statement_highlighting

已禁用

行尾多余空白字符
UnnecessaryWhitespace
resharper_unnecessary_whitespace_highlighting

已禁用

禁止使用制表符进行缩进
TabsAreDisallowed
resharper_tabs_are_disallowed_highlighting

已禁用

类型成员应使用显式或隐式修饰符定义
ArrangeTypeMemberModifiers
resharper_arrange_type_member_modifiers_highlighting

提示

类型应使用显式或隐式修饰符定义
ArrangeTypeModifiers
resharper_arrange_type_modifiers_highlighting

提示

使用首选参数风格
ArgumentsStyleOther
resharper_arguments_style_other_highlighting

已禁用

使用首选参数风格用于匿名函数
ArgumentsStyleAnonymousFunction
resharper_arguments_style_anonymous_function_highlighting

已禁用

使用首选参数风格用于字面量值
ArgumentsStyleLiteral
resharper_arguments_style_literal_highlighting

已禁用

使用首选参数风格用于具名表达式
ArgumentsStyleNamedExpression
resharper_arguments_style_named_expression_highlighting

已禁用

使用首选参数风格用于字符串字面量值
ArgumentsStyleStringLiteral
resharper_arguments_style_string_literal_highlighting

已禁用

使用首选主体风格(转换为具有首选主体风格的构造函数或析构函数)
ArrangeConstructorOrDestructorBody
resharper_arrange_constructor_or_destructor_body_highlighting

已禁用

使用首选主体风格(转换为具有首选主体风格的局部函数)
ArrangeLocalFunctionBody
resharper_arrange_local_function_body_highlighting

已禁用

使用首选主体风格(转换为具有首选主体风格的方法或运算符)
ArrangeMethodOrOperatorBody
resharper_arrange_method_or_operator_body_highlighting

已禁用

使用首选主体风格(转换为具有首选主体风格的属性、索引器或事件)
ArrangeAccessorOwnerBody
resharper_arrange_accessor_owner_body_highlighting

建议

使用首选大括号风格(强制在 'do-while' 语句中使用大括号)
EnforceDoWhileStatementBraces
resharper_enforce_do_while_statement_braces_highlighting

已禁用

使用首选大括号风格(在 'fixed' 语句中强制使用大括号)
EnforceFixedStatementBraces
resharper_enforce_fixed_statement_braces_highlighting

已禁用

使用首选大括号风格(强制在 'for' 语句中使用大括号)
EnforceForStatementBraces
resharper_enforce_for_statement_braces_highlighting

已禁用

使用首选大括号风格(在 'foreach' 语句中强制使用大括号)
EnforceForeachStatementBraces
resharper_enforce_foreach_statement_braces_highlighting

已禁用

使用首选大括号风格(强制在 'if' 语句中使用大括号)
EnforceIfStatementBraces
resharper_enforce_if_statement_braces_highlighting

已禁用

使用首选大括号风格(在 'lock' 语句中强制使用大括号)
EnforceLockStatementBraces
resharper_enforce_lock_statement_braces_highlighting

已禁用

使用首选大括号风格(在 'using' 语句中强制使用大括号)
EnforceUsingStatementBraces
resharper_enforce_using_statement_braces_highlighting

已禁用

使用首选大括号风格(强制在 'while' 语句中使用大括号)
EnforceWhileStatementBraces
resharper_enforce_while_statement_braces_highlighting

已禁用

使用首选大括号风格(移除多余的大括号)
RemoveRedundantBraces
resharper_remove_redundant_braces_highlighting

已禁用

使用首选命名空间主体风格
ArrangeNamespaceBody
resharper_arrange_namespace_body_highlighting

提示

使用首选丢弃声明风格
SuggestDiscardDeclarationVarStyle
resharper_suggest_discard_declaration_var_style_highlighting

提示

在多行列表中新行前使用首选结尾逗号风格
ArrangeTrailingCommaInMultilineLists
resharper_arrange_trailing_comma_in_multiline_lists_highlighting

提示

当最后一个元素后无新行时使用首选结尾逗号风格
ArrangeTrailingCommaInSinglelineLists
resharper_arrange_trailing_comma_in_singleline_lists_highlighting

提示

当类型明显时使用首选默认值表达式风格
ArrangeDefaultValueWhenTypeEvident
resharper_arrange_default_value_when_type_evident_highlighting

建议

当类型不明显时使用首选默认值表达式风格
ArrangeDefaultValueWhenTypeNotEvident
resharper_arrange_default_value_when_type_not_evident_highlighting

提示

当创建类型明显时使用首选 'new' 表达式风格
ArrangeObjectCreationWhenTypeEvident
resharper_arrange_object_creation_when_type_evident_highlighting

建议

当创建类型不明显时使用首选 'new' 表达式风格
ArrangeObjectCreationWhenTypeNotEvident
resharper_arrange_object_creation_when_type_not_evident_highlighting

提示

使用首选 'var' 风格(其他场景)
SuggestVarOrType_Elsewhere
resharper_suggest_var_or_type_elsewhere_highlighting

提示

使用首选 'var' 风格(内置类型)
SuggestVarOrType_BuiltInTypes
resharper_suggest_var_or_type_built_in_types_highlighting

提示

使用首选 'var' 风格(解构声明中)
SuggestVarOrType_DeconstructionDeclarations
resharper_suggest_var_or_type_deconstruction_declarations_highlighting

提示

使用首选 'var' 风格(类型简单时)
SuggestVarOrType_SimpleTypes
resharper_suggest_var_or_type_simple_types_highlighting

提示

Unity(47 项检查)

此类别中的检查报告特定于 Unity 项目的代码问题。

检查
ID
EditorConfig 属性

默认严重性

可用的非分配方法替代方案
Unity.PreferNonAllocApi
resharper_unity_prefer_non_alloc_api_highlighting

警告

在继承自 'PropertyDrawer' 的类中避免使用 'base.OnGUI()'
Unity.PropertyDrawerOnGUIBase
resharper_unity_property_drawer_on_gui_base_highlighting

警告

无法解析组件或 ScriptableObject
Unity.UnresolvedComponentOrScriptableObject
resharper_unity_unresolved_component_or_scriptable_object_highlighting

警告

DOTS:IAspect 字段必须为以下类型之一:RefRW、RefRO、EnabledRefRW、EnabledRefRO、DynamicBuffer 或 Entity
Unity.Entities.AspectWrongFieldsType
resharper_unity_entities_aspect_wrong_fields_type_highlighting

错误

DOTS:类型关键字不一致
Unity.Entities.InconsistentModifiersForDotsInheritor
resharper_unity_entities_inconsistent_modifiers_for_dots_inheritor_highlighting

错误

DOTS:指定的类型必须为结构体类型
Unity.Entities.MustBeStructForDotsInheritor
resharper_unity_entities_must_be_struct_for_dots_inheritor_highlighting

错误

已声明同名事件函数
Unity.DuplicateEventFunction
resharper_unity_duplicate_event_function_highlighting

警告

期望类型为 'Component' 或 'MonoBehaviour' 的派生类型
Unity.ExpectedComponent
resharper_unity_expected_component_highlighting

警告

期望类型为 'ScriptableObject' 的派生类型
Unity.ExpectedScriptableObject
resharper_unity_expected_scriptable_object_highlighting

警告

'ComponentLookup' 类型的字段在使用前必须先更新。
Unity.Entities.NotUpdatedComponentLookup
resharper_unity_entities_not_updated_component_lookup_highlighting

警告

文件名应与程序集名称一致
MISMATCHED_ASMDEF_FILENAME
resharper_mismatched_asmdef_filename_highlighting

建议

未定义分组路径
Odin.OdinUnknownGroupingPath
resharper_odin_odin_unknown_grouping_path_highlighting

警告

方法签名不正确
Unity.IncorrectMethodSignature
resharper_unity_incorrect_method_signature_highlighting

警告

Odin 分组属性类型不正确
Odin.OdinMemberWrongGroupingAttribute
resharper_odin_odin_member_wrong_grouping_attribute_highlighting

警告

成员同时出现在多个 UI 分组中
Odin.OdinMemberPresentInMultipleGroups
resharper_odin_odin_member_present_in_multiple_groups_highlighting

警告

字符串字面量中引用的方法签名不符合预期
Unity.IncorrectMethodSignatureInStringLiteral
resharper_unity_incorrect_method_signature_in_string_literal_highlighting

警告

'MonoBehaviour' 实例必须通过 'GameObject.AddComponent<T>()' 实例化,而非 'new'
Unity.IncorrectMonoBehaviourInstantiation
resharper_unity_incorrect_mono_behaviour_instantiation_highlighting

警告

参数应为 'Component' 的派生类型
Unity.ParameterNotDerivedFromComponent
resharper_unity_parameter_not_derived_from_component_highlighting

警告

属性可能被错误地应用于多个字段
Unity.PossibleMisapplicationOfAttributeToMultipleFields
resharper_unity_possible_misapplication_of_attribute_to_multiple_fields_highlighting

警告

对派生自 'UnityEngine.Object' 的类型进行 null 合并操作会绕过底层 Unity 引擎对象的生命周期检查,可能导致生命周期检查被非预期绕过
Unity.NoNullCoalescing
resharper_unity_no_null_coalescing_highlighting

已禁用

对派生自 'UnityEngine.Object' 的类型进行 null 传播操作会绕过底层 Unity 引擎对象的生命周期检查,可能导致生命周期检查被非预期绕过
Unity.NoNullPropagation
resharper_unity_no_null_propagation_highlighting

已禁用

对派生自 'UnityEngine.Object' 的类型进行模式匹配 null 检查会绕过底层 Unity 引擎对象的生命周期检查,可能导致生命周期检查被非预期绕过
Unity.NoNullPatternMatching
resharper_unity_no_null_pattern_matching_highlighting

已禁用

建议优先使用基于 GUID 的程序集引用
Unity.PreferGuidReference
resharper_unity_prefer_guid_reference_highlighting

提示

属性用法多余(应用于此声明类型时属性多余)
Unity.RedundantAttributeOnTarget
resharper_unity_redundant_attribute_on_target_highlighting

警告

属性用法多余('FormerlySerializedAs' 属性多余)
Unity.RedundantFormerlySerializedAsAttribute
resharper_unity_redundant_formerly_serialized_as_attribute_highlighting

警告

属性用法多余('HideInInspector' 属性多余)
Unity.RedundantHideInInspectorAttribute
resharper_unity_redundant_hide_in_inspector_attribute_highlighting

警告

属性用法多余('InitializeOnLoad' 属性多余)
Unity.RedundantInitializeOnLoadAttribute
resharper_unity_redundant_initialize_on_load_attribute_highlighting

警告

属性用法多余('SerializeField' 属性多余)
Unity.RedundantSerializeFieldAttribute
resharper_unity_redundant_serialize_field_attribute_highlighting

警告

Unity 事件函数多余
Unity.RedundantEventFunction
resharper_unity_redundant_event_function_highlighting

警告

多次访问内置组件的属性效率低下
Unity.InefficientPropertyAccess
resharper_unity_inefficient_property_access_highlighting

已禁用

场景不存在
Unity.LoadSceneUnexistingScene
resharper_unity_load_scene_unexisting_scene_highlighting

警告

场景在构建设置中被禁用
Unity.LoadSceneDisabledSceneName
resharper_unity_load_scene_disabled_scene_name_highlighting

警告

'ScriptableObject' 实例必须通过 'ScriptableObject.CreateInstance<T>()' 实例化,而非 'new'
Unity.IncorrectScriptableObjectInstantiation
resharper_unity_incorrect_scriptable_object_instantiation_highlighting

警告

对象实例化后立即设置 'parent' 属性效率低下
Unity.InstantiateWithoutParent
resharper_unity_instantiate_without_parent_highlighting

警告

场景短名称不唯一
Unity.LoadSceneAmbiguousSceneName
resharper_unity_load_scene_ambiguous_scene_name_highlighting

警告

基于字符串的图形属性查找效率低下
Unity.PreferAddressByIdToGraphicsParams
resharper_unity_prefer_address_by_id_to_graphics_params_highlighting

警告

基于字符串的组件类型查找效率低下
Unity.PreferGenericMethodOverload
resharper_unity_prefer_generic_method_overload_highlighting

警告

构建设置中缺少索引
Unity.LoadSceneWrongIndex
resharper_unity_load_scene_wrong_index_highlighting

警告

输入名称未在 Input 管理器中定义
Unity.UnknownInputAxes
resharper_unity_unknown_input_axes_highlighting

警告

'标签与图层' 中未定义该层
Unity.UnknownLayer
resharper_unity_unknown_layer_highlighting

警告

项目中未定义该资源
Unity.UnknownResource
resharper_unity_unknown_resource_highlighting

警告

已为其他菜单项定义了相同的快捷键
Unity.DuplicateShortcut
resharper_unity_duplicate_shortcut_highlighting

警告

'标签与图层' 中未定义该标签
Unity.UnknownTag
resharper_unity_unknown_tag_highlighting

警告

项目中不存在同名动画状态
Unity.UnknownAnimatorStateName
resharper_unity_unknown_animator_state_name_highlighting

警告

构建设置中不存在同名场景
Unity.LoadSceneUnknownSceneName
resharper_unity_load_scene_unknown_scene_name_highlighting

警告

如需在函数中使用 'GetSingleton' 调用的结果,'OnCreate' 必须包含 'RequireForUpdate' 调用
Unity.Entities.SingletonMustBeRequested
resharper_unity_entities_singleton_must_be_requested_highlighting

警告

请使用 'CompareTag' 替代显式字符串比较
Unity.ExplicitTagComparison
resharper_unity_explicit_tag_comparison_highlighting

警告

Unity Burst 编译器警告(17 项检查)

此类别中的检查在代码实际编译之前报告 Unity Burst 编译器的警告。

检查
ID
EditorConfig 属性

默认严重性

不支持访问托管索引器
Unity.BurstAccessingManagedIndexer
resharper_unity_burst_accessing_managed_indexer_highlighting

警告

不支持访问托管方法
Unity.BurstAccessingManagedMethod
resharper_unity_burst_accessing_managed_method_highlighting

警告

不支持装箱操作
Unity.BurstBoxingNotSupported
resharper_unity_burst_boxing_not_supported_highlighting

警告

Burst:String.Format(format, ...) 参数类型无效
Unity.BurstStringFormatInvalidArgument
resharper_unity_burst_string_format_invalid_argument_highlighting

警告

Burst:变量解析为 System.String,可能导致 Burst 编译调用栈中出现无效的托管方法调用
Unity.BurstLocalStringVariableDeclaration
resharper_unity_burst_local_string_variable_declaration_highlighting

建议

不支持创建托管类型
Unity.BurstCreatingManagedType
resharper_unity_burst_creating_managed_type_highlighting

警告

调试日志函数仅接受字符串
Unity.BurstDebugLogInvalidArgument
resharper_unity_burst_debug_log_invalid_argument_highlighting

警告

函数签名不能包含托管类型
Unity.BurstFunctionSignatureContainsManagedTypes
resharper_unity_burst_function_signature_contains_managed_types_highlighting

警告

不支持从非 readonly 静态字段加载
Unity.BurstLoadingStaticNotReadonly
resharper_unity_burst_loading_static_not_readonly_highlighting

警告

不支持加载托管类型
Unity.BurstLoadingManagedType
resharper_unity_burst_loading_managed_type_highlighting

警告

共享静态类型参数需要非托管约束
Unity.SharedStaticUnmanagedType
resharper_unity_shared_static_unmanaged_type_highlighting

警告

部分 SharedStatic`1.GetOrCreate 重载会导致编译器错误
Unity.BurstSharedStaticCreate
resharper_unity_burst_shared_static_create_highlighting

警告

String.Format(format, ...) 仅接受字符串字面量和常量字符串
Unity.BurstStringFormatInvalidFormat
resharper_unity_burst_string_format_invalid_format_highlighting

警告

不支持 'foreach' 结构
Unity.BurstForeachNotSupported
resharper_unity_burst_foreach_not_supported_highlighting

警告

不支持 try 语句
Unity.BurstTryNotSupported
resharper_unity_burst_try_not_supported_highlighting

警告

在 Burst 中禁止使用 typeof
Unity.BurstTypeofExpression
resharper_unity_burst_typeof_expression_highlighting

警告

不支持写入静态字段
Unity.BurstWriteStaticField
resharper_unity_burst_write_static_field_highlighting

警告

Unity 性能检查(5 项检查)

此类别中的检查报告 Unity 项目中的计算效率低下的模式。

检查
ID
EditorConfig 属性

默认严重性

'Camera.main' 性能开销较大
Unity.PerformanceCriticalCodeCameraMain
resharper_unity_performance_critical_code_camera_main_highlighting

提示

高开销方法调用
Unity.PerformanceCriticalCodeInvocation
resharper_unity_performance_critical_code_invocation_highlighting

提示

高开销 null 比较
Unity.PerformanceCriticalCodeNullComparison
resharper_unity_performance_critical_code_null_comparison_highlighting

提示

乘法运算顺序效率低下
Unity.InefficientMultiplicationOrder
resharper_unity_inefficient_multiplication_order_highlighting

警告

建议使用交错数组或一维数组替代多维数组
Unity.InefficientMultidimensionalArrayUsage
resharper_unity_inefficient_multidimensional_array_usage_highlighting

警告

Unreal Build System(2 项检查)

此类别中的检查特定于 Unreal Engine项目。

检查
ID
EditorConfig 属性

默认严重性

项目文件中缺少插件依赖项
CSharpMissingPluginDependency
resharper_c_sharp_missing_plugin_dependency_highlighting

警告

不存在同名模块
CSharpBuildCSInvalidModuleName
resharper_c_sharp_build_cs_invalid_module_name_highlighting

警告

Xunit(1 项检查)

这些检查检测与 xUnit.Net 测试相关的代码问题。

检查
ID
EditorConfig 属性

默认严重性

Xunit 测试中的控制台输出
Xunit.XunitTestWithConsoleOutput
resharper_xunit_xunit_test_with_console_output_highlighting

警告

最后修改日期: 2025年 12月 8日