"Loop control variable never changed" false-positive with a delegate

Answered

When calling a Func<bool> in a while loop, R# gives the false-positive message "Loop control variable is never changed inside loop".

Simplified example:

Func<bool> fn = () => DateTime.Now.Hour < 23;
while (fn()) // <-- Warning message on this line
{
    ...
}

JetBrains ReSharper Ultimate 2016.1.1  Build 105.0.20160504.101434
ReSharper 2016.1.20160504.103028
Visual Studio 14.0.25123.0
Windows 10 x64 (Build 10586.318)

0
3 comments
Official comment

Hello Richard,

There is the same issue in YouTrack https://youtrack.jetbrains.com/issue/RSRP-429291. The fix will be available in R# 2016.2

Thanks!  

Thanks. The issue says "Fix version: 2016.1" - I assume that's a typo?

0

Please sign in to leave a comment.