Mohsen Sarkar
Mohsen Sarkar

Reputation: 6040

How to force debugger to skip a piece of code?

There is huge amount of code in my project which already debugged 50% of it.
Every time I try to debug it I have to manually set breakpoints after unwanted piece of code to skip it.
Is there a way to tell debugger not to debug that part of code ? Any extension for this ?

Let's face debugger is on line 1500.

Method1(){
   Line 1500 CODE
   Line 1501 CODE
   ...
   Line 1726 CODE
   Line 1727 CODE
   ...
   Line 2200 CODE
}

I won't need to debug lines between 1727 and 2200.

NOTE : It's not just one piece. Otherwise I would be fine with manual breakpoints

Upvotes: 8

Views: 26753

Answers (3)

live-love
live-love

Reputation: 52494

You can also click on the line you want to skip to and hit Ctrl+F10 (Run to Cursor). It will jump directly to that line.

Upvotes: 0

Pawcio
Pawcio

Reputation: 490

Don't know why it's not in the answer but you can set next statement by CTRL+SHIFT+F10 or dragging the yellow arrow to wanted line and code before next statement will not be executed.

Found it here

Upvotes: 28

Oded
Oded

Reputation: 499352

If the code in question is encapsulated in a method, you can skip the method by applying the DebuggerStepThroughAttribute on it.

Other than that, setting breakpoints is how to do it.

So, extract this code into a method and apply the attribute to it ;)

Upvotes: 21

Related Questions