From 75a5dd14c750202866a3e438a15817b82d93cf80 Mon Sep 17 00:00:00 2001 From: mary-georgiou-sonarsource Date: Fri, 17 May 2024 15:18:16 +0200 Subject: [PATCH] repro for required modifier --- .../TestCases/AspNet/AvoidUnderPosting.CSharp12.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/analyzers/tests/SonarAnalyzer.Test/TestCases/AspNet/AvoidUnderPosting.CSharp12.cs b/analyzers/tests/SonarAnalyzer.Test/TestCases/AspNet/AvoidUnderPosting.CSharp12.cs index 9c62ce52152..25e36496c12 100644 --- a/analyzers/tests/SonarAnalyzer.Test/TestCases/AspNet/AvoidUnderPosting.CSharp12.cs +++ b/analyzers/tests/SonarAnalyzer.Test/TestCases/AspNet/AvoidUnderPosting.CSharp12.cs @@ -33,8 +33,10 @@ public class Model [Custom] // Noncompliant repro for https://github.com/SonarSource/sonar-dotnet/issues/9282 public int ValuePropertyAnnotatedWithCustomAttribute { get; set; } - [JsonRequired] // Noncompliant - FP because the attribute is annotated with JsonRequiredAttribute + [JsonRequired] // Noncompliant - FP because the property is annotated with JsonRequiredAttribute public int AnotherValueProperty { get; set; } + + public required int RequiredProperty { get; set; } // Noncompliant - FP because the property has the required modifier } public class DerivedFromController : Controller