Can I dynamically jump over a line of code without recompiling in Visual Studio using breakpoints?

294 views Asked by At

I can manually skip lines of code by setting a breakpoint, moving the execution cursor and hitting continue.

Is there a way to configure Visual Studio, perhaps with a macro, such that a specific line will be skipped every time it is hit? I could do it manually, but this is highly impractical in instances where the line is hit every frame, or in a loop with a large number of elements.

An alternative is commenting out the line, rebuilding and running the code up to the point I'm testing out. Sure I could add a static boolean to control whether or not the line is executed, but it is still impractical, especially with large codebases where the rebuilding time is not trivial.

Another idea is removing the line straight in memory/disassembly, but it is still impractical, and one has to be extremely careful as the slightest error can be catastrophic.

1

There are 1 answers

1
Jack Zhai On BEST ANSWER

Code Melee - FlexPoints would be an extension which could skip multiple lines of code while debugging without editing code or manually stepping over the line.

https://marketplace.visualstudio.com/items?itemName=CodeMelee.CodeMelee-FlexPoints

Actually this feature request has been submitted before for old VS version:

https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/2221315-implement-a-new-skip-over-breakpoint-type

But product team didn't think about adding this feature in current VS version. So my suggestion is that you could use above extension tool as a workaround, or you could submit a new feature for next VS version.