Code Inspections in XAML
In XAML, ReSharper 2020.2 provides two kinds of code inspections: 4 inspections that detect errors such as broken syntax, unresolved symbols, compiler errors, and so on (you cannot configure or disable any of these inspections), and 62 proprietary code inspections, any of which you can disable or change its severity level.
These code inspections help you detect code issues in design time in all open files, and additionally they allow you to find code issues in specific scope.
Configurable XAML inspections are listed below, grouped by their categories.
Code Notification (17 inspections)
This category groups code inspections with minor severity levels. Inspection ID EditorConfig property | Default severity |
---|---|
{DynamicResource} can only be used with dependency propertyXaml.DynamicResourceError resharper_xaml_dynamic_resource_error_highlighting | Error |
Constructor not resolvedXaml.ConstructorWarning resharper_xaml_constructor_warning_highlighting | Warning |
Decimal numbers parsed depending on current machine cultureXaml.DecimalParsingIsCultureDependent resharper_xaml_decimal_parsing_is_culture_dependent_highlighting | Warning |
Dependency property descriptor field missingXaml.DependencyPropertyResolveError resharper_xaml_dependency_property_resolve_error_highlighting | Warning |
Element name reference not resolvedXaml.ElementNameReferenceNotResolved resharper_xaml_element_name_reference_not_resolved_highlighting | Error |
Ignored pathXaml.IgnoredPathHighlighting resharper_xaml_ignored_path_highlighting_highlighting | Disabled |
Mapped pathXaml.MappedPathHighlighting resharper_xaml_mapped_path_highlighting_highlighting | Hint |
Member of invalid typeXaml.InvalidMemberType resharper_xaml_invalid_member_type_highlighting | Error |
Method arguments will be replaced by event's arguments in generated codeXaml.MethodArgumentsWillBeIgnored resharper_xaml_method_arguments_will_be_ignored_highlighting | Warning |
Multiple overloads with the same arguments count foundXaml.OverloadsCollision resharper_xaml_overloads_collision_highlighting | Warning |
Object/markup extension of invalid typeXaml.InvalidType resharper_xaml_invalid_type_highlighting | Error |
Routed event descriptor field missingXaml.RoutedEventResolveError resharper_xaml_routed_event_resolve_error_highlighting | Warning |
Static resource not resolvedXaml.StaticResourceNotResolved resharper_xaml_static_resource_not_resolved_highlighting | Warning |
Unresolved binding path when DataContext is knownXaml.BindingWithContextNotResolved resharper_xaml_binding_with_context_not_resolved_highlighting | Warning |
Unresolved binding path when DataContext is unknownXaml.BindingWithoutContextNotResolved resharper_xaml_binding_without_context_not_resolved_highlighting | Hint |
XAML resource of invalid typeXaml.InvalidResourceType resharper_xaml_invalid_resource_type_highlighting | Error |
XAML style of invalid target typeXaml.InvalidResourceTargetType resharper_xaml_invalid_resource_target_type_highlighting | Error |
Common Practices and Code Improvements (3 inspections)
This category groups inspections that hunt for medium severity issues that mainly affect code readability. Inspection ID EditorConfig property | Default severity |
---|---|
Member can be made private (non-private accessibility)MemberCanBePrivate.Global resharper_member_can_be_private_global_highlighting | Suggestion |
Member can be made protected (non-private accessibility)MemberCanBeProtected.Global resharper_member_can_be_protected_global_highlighting | Suggestion |
Member or type can be made internal(friend)MemberCanBeInternal resharper_member_can_be_internal_highlighting | Disabled |
Compiler Warnings (2 inspections)
Inspections in this category detect compiler warnings before you compile. Inspection ID EditorConfig property | Default severity |
---|---|
Use of obsolete type or type memberObsoleteElement resharper_obsolete_element_highlighting | Warning |
Use of obsolete type or type member (error)ObsoleteElementError resharper_obsolete_element_error_highlighting | Error |
Constraints Violations (2 inspections)
This category includes code inspections, mostly with the warning severity level, which detect violations related to symbol attributes, including ReSharper's code annotations, and other similar issues. Inspection ID EditorConfig property | Default severity |
---|---|
Inconsistent NamingInconsistentNaming resharper_inconsistent_naming_highlighting | Warning |
Possible 'null' assignment to non-nullable entityXaml.AssignNullToNotNullAttribute resharper_xaml_assign_null_to_not_null_attribute_highlighting | Warning |
Potential Code Quality Issues (17 inspections)
This category includes inspections that detect critical issues (code smells), mostly with Error or Warning level. This category also includes inspections that ensure localization assistance. Inspection ID EditorConfig property | Default severity |
---|---|
DeviceFamily-specific view type name does not match generic type nameXaml.XamlMismatchedDeviceFamilyViewClrNameHighlighting resharper_xaml_xaml_mismatched_device_family_view_clr_name_highlighting_highlighting | Warning |
Duplicate device family viewXaml.XamlDuplicateDeviceFamilyTypeViewHighlighting resharper_xaml_xaml_duplicate_device_family_type_view_highlighting_highlighting | Error |
Duplicate style property/event setterXaml.DuplicateStyleSetter resharper_xaml_duplicate_style_setter_highlighting | Warning |
Grid element column/row index is out of grid definition rangeXaml.IndexOutOfGridDefinition resharper_xaml_index_out_of_grid_definition_highlighting | Warning |
Missing grid column/row setter for non-first childXaml.MissingGridIndex resharper_xaml_missing_grid_index_highlighting | Warning |
Non-accessed field (non-private accessibility)NotAccessedField.Global resharper_not_accessed_field_global_highlighting | Suggestion |
Non-accessed field (private accessibility)NotAccessedField.Local resharper_not_accessed_field_local_highlighting | Warning |
Path errorXaml.PathError resharper_xaml_path_error_highlighting | Warning |
Possible 'System.NullReferenceException'Xaml.PossibleNullReferenceException resharper_xaml_possible_null_reference_exception_highlighting | Warning |
RelativeSourceMode is not set explicitlyXaml.XamlRelativeSourceDefaultModeWarningHighlighting resharper_xaml_xaml_relative_source_default_mode_warning_highlighting_highlighting | Warning |
Resource cannot be accessed by class name because of x:Key attributeXaml.RedundantXamarinFormsClassDeclaration resharper_xaml_redundant_xamarin_forms_class_declaration_highlighting | Warning |
Style target type is not convertible to base typeXaml.StyleInvalidTargetType resharper_xaml_style_invalid_target_type_highlighting | Error |
Types in x:DataType and BindingContext mismatchXaml.XamlXamarinFormsDataTypeAndBindingContextTypeMismatchedHighlighting resharper_xaml_xaml_xamarin_forms_data_type_and_binding_context_type_mismatched_highlighting_highlighting | Warning |
Unexpected text token errorXaml.UnexpectedTextToken resharper_xaml_unexpected_text_token_highlighting | Error |
Unknown DeviceFamilyXaml.XamlUnknownDeviceFamilyTypeHighlighting resharper_xaml_xaml_unknown_device_family_type_highlighting_highlighting | Warning |
x:Key is allowed for resources and dictionary elements onlyXaml.XKeyAttributeDisallowed resharper_xaml_x_key_attribute_disallowed_highlighting | Error |
XAML language level errorXaml.LanguageLevel resharper_xaml_language_level_highlighting | Error |
Redundancies in Code (13 inspections)
Code inspections in this category look for redundancies and dead code, which affect code readability and style, and could be safely removed. Some code redundancies cannot be fixed automatically, and quick-fixes for them are performed in the interactive mode, requiring the user input. But the majority of the redundancies can be fixed without user interaction, using either fix in scope or code cleanup. Inspection ID EditorConfig property | Default severity |
---|---|
Binding mode is equal to defaultXaml.RedundantBindingModeAttribute resharper_xaml_redundant_binding_mode_attribute_highlighting | Warning |
Property value is equal to style-providedXaml.RedundantStyledValue resharper_xaml_redundant_styled_value_highlighting | Warning |
Redundant empty collection property setterXaml.RedundantCollectionProperty resharper_xaml_redundant_collection_property_highlighting | Warning |
Redundant 'Freeze' attributeXaml.RedundantFreezeAttribute resharper_xaml_redundant_freeze_attribute_highlighting | Warning |
Redundant modifiers attributeXaml.RedundantModifiersAttribute resharper_xaml_redundant_modifiers_attribute_highlighting | Warning |
Redundant name attributeXaml.RedundantNameAttribute resharper_xaml_redundant_name_attribute_highlighting | Warning |
Redundant namespace aliasXaml.RedundantNamespaceAlias resharper_xaml_redundant_namespace_alias_highlighting | Warning |
Redundant property type qualifierXaml.RedundantPropertyTypeQualifier resharper_xaml_redundant_property_type_qualifier_highlighting | Warning |
Redundant resourceXaml.RedundantResource resharper_xaml_redundant_resource_highlighting | Warning |
Remove redundant attached property setterXaml.RedundantAttachedProperty resharper_xaml_redundant_attached_property_highlighting | Warning |
Single grid row/column definition is redundantXaml.RedundantGridDefinitions resharper_xaml_redundant_grid_definitions_highlighting | Warning |
Single-cell grid column/row span is redundantXaml.RedundantGridSpan resharper_xaml_redundant_grid_span_highlighting | Warning |
UpdateSourceTrigger=Default is redundantXaml.RedundantUpdateSourceTriggerAttribute resharper_xaml_redundant_update_source_trigger_attribute_highlighting | Warning |
Redundancies in Symbol Declarations (4 inspections)
This category includes code inspections, mostly with the warning severity level, which detect empty and unused symbol declarations. Inspection ID EditorConfig property | Default severity |
---|---|
Type is never used (non-private accessibility)UnusedType.Global resharper_unused_type_global_highlighting | Suggestion |
Type is never used (private accessibility)UnusedType.Local resharper_unused_type_local_highlighting | Warning |
Type member is never used (non-private accessibility)UnusedMember.Global resharper_unused_member_global_highlighting | Suggestion |
Type member is never used (private accessibility)UnusedMember.Local resharper_unused_member_local_highlighting | Warning |
Spelling issues (4 inspections)
These inspections detect typos in various contexts. Inspection ID EditorConfig property | Default severity |
---|---|
Typo in commentCommentTypo resharper_comment_typo_highlighting | Suggestion |
Typo in identifierIdentifierTypo resharper_identifier_typo_highlighting | Suggestion |
Typo in markup attribute valueMarkupAttributeTypo resharper_markup_attribute_typo_highlighting | Suggestion |
Typo in markup textMarkupTextTypo resharper_markup_text_typo_highlighting | Suggestion |