Valentijn
(Valentijn Makkenze)
1
Hi,
The following code gives a warning for the if-statement but is does print 5 and 10
- S2583 - Conditionally executed code should be reachable
[Test]
public void TestRuleS2583()
{
var ids = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
var i = 0;
foreach (var id in ids)
{
if (++i % 5 == 0)
{
System.Diagnostics.Debug.WriteLine(i);
}
}
}
Environment:
- Visual Studio 17.8.0
- SonarLint 7.4.0
Kind regards,
Valentijn
Hi @Valentijn and thanks for the report! This is a known limitation of the analyzer. We will improve it in the future. The issue is tracked here: