Debugging - skip code with breakpoint

Do you know how you can click the yellow arrow on a breakpoint and drag it down to skip code lines? Well, is it possible to create a “When Hit” macro (or something similar) that skips the execution of a line containing a breakpoint?

So, instead of writing code like

if(!Debugging)
   Response.Redirect("LoginFail.aspx");

I could set a breakpoint on the line Response.Redirect()and "When Hit" will skip it.

+5
source share
5 answers

, . "When hit" . , , . , Debugger.SetNextStatement.

:

Public Sub SkipNextLine()
    ActiveDocument().Selection.LineDown()
    DTE.ExecuteCommand("Debug.SetNextStatement")
End Sub
+6

, ,

#if (DEBUG)
//this code is skipped in debug mode
#endif
0

Try:

#if DEBUG
Response.Redirect("LoginFail.aspx");
#endif

, DEBUG .

0

, , .

  • , , EIP , Watch "@eip".
  • , . , , - . {@eip = address}, 1.

. fooobar.com/questions/327579/...

0

Accept the use of compiler directives or any other that requires adding logic to the code. However, it is also understood that editing debugged code is not always an option (for example, not owning the code may mean that it does not have all the resources necessary to create it).

If this is your business, I'm afraid that writing your own macro or waiting for VS to have one built-in equivalent will be your only options.

0
source

All Articles