Weird debug step behaviour

Today I’ve noticed some weird debug step behaviour in a project that confused the hell out of me. (Windows)

In 2014R2.1 stepping through the code went like this:

This is corrent, my file is not EOF, so it steps in the while loop

In 2015R1 (and some previous versions I could test), stepping through the code goes like this:

My first reaction when it jumps to the ‘wend’ was 'there is something wrong with my testfile, because it’s EOF. I checked the file, and it wasn’t. Only when I pressed step In again, it wend into the loop.

In the example I show here it is not that confusing, but in my real project it jumped hundreds of lines of code before entering the loop. In my view, the old behaviour was the correct way. Is this a bug or by design? If by design, I would love to hear the reason because this is no intuitive behaviour.

[quote=168544:@Alain Bailleul]Today I’ve noticed some weird debug step behaviour in a project that confused the hell out of me. (Windows)

In 2014R2.1 stepping through the code went like this:

This is corrent, my file is not EOF, so it steps in the while loop

In 2015R1 (and some previous versions I could test), stepping through the code goes like this:

My first reaction when it jumps to the ‘wend’ was 'there is something wrong with my testfile, because it’s EOF. I checked the file, and it wasn’t. Only when I pressed step In again, it wend into the loop.

In the example I show here it is not that confusing, but in my real project it jumped hundreds of lines of code before entering the loop. In my view, the old behaviour was the correct way. Is this a bug or by design? If by design, I would love to hear the reason because this is no intuitive behaviour.[/quote]

This was discussed in a thread one or two weeks ago. I did not want to believe it until I did just like you.

It does not change a bit the way code is executed, but it is indeed a little bizarre.

Maybe it is needed to evaluate the terms of the while the first time around ?

https://forum.xojo.com/19544-while-not-executing

Thanks for the link @Michel Bujardet!. I’ve missed that topic. Will be an interesting read… :slight_smile:

I think that a While/Wend loop tests for whether or not the loop should be executed at the Wend statement hence it jumps to the wend and then, if it is okay to continue the loop, jumps back to the line after the While. At least that is the way that I recall things executing. Yes, you have the condition at the While line, but the actual testing is done at the end and hence what appears to be a weird processing when viewed visually. However, I dang sure ain’t gonna bet my retirement check on this answer.