Description
openedon Oct 14, 2023
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Also raised:
- BL0007 "Component parameters should be auto property" too broad #45793
- BL0007: Component parameters should be auto property ignores .editoronfig on linux razor#7261
I was confused because the hint that something can be made an auto property usually only happens if there is no logic in the get/set. That isn't the case here, and it turns out that is by design.
The comment here by @SteveSandersonMS explains why this rule exists and what the right pattern is for apps that want logic to run on parameter change. However, the message given to the developer doesn't have any of this useful information. The code analysis text needs to be more descriptive and have a link to documentation that shows the right pattern.
The code analysis warning shouldn't require googling to figure out why it happened and how to fix it.
There are lots of comments and upvotes of developers running into this warning here.
Expected Behavior
More detail. A link to documentation with the right pattern.
Steps To Reproduce
[Parameter, EditorRequired]
public required List<DimensionScope> MatchedDimensions
{
get => _matchedDimensions;
set
{
if (_matchedDimensions != value)
{
_matchedDimensions = value;
_dimensionsOrDurationChanged = true;
}
}
}
Exceptions (if any)
No response
.NET Version
.NET 8
Anything else?
No response