Skip to content

Fix S2259 FP: PropertyReference does not learn from underlying symbol #8905

@Tim-Pohlmann

Description

@Tim-Pohlmann
public string Value { get; private set; }
private void Foo()
{
    string value = null;
    if (Value != null)                      // Branching on Value
    {
        value = "";
    }

    if (Value != null)                      // Both branches enter here because PropertyReference is not learning from TrackedSymbol
    {
        Console.WriteLine(value.Length);    // Noncompliant FP
    }
}

How to fix:
PropertyReference processor needs similar logic to FieldReference processor.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions