Skip to content

Commit

Permalink
Add repro for #8905
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-Pohlmann committed Mar 12, 2024
1 parent b20a5ca commit 22d1121
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2109,6 +2109,25 @@ void Foo(object o, int i)
}
}

// https://github.com/SonarSource/sonar-dotnet/issues/8905
class Repro_8905
{
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
}
}
}

// https://github.com/SonarSource/sonar-dotnet/issues/8907
// https://github.com/SonarSource/sonar-dotnet/issues/8908
class Repro_8907_8908
Expand Down

0 comments on commit 22d1121

Please sign in to comment.