Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tim-Pohlmann opened this issue Mar 12, 2024 · 0 comments · Fixed by #9030
Closed

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

Tim-Pohlmann opened this issue Mar 12, 2024 · 0 comments · Fixed by #9030
Assignees
Labels
Area: C# C# rules related issues. Area: CFG/SE CFG and SE related issues. Area: VB.NET VB.NET rules related issues. Sprint: Hardening Fix FPs/FNs/improvements Type: CFG/SE FPs Rule IS triggered when it shouldn't be for CFG and SE rules.
Projects
Milestone

Comments

@Tim-Pohlmann
Copy link
Contributor

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.

Tim-Pohlmann added a commit that referenced this issue Mar 12, 2024
@Tim-Pohlmann Tim-Pohlmann added Area: CFG/SE CFG and SE related issues. Area: VB.NET VB.NET rules related issues. Area: C# C# rules related issues. Type: CFG/SE FPs Rule IS triggered when it shouldn't be for CFG and SE rules. labels Mar 12, 2024
Tim-Pohlmann added a commit that referenced this issue Mar 12, 2024
Tim-Pohlmann added a commit that referenced this issue Mar 13, 2024
@Tim-Pohlmann Tim-Pohlmann added this to the 9.24 milestone Apr 8, 2024
@Tim-Pohlmann Tim-Pohlmann self-assigned this Apr 8, 2024
@Tim-Pohlmann Tim-Pohlmann added the Sprint: Hardening Fix FPs/FNs/improvements label Apr 8, 2024
@Tim-Pohlmann Tim-Pohlmann added this to To do in Best Kanban Apr 8, 2024
@Tim-Pohlmann Tim-Pohlmann moved this from To do to In progress in Best Kanban Apr 9, 2024
@github-actions github-actions bot moved this from In progress to Review in progress in Best Kanban Apr 9, 2024
@github-actions github-actions bot moved this from Review in progress to Review approved in Best Kanban Apr 9, 2024
Best Kanban automation moved this from Review approved to Validate Peach Apr 9, 2024
@Tim-Pohlmann Tim-Pohlmann moved this from Validate Peach to Done in Best Kanban Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Area: CFG/SE CFG and SE related issues. Area: VB.NET VB.NET rules related issues. Sprint: Hardening Fix FPs/FNs/improvements Type: CFG/SE FPs Rule IS triggered when it shouldn't be for CFG and SE rules.
Projects
Best Kanban
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants