Code Inspections in XAML
In XAML, ReSharper 2021.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 69 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 (24 inspections)
This category groups code inspections with minor severity levels.
Inspection | |
---|---|
{DynamicResource} can only be used with dependency property | |
Constructor not resolved | |
Decimal numbers parsed depending on current machine culture | |
Dependency property descriptor field missing | |
Element name reference not resolved | |
Grid columns/rows definitions can be converted to attribute | |
Grid length definition should not be empty | |
Ignored path | |
Mapped path | |
Member of invalid type | |
Method arguments will be replaced by event's arguments in generated code | |
Multiple overloads with same arguments count found | |
Object/markup extension of invalid type | |
Parent is outside the current component tree | |
Path to resource is case-sensitive | |
Routed event descriptor field missing | |
Static resource not resolved | |
Style class not found | |
Unresolved binding path when DataContext is known | |
Unresolved binding path when DataContext is unknown | |
Using stream binding operator in TwoWay or OneWayToSource binding modes | |
x:DataType not specified for CompiledBinding | |
XAML resource of invalid type | |
XAML style of invalid target type |
Common Practices and Code Improvements (3 inspections)
This category groups inspections that hunt for medium severity issues that mainly affect code readability.
Inspection | |
---|---|
Member can be made private (non-private accessibility) | |
Member can be made protected (non-private accessibility) | |
Member or type can be made internal(friend) |
Compiler Warnings (2 inspections)
Inspections in this category detect compiler warnings before you compile.
Inspection | |
---|---|
Use of obsolete type or type member | |
Use of obsolete type or type member (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 | |
---|---|
| |
Possible 'null' assignment to non-nullable entity |
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 | |
---|---|
DeviceFamily-specific view type name does not match generic type name | |
Duplicate device family view | |
Duplicate style property/event setter | |
Grid element column/row index is out of grid definition range | |
Missing grid column/row setter for non-first child | |
Non-accessed field (non-private accessibility) | |
Non-accessed field (private accessibility) | |
Path error | |
Possible 'null' value in the path of binding without fallback value | |
RelativeSourceMode is not set explicitly | |
Resource cannot be accessed by class name because of x:Key attribute | |
Style target type is not convertible to base type | |
Types in x:DataType and BindingContext mismatch | |
Unexpected text token error | |
Unknown DeviceFamily | |
x:Key is allowed for resources and dictionary elements only | |
XAML language level 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 | |
---|---|
Binding mode is equal to default | |
Property value is equal to style-provided | |
Redundant empty collection property setter | |
Redundant 'Freeze' attribute | |
Redundant modifiers attribute | |
Redundant name attribute | |
Redundant namespace alias | |
Redundant property type qualifier | |
Redundant resource | |
Remove redundant attached property setter | |
Single grid row/column definition is redundant | |
Single-cell grid column/row span is redundant | |
UpdateSourceTrigger=Default is redundant |
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 | |
---|---|
Type is never used (non-private accessibility) | |
Type is never used (private accessibility) | |
Type member is never used (non-private accessibility) | |
Type member is never used (private accessibility) |
Spelling issues (4 inspections)
These inspections detect typos in various contexts.
Inspection | |
---|---|
| |
| |
Typo in markup attribute value | |
|