Heuristic Unreachable code


I have a lot of "heuristic unreachable code" which can be reached.

Its quite easy to reproduce.

On KeyPress a variable is set (Lets call it abort)

if (abort)

 if (abort)
   return; //>- yup. Resharper detects this as unreachable. However if the key is pressed during the first long running thing it stops definitly

How can such false detection be avoided?

Please sign in to leave a comment.