[RESOLVED] Failure to Debug
In a dynamically loaded dll I have this little snippet of code:
Code:
If trts.Length > 1 Then
mErrors.AddString("Something here")
End If
In this case, trts.Length is 1. That's all it should be, and by looking at the value in trts it is 1, and the value of trts.Length = 1, and trts.Length > 1 is False. However, if I put a breakpoint on the If statement, code execution goes to the mErrors.AddString....or maybe it doesn't.
If the mErrors.AddString were actually executed, then a string would be added to mErrors, which would raise an event that is caught elsewhere. That event is clearly not caught, so it appears not to be raised, which suggests that the mErrors.AddString never happens.
Also, the line immediately after the If block is not reached, nor does it appear to be reachable, because if I attempt to put a breakpoint on the line immediately after the If block, VS pauses for a second then reports that it was unable to bind a breakpoint at that point.
Interestingly, while the debugger steps into the If block (even though it should not), then the next step is out of the method entirely and back to the caller, the code after the If block is being called. That code builds a string that ends up in a tooltip, and since the tooltip is (mostly) right, the code must be getting called.
So, debugging is going the wrong way at a condition, then skipping over the rest of the method, but execution is NOT going the wrong way at the condition and is NOT skipping over the rest of the method. The debugger is just doing the wrong thing.
This was an issue with VB6, but I have never before seen it in VS. I have a few more tests to perform to study the situation in greater detail, so I suppose this is more or less just a rant, but if anybody has anything to say on the topic, or tests I could try, I'd like to hear about them.
Re: [RESOLVED] Failure to Debug
Hey shaggy, happy new year and all. Hope you are all good.
I recently have been having lots of bizarre debugging issues with 2019 and was putting it down to a new released version of resharper that messed up my install to which jetbrains logged the bug but now not so sure. This might not be related or even close but very much so am getting skipped breakpoints and also points stopped on that should not even be reached regardless of debug or released.
I put it down initially to all the medication I am on but maybe I cant so much now after seeing your issues.
Re: [RESOLVED] Failure to Debug
Yeah, I was seeing some very strange code stepping, but that option I mentioned is an interesting one to look into. The documentation on it from MS says up front that if you don't have that one checked, the debugger can do some bizarre and unpredictable things. I'm a bit surprised that it defaults to unchecked.