-
Notifications
You must be signed in to change notification settings - Fork 223
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
Fix S6964 FN: Rule should raise in case of value type property annotated with RequiredAttribute #9263
Comments
Hello @hugoqribeiro, From my point of view, this is not a false positive, but I might be missing some context regarding your code base. |
I see your point if you think of [Required] as metadata. In my opinion, [Required] is foremost for validation and there is no way to implement [Required] on value type properties (as there will always be a value)... That's why people don't annotate these properties with [Required]. |
@hugoqribeiro I checked the rule implementation and you are right. The rule should ask for I will add this ticket to our backlog, and we'll handle it soon as we are working now on hardening the new ASP.NET rules. Thanks a lot for taking the time to report this and the other issues! |
JsonRequired
JsonRequired
Description
S6964 is reporting an error on value type model properties.
Repro steps
Here is a value type model property that is triggering the rule:
Expected behavior
The rule should not be trigger for value type properties.
Actual behavior
See above.
Known workarounds
None.
Related information
The text was updated successfully, but these errors were encountered: