ReSharper 2026.3 Help

VB.NET 中的代码检查

在 VB.NET 中,ReSharper 2026.3 提供两种代码检查:274 项 检测错误的检查 ,例如语法错误、未解析的符号、编译器错误等(无法配置或禁用任何这些检查),以及 266 项 专有代码检查 ,其中任何一项都可以 禁用或更改其 严重性级别。
These code inspections help you detect code issues at design time in all open files, and additionally they allow you to find code issues in specific scope.

可配置的 VB.NET 检查列在下方,并按其 类别分组。

代码通知(1 项检查)

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

检查
ID
EditorConfig 属性

默认严重性

非活动的预处理器分支
InactivePreprocessorBranch
resharper_inactive_preprocessor_branch_highlighting

警告

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

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

检查
ID
EditorConfig 属性

默认严重性

层次结构中的注解重复
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

建议

检查引用相等性
VBCheckForReferenceEqualityInstead.1
resharper_vb_check_for_reference_equality_instead_1_highlighting

建议

检查引用相等性
VBCheckForReferenceEqualityInstead.2
resharper_vb_check_for_reference_equality_instead_2_highlighting

建议

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

已禁用

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

已禁用

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

警告

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

提示

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

提示

将属性转换为自动属性
ConvertToVbAutoProperty
resharper_convert_to_vb_auto_property_highlighting

建议

在可能的情况下将属性转换为自动属性
ConvertToVbAutoPropertyWhenPossible
resharper_convert_to_vb_auto_property_when_possible_highlighting

提示

将属性转换为带私有 setter 的自动属性
ConvertToVbAutoPropertyWithPrivateSetter
resharper_convert_to_vb_auto_property_with_private_setter_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

警告

成员可以设为私有(非私有可访问性)
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

已禁用

多重可空属性的使用
MultipleNullableAttributesUsage
resharper_multiple_nullable_attributes_usage_highlighting

警告

可空性属性用于 void 或值类型的声明
AnnotationRedundancyAtValueType
resharper_annotation_redundancy_at_value_type_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

已禁用

可能的错误参数
VBPossibleMistakenArgument
resharper_vb_possible_mistaken_argument_highlighting

警告

可能错误地调用了 GetType()
VBPossibleMistakenCallToGetType.1
resharper_vb_possible_mistaken_call_to_get_type_1_highlighting

警告

可能错误地调用了 GetType()
VBPossibleMistakenCallToGetType.2
resharper_vb_possible_mistaken_call_to_get_type_2_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

建议

移除 ToList()
VBRemoveToList.1
resharper_vb_remove_to_list_1_highlighting

建议

移除 ToList()
VBRemoveToList.2
resharper_vb_remove_to_list_2_highlighting

建议

替换为 FirstOrDefault($args$)
VBReplaceWithFirstOrDefault
resharper_vb_replace_with_first_or_default_highlighting

建议

替换为 LastOrDefault($args$)
VBReplaceWithLastOrDefault
resharper_vb_replace_with_last_or_default_highlighting

建议

替换为 OfType<T>()(替换为 OfType(Of ..)())
VBReplaceWithOfType.1
resharper_vb_replace_with_of_type_1_highlighting

建议

替换为 OfType<T>()(替换为 OfType(Of ..)())
VBReplaceWithOfType.2
resharper_vb_replace_with_of_type_2_highlighting

建议

替换为 OfType<T>().Any()(替换为 OfType(Of ..)().Any())
VBReplaceWithOfType.Any.1
resharper_vb_replace_with_of_type_any_1_highlighting

建议

替换为 OfType<T>().Any()(替换为 OfType(Of ..)().Any(..))
VBReplaceWithOfType.Any.2
resharper_vb_replace_with_of_type_any_2_highlighting

建议

替换为 OfType<T>().Count()(替换为 OfType(Of ..)().Count())
VBReplaceWithOfType.Count.1
resharper_vb_replace_with_of_type_count_1_highlighting

建议

替换为 OfType<T>().Count()(替换为 OfType(Of ..)().Count(..))
VBReplaceWithOfType.Count.2
resharper_vb_replace_with_of_type_count_2_highlighting

建议

替换为 OfType<T>().First()(替换为 OfType(Of ..)().First())
VBReplaceWithOfType.First.1
resharper_vb_replace_with_of_type_first_1_highlighting

建议

替换为 OfType<T>().First()(替换为 OfType(Of ..)().First(..))
VBReplaceWithOfType.First.2
resharper_vb_replace_with_of_type_first_2_highlighting

建议

替换为 OfType<T>().FirstOrDefault()(替换为 OfType(Of ..)().FirstOrDefault())
VBReplaceWithOfType.FirstOrDefault.1
resharper_vb_replace_with_of_type_first_or_default_1_highlighting

建议

替换为 OfType<T>().FirstOrDefault()(替换为 OfType(Of ..)().FirstOrDefault(..))
VBReplaceWithOfType.FirstOrDefault.2
resharper_vb_replace_with_of_type_first_or_default_2_highlighting

建议

替换为 OfType<T>().Last()(替换为 OfType(Of ..)().Last())
VBReplaceWithOfType.Last.1
resharper_vb_replace_with_of_type_last_1_highlighting

建议

替换为 OfType<T>().Last()(替换为 OfType(Of ..)().Last(..))
VBReplaceWithOfType.Last.2
resharper_vb_replace_with_of_type_last_2_highlighting

建议

替换为 OfType<T>().LastOrDefault()(替换为 OfType(Of ..)().LastOrDefault())
VBReplaceWithOfType.LastOrDefault.1
resharper_vb_replace_with_of_type_last_or_default_1_highlighting

建议

替换为 OfType<T>().LastOrDefault()(替换为 OfType(Of ..)().LastOrDefault(..))
VBReplaceWithOfType.LastOrDefault.2
resharper_vb_replace_with_of_type_last_or_default_2_highlighting

建议

替换为 OfType<T>().Single()(替换为 OfType(Of ..)().Single())
VBReplaceWithOfType.Single.1
resharper_vb_replace_with_of_type_single_1_highlighting

建议

替换为 OfType<T>().Single()(替换为 OfType(Of ..)().Single(..))
VBReplaceWithOfType.Single.2
resharper_vb_replace_with_of_type_single_2_highlighting

建议

替换为 OfType<T>().SingleOrDefault()(替换为 OfType(Of ..)().SingleOrDefault())
VBReplaceWithOfType.SingleOrDefault.1
resharper_vb_replace_with_of_type_single_or_default_1_highlighting

建议

替换为 OfType<T>().SingleOrDefault()(替换为 OfType(Of ..)().SingleOrDefault(..))
VBReplaceWithOfType.SingleOrDefault.2
resharper_vb_replace_with_of_type_single_or_default_2_highlighting

建议

替换为 OfType<T>().Where()(替换为 OfType(Of ..)().Where(..))
VBReplaceWithOfType.Where
resharper_vb_replace_with_of_type_where_highlighting

建议

替换为单次赋值
VBReplaceWithSingleAssignment.1
resharper_vb_replace_with_single_assignment_1_highlighting

建议

替换为单次赋值
VBReplaceWithSingleAssignment.2
resharper_vb_replace_with_single_assignment_2_highlighting

建议

替换为单次调用 Any(..)
VBReplaceWithSingleCallToAny
resharper_vb_replace_with_single_call_to_any_highlighting

建议

替换为单次调用 Count(..)
VBReplaceWithSingleCallToCount
resharper_vb_replace_with_single_call_to_count_highlighting

建议

替换为单次调用 First(..)
VBReplaceWithSingleCallToFirst
resharper_vb_replace_with_single_call_to_first_highlighting

建议

替换为单次调用 FirstOrDefault(..)
VBReplaceWithSingleCallToFirstOrDefault
resharper_vb_replace_with_single_call_to_first_or_default_highlighting

建议

替换为单次调用 Last(..)
VBReplaceWithSingleCallToLast
resharper_vb_replace_with_single_call_to_last_highlighting

建议

替换为单次调用 LastOrDefault(..)
VBReplaceWithSingleCallToLastOrDefault
resharper_vb_replace_with_single_call_to_last_or_default_highlighting

建议

替换为单次调用 Single(..)
VBReplaceWithSingleCallToSingle
resharper_vb_replace_with_single_call_to_single_highlighting

建议

替换为单次调用 SingleOrDefault(..)
VBReplaceWithSingleCallToSingleOrDefault
resharper_vb_replace_with_single_call_to_single_or_default_highlighting

建议

替换为 SingleOrDefault($args$)
VBReplaceWithSingleOrDefault
resharper_vb_replace_with_single_or_default_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

已禁用

简化条件运算符
SimplifyConditionalOperator
resharper_simplify_conditional_operator_highlighting

建议

简化表达式
VBSimplifyLinqExpression.1
resharper_vb_simplify_linq_expression_1_highlighting

建议

简化表达式
VBSimplifyLinqExpression.2
resharper_vb_simplify_linq_expression_2_highlighting

建议

简化表达式
VBSimplifyLinqExpression.3
resharper_vb_simplify_linq_expression_3_highlighting

建议

简化表达式
VBSimplifyLinqExpression.4
resharper_vb_simplify_linq_expression_4_highlighting

建议

简化表达式
VBSimplifyLinqExpression.5
resharper_vb_simplify_linq_expression_5_highlighting

建议

简化表达式
VBSimplifyLinqExpression.6
resharper_vb_simplify_linq_expression_6_highlighting

建议

简化表达式
VBSimplifyLinqExpression.7
resharper_vb_simplify_linq_expression_7_highlighting

提示

简化表达式
VBSimplifyLinqExpression.8
resharper_vb_simplify_linq_expression_8_highlighting

提示

简化表达式
VBSimplifyLinqExpression.9
resharper_vb_simplify_linq_expression_9_highlighting

提示

简化表达式
VBSimplifyLinqExpression.10
resharper_vb_simplify_linq_expression_10_highlighting

提示

简化'IIf'
SimplifyIIf
resharper_simplify_i_if_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

提示

具有可疑相等性的类型用于记录(非私有可访问性)
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

警告

使用数组创建表达式
VBUseArrayCreationExpression.1
resharper_vb_use_array_creation_expression_1_highlighting

建议

使用数组创建表达式
VBUseArrayCreationExpression.2
resharper_vb_use_array_creation_expression_2_highlighting

建议

改用 First()
VBUseFirstInstead
resharper_vb_use_first_instead_highlighting

警告

使用方法 Any()
VBUseMethodAny.1
resharper_vb_use_method_any_1_highlighting

建议

使用方法 Any()
VBUseMethodAny.2
resharper_vb_use_method_any_2_highlighting

建议

使用方法 Any()
VBUseMethodAny.3
resharper_vb_use_method_any_3_highlighting

建议

使用方法 Any()
VBUseMethodAny.4
resharper_vb_use_method_any_4_highlighting

建议

使用方法 Any()
VBUseMethodAny.5
resharper_vb_use_method_any_5_highlighting

建议

使用方法 IsInstanceOfType(..)
VBUseMethodIsInstanceOfType
resharper_vb_use_method_is_instance_of_type_highlighting

建议

使用 'TypeOf .. Is ..' 运算符
VBUseTypeOfIsOperator.1
resharper_vb_use_type_of_is_operator_1_highlighting

建议

使用 'TypeOf .. Is ..' 运算符
VBUseTypeOfIsOperator.2
resharper_vb_use_type_of_is_operator_2_highlighting

建议

编译器警告(25 项检查)

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

检查
ID
EditorConfig 属性

默认严重性

通过实例访问共享成员
VBWarnings::BC42025
resharper_vb_warnings_bc42025_highlighting

警告

异步方法缺少 'Await' 运算符
VBWarnings::BC42356
resharper_vb_warnings_bc42356_highlighting

警告

由于此调用未等待,当前方法的执行将在调用完成之前继续。 请考虑对调用结果应用 'Await' 运算符。
VBWarnings::BC42358
resharper_vb_warnings_bc42358_highlighting

警告

字段从未使用
UnusedField.Compiler
resharper_unused_field_compiler_highlighting

警告

函数在所有代码路径上未返回引用类型值
VBWarnings::BC42105,BC42106,BC42107
resharper_vb_warnings_bc42105_bc42106_bc42107_highlighting

警告

函数在所有代码路径上未返回结构体值
VBWarnings::BC42353,BC42354,BC42355
resharper_vb_warnings_bc42353_bc42354_bc42355_highlighting

警告

成员遮蔽了可重写成员
VBWarnings::BC400005
resharper_vb_warnings_bc400005_highlighting

警告

Imports 'name' 中指定的命名空间或类型不包含任何公共成员或无法找到
VBWarnings::BC40056
resharper_vb_warnings_bc40056_highlighting

警告

命名空间应为此项目的默认命名空间
VBWarnings::WME006
resharper_vb_warnings_wme006_highlighting

警告

未访问的字段
NotAccessedField.Compiler
resharper_not_accessed_field_compiler_highlighting

警告

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

警告

对等值类型的冗余 DirectCast
VBWarnings::BC42349
resharper_vb_warnings_bc42349_highlighting

警告

将 X 转换为 Y 时可能会发生运行时错误
VBWarnings::BC42322
resharper_vb_warnings_bc42322_highlighting

警告

将 X 转换为 Y 时可能会发生运行时错误
VBWarnings::BC42016
resharper_vb_warnings_bc42016_highlighting

警告

XML 注释中的语法错误
VBWarnings::BC42304
resharper_vb_warnings_bc42304_highlighting

警告

应用于参数的 CallerArgumentExpressionAttribute 无效,因为它是自引用的
VBWarnings::BC42504
resharper_vb_warnings_bc42504_highlighting

警告

应用于参数的 CallerArgumentExpressionAttribute 无效。 它应用了无效的参数名称。
VBWarnings::BC42505
resharper_vb_warnings_bc42505_highlighting

警告

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

警告

未分配的字段
UnassignedField.Compiler
resharper_unassigned_field_compiler_highlighting

警告

未分配的 readonly 字段
UnassignedReadonlyField.Compiler
resharper_unassigned_readonly_field_compiler_highlighting

警告

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

警告

使用了已过时的成员
VBWarnings::BC40000
resharper_vb_warnings_bc40000_highlighting

警告

使用了已过时的成员(无消息)
VBWarnings::BC40008
resharper_vb_warnings_bc40008_highlighting

警告

变量在赋值前被使用
VBWarnings::BC42104
resharper_vb_warnings_bc42104_highlighting

警告

XML 注释中包含无法解析的 'cref' 属性的标签
VBWarnings::BC42309
resharper_vb_warnings_bc42309_highlighting

警告

约束违规(2 项检查)

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

检查
ID
EditorConfig 属性

默认严重性

命名不一致
InconsistentNaming
resharper_inconsistent_naming_highlighting

警告

命名空间与文件位置不对应
CheckNamespace
resharper_check_namespace_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

已禁用

语言使用机会(7 项检查)

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

检查
ID
EditorConfig 属性

默认严重性

将静态方法调用转换为扩展成员调用(将限定的静态方法调用转换为扩展成员调用)
InvokeAsExtensionMember
resharper_invoke_as_extension_member_highlighting

建议

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

提示

循环可以转换为 LINQ 表达式
LoopCanBeConvertedToQuery
resharper_loop_can_be_converted_to_query_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

提示

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

建议

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

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

检查
ID
EditorConfig 属性

默认严重性

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

警告

[ThreadStatic] 不适用于实例字段
ThreadStaticAtInstanceField
resharper_thread_static_at_instance_field_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

警告

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

警告

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

警告

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

警告

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

警告

调用 'base.Equals(...)' 是引用相等
BaseObjectEqualsIsObjectEquals
resharper_base_object_equals_is_object_equals_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

警告

类从未被实例化(非私有可访问性)
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

警告

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

警告

元素是可本地化的
LocalizableElement
resharper_localizable_element_highlighting

警告

浮点数的相等性比较
CompareOfFloatsByEqualityOperator
resharper_compare_of_floats_by_equality_operator_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

警告

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

警告

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

警告

函数从未返回
FunctionNeverReturns
resharper_function_never_returns_highlighting

警告

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

警告

迭代器从未返回
IteratorNeverReturns
resharper_iterator_never_returns_highlighting

警告

局部变量隐藏了成员
LocalVariableHidesMember
resharper_local_variable_hides_member_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

警告

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

警告

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

警告

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

警告

'out' 参数在退出时未被赋值
NotAssignedOutParameter
resharper_not_assigned_out_parameter_highlighting

警告

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

警告

参数隐藏了成员
ParameterHidesMember
resharper_parameter_hides_member_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

警告

可能的多次枚举
PossibleMultipleEnumeration
resharper_possible_multiple_enumeration_highlighting

警告

可能写入 'Me'
PossibleWriteToMe
resharper_possible_write_to_me_highlighting

警告

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

警告

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

警告

相似表达式比较
EqualExpressionComparison
resharper_equal_expression_comparison_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

警告

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

警告

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

警告

'l' 后缀容易与数字 '1' 混淆
LongLiteralEndingLowerL
resharper_long_literal_ending_lower_l_highlighting

警告

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

警告

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

建议

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

建议

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

警告

未分配的 readonly 字段
UnassignedReadonlyField
resharper_unassigned_readonly_field_highlighting

警告

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

建议

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

警告

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

警告

代码中的冗余(23 项检查)

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

检查
ID
EditorConfig 属性

默认严重性

赋值未被使用
RedundantAssignment
resharper_redundant_assignment_highlighting

警告

显式 'value' 参数声明是多余的
RedundantSetterValueParameterDeclaration
resharper_redundant_setter_value_parameter_declaration_highlighting

提示

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

警告

迭代器函数没有 'Yield' 语句
RedundantIteratorKeyword
resharper_redundant_iterator_keyword_highlighting

警告

多行 'If' 语句中的关键字 'Then' 是多余的
RedundantIfStatementThenKeyword
resharper_redundant_if_statement_then_keyword_highlighting

已禁用

无参数属性的括号是多余的
RedundantPropertyParentheses
resharper_redundant_property_parentheses_highlighting

提示

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

提示

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

警告

多余的数组下界指定
RedundantArrayLowerBoundSpecification
resharper_redundant_array_lower_bound_specification_highlighting

警告

多余的强制转换
RedundantCast
resharper_redundant_cast_highlighting

警告

多余的空 'Case Else' 语句
RedundantEmptyCaseElse
resharper_redundant_empty_case_else_highlighting

警告

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

警告

多余的 'Me.' 限定符
RedundantMeQualifier
resharper_redundant_me_qualifier_highlighting

警告

多余的 'MyBase.' 限定符
RedundantMyBaseQualifier
resharper_redundant_my_base_qualifier_highlighting

警告

多余的 'MyClass.' 限定符
RedundantMyClassQualifier
resharper_redundant_my_class_qualifier_highlighting

警告

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

警告

多余的限定符
RedundantQualifier
resharper_redundant_qualifier_highlighting

警告

移除多余的括号
RedundantParentheses
resharper_redundant_parentheses_highlighting

已禁用

不可达代码
VbUnreachableCode
resharper_vb_unreachable_code_highlighting

警告

未使用的导入子句
UnusedImportClause
resharper_unused_import_clause_highlighting

警告

使用隐式 'ByVal' 修饰符
UseImplicitByValModifier
resharper_use_implicit_by_val_modifier_highlighting

提示

使用隐式类型变量声明
UseImplicitlyTypedVariable
resharper_use_implicitly_typed_variable_highlighting

已禁用

使用隐式类型变量声明(显而易见)
UseImplicitlyTypedVariableEvident
resharper_use_implicitly_typed_variable_evident_highlighting

提示

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

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

检查
ID
EditorConfig 属性

默认严重性

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

建议

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

建议

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

警告

实体仅用于捕获其名称(私有可访问性)
EntityNameCapturedOnly.Local
resharper_entity_name_captured_only_local_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

警告

类型从未使用(非私有可访问性)
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

警告

未使用的标签
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

警告

未使用的联合用例(非私有可访问性)
UnusedUnionCase.Global
resharper_unused_union_case_global_highlighting

建议

未使用的联合用例(私有可访问性)
UnusedUnionCase.Local
resharper_unused_union_case_local_highlighting

警告

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

建议

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

建议

拼写问题(3 项检查)

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

检查
ID
EditorConfig 属性

默认严重性

注释中的拼写错误
CommentTypo
resharper_comment_typo_highlighting

建议

标识符中的拼写错误
IdentifierTypo
resharper_identifier_typo_highlighting

建议

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

建议

2026年 11月 6日