SonarSource / SonarSource/sonar-dotnet
NET-1869 Fix S4275 FP: when field in property is set through a method
Open
Nobody has claimed this yet.
False Positive
- Dominant language
- C#
- Stars
- 918
- Forks
- 244
- PR merge metrics
- No merged PRs in 30d
Description
Description
FP is raised by S4275 when the field in a property is set through a method.
sonar-dotnet version: 8.33
Repro steps
C#:
private int[] attributes;
public int[] Attributes
{
set { value.CopyTo(attributes, 0); } // Noncompliant - FP
}
VB.NET:
Private attributes_ As Integer()
Public WriteOnly Property Attributes As Integer()
Set(ByVal value As Integer()) ' Noncompliant - FP
value.CopyTo(attributes_, 0)
End Set
End Property
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the S4275 finding with the supplied C# and VB.NET property-setter examples, then trace the S4275 analyzer entry point in sonar-dotnet. Done means these setters no longer report a finding while the rule continues to detect genuine issues.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100