-
Notifications
You must be signed in to change notification settings - Fork 231
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
Rule S2259 FP: symbolic execution does not enter the for
loop
#890
Labels
Area: C#
C# rules related issues.
Area: CFG/SE
CFG and SE related issues.
Type: CFG/SE FPs
Rule IS triggered when it shouldn't be for CFG and SE rules.
Milestone
Comments
same for DisjointForest<TModel> forest = null;
try
{
forest = DisjointForest<TModel>.Create(models);
}
catch (ArgumentException ex) when (ex.Message.Contains("sss", StringComparison.OrdinalIgnoreCase))
{
return result;
}
foreach (var item in Filter<TItem, TModel>(items))
{
var count = forest.Leaves.Count();
} |
This is because our Symbolic Execution engine thinks the code will never enter the loop.
|
andrei-epure-sonarsource
added a commit
that referenced
this issue
Aug 8, 2019
andrei-epure-sonarsource
added a commit
that referenced
this issue
Aug 8, 2019
for
loop symbolic execution
for
loop symbolic executionfor
symbolic execution does not enter the loop
for
symbolic execution does not enter the loopfor
symbolic execution does not enter the for
loop
for
symbolic execution does not enter the for
loopfor
loop
related to #2528 |
martin-strecker-sonarsource
added a commit
that referenced
this issue
Sep 27, 2022
martin-strecker-sonarsource
added a commit
that referenced
this issue
Sep 30, 2022
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.
Type: CFG/SE FPs
Rule IS triggered when it shouldn't be for CFG and SE rules.
Description
The following code snippet seems to trigger a false positive S2259
'lastEx' is null on at least one execution path.
on the last line with the throw statement:When the for loop is removed S2259 is not raised on the last line.
Expected behavior
No S2259 raised on the last line as either the code has returned or the lastEx value has been set.
Actual behavior
Rule S2259 is raised both using the scanner for MSBuild as well as using SonarLint.
Related information
The text was updated successfully, but these errors were encountered: