Have you ever faced to the problem during debugging in Visual Studio, that you find a problem in a code block, and would like to avoid this code without altering the code and rebuilding / restarting the application? In this case you need to set the next statement to a specific line of code using the context menu (see below).
It is trivial when you need to do it just a few time, but it can be rather tedious, if not impossible, if you are – for example – in a loop processing several hundreds of items, and should do it for each items.
Fortunately, it is easy to achieve this goal using Visual Studio macros. The following method – defined in a module called in this example DebugHelpers – jumps to the next bookmark, and sets the next statement to that position.
Having this method, all you need to do is to set a new breakpoint with When Hit… option at the line of code you want to jump from,
and set the GoToNextBookmark method in the Run a macro list:
Then mark the target of the jump with a bookmark, and you are ready.