[bug]: Invert 'If' in VB changes behaviour of method

I've identified an issue with inverting an 'if' statement in VB. If I convert the code to C#, the problem isn't there. This has been tested with Resharper 4.5 and an overnight build of 5 from a few days ago.

The code is attached. If you invert the 'if' on the line 'If key Then' (line 6) then it returns early and fails to run the final line of code from the sub.

This code is distilled down from a rather large function we were trying to refactor and it is worrying that this sort of bug is introduced into the code.

I've attached what the code looks like after ReSharper has 'inverted' the if on my machine.

Class1 - After ReSharper.vb.zip

Please sign in to leave a comment.