Open
Description
Description
S6964 complains about under-posting when properties are not nullable and annotated with BindRequiredAttribute
.
Indicates that a property is required for model binding. When applied to a property, the model binding system requires a value for that property.
Repro steps
Use view model with property
[BindRequired] public int PasswordMinLength { get; init; }
Expected behavior
No issue reported.
Actual behavior
S6964 issue reported.
Known workarounds
Use required
keyword in addition. Needs further code changes.
Related information
- C#/VB.NET Plugins version: n/a
- Visual Studio version: 2022
- MSBuild / dotnet version: .NET 6
- SonarScanner for .NET version (if used): 5.14 (.NET Framework)
- Operating System: Windows 10