SonarSource/sonar-dotnet

Fix S6964 FP: Property with a default value

Closed this issue · 1 comments

Description

S6964 is reporting an error on properties with a default value

Repro steps

public record Data
{
    public bool SomeProperty { get; init; } = false;
}

Expected behavior

The rule is not reported as the property contains a default value

Actual behavior

The rule is triggered and a warning is reported

Known workarounds

ignore the rule

Related information

  • MSBuild / dotnet version
    dotnet 8
  • SonarScanner for .NET version (if used)
    6.2.0
  • Operating System
    linux

Thank you for reporting this. Confirmed as False Positive.