-
Notifications
You must be signed in to change notification settings - Fork 469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CA1801 false positive on record with property-targeting attribute on parameter #4397
Comments
They are available in CLI. Please see https://docs.microsoft.com/dotnet/fundamentals/code-analysis/overview#code-style-analysis |
How can we be alerted when this is released ? It's included in roslyn-analyzers 5.0.3, but .NET SDK 5.0.201 (most recent) ships with version 5.0.2 of roslyn-analyzers. |
this is not going to be ported to the 5.0.2xx SDKs but will appear in 5.0.3xx |
I'm still having this issue in 5.0.203 |
Having this issue on 5.0.400, which is strange considering it was going to be included in 5.0.3xx? |
Also having this on records with default parameters, 5.0.400 |
Workaround: to
Very verbose and hope this false positive will be fixed so think it is better to suppress for now. |
@dlouwers I think that using that way is much simplier #pragma warning disable CA1801
public sealed record AuthProfileImageUrls(
[property: JsonPropertyName("px_16x16")] Uri PixelSize16,
[property: JsonPropertyName("px_50x50")] Uri PixelSize50,
[property: JsonPropertyName("px_170x170")] Uri PixelSize170); |
Analyzer
Diagnostic ID: CA1801:
Review unused parameters
Analyzer source
SDK: Built-in CA analyzers in .NET 5 SDK or later
Version: SDK 5.0.100-rc.2
Describe the bug
If any of the parameters have a
[property:
attribute, then CA1801 will fire on all parameters.Additional context
I wonder the relationship between CA1801 and IDE0060. IDE0060 used to fire a false positive on this, but get fixed later. Once IDExxxx analyzers are available in CLI builds, I will consider to use IDE0060 to replace CA1801.
The text was updated successfully, but these errors were encountered: