Fix S6964 FP: Don't raise on properties annotated with the JsonRequiredAttribute
Closed this issue · 1 comments
Hoffs commented
Description
S6964 complains about "under-posting" when fields are not nullable, even though JsonRequired is specifically intended to avoid this issue.
Repro steps
public record MyRequestDto([property: JsonRequired] decimal Amount)
Expected behavior
No issue reported.
Actual behavior
S6964 issue reported.
Known workarounds
Please provide a description of any known workarounds.
Related information
- C#/VB.NET Plugins version SonarScanner 5.0.1.3006
- Visual Studio version N/A
- MSBuild / dotnet version - MSBuild 6.2, dotnet 8
- SonarScanner for .NET version (if used) dotnet-sonarscanner/6.2.0
- Operating System Linux 5.10.184-175.731.amzn2.x86_64 amd64
mary-georgiou-sonarsource commented
Hello, @Hoffs!
I confirm this is a false positive and I'll add it to our backlog.
Thanks for reporting it.