I'm having severe difficulties debugging my code because Visual Studio is breaking in locations that do not match my breakpoints. Often this looks like VS just zipping right past my breakpoints, in other cases (as pictured), we hit the breakpoint but the call stack shows that we are not in the location marked in the source.
Referring to the picture, note:
- The breakpoint is at the top of the function addIcon(...) as indicated by the yellow highlight and arrow. That is the location I want the breakpoint.
- The call stack shows that the function urlHtml(...) is actually executing. That function can be seen in the source window and precedes addIcon(...)
- The "Locals" window shows variables from the urlHtml function, not the variables from the function with the breakpoint, addIcon()
Not visible:
4) Single stepping forward visually looks like it's jumping lines in addIcon(), sometimes moving 2-3 lines at a step; likely due to the differences in command length at a machine code level. Continuing to single-step will "exit" the addIcon() function midway through the source, as the source does not contain the commands being executed.
5) When addIcon() executes, no breakpoint is hit -- it just runs, incorrectly, because that's where the bug I need to fix is located.
I have cleaned & rebuilt the solution. Exited & restarted Visual Studio. Changed browsers (Edge & Chrome, IE not supported). Even rebooted the machine, but no luck.