Skip to content

NET-1869 Fix S4275 FP: when field in property is set through a method #5259

Open
@mary-georgiou-sonarsource

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    False PositiveRule IS triggered when it shouldn't be.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions