views:

196

answers:

2

When debugging, a trick I do whenever I want to exit the current method without running of its any statements, I move the current execution pointer to the end of the method, then click F10/11.

Is there a keyboard shortcut (or can I program one) to accomplish this?

(I don't mean shift-F11 (step out) - that does run all the code until the method's end, which I do not want).

A: 

AFAIK that's the only way to do it.

IainMH
+2  A: 

The following sequence of keystrokes works for me (tested in Visual Studio 2008); I was able to record them as a temporary macro and play them back successfully:

  1. Ctrl+M, Ctrl+M (Edit.ToggleOutliningExpansion: collapses the current method)
  2. Right arrow (skips past the collapsed parameter list)
  3. Ctrl+] (Edit.GotoBrace: goes to the opening brace)
  4. Ctrl+] (Edit.GotoBrace: goes to the closing brace)
  5. Ctrl+Shift+F10 (Debug.SetNextStatement: sets the next statement to the closing brace at the end of the function)
  6. F10 (Debug.StepOver: leaves the method)
Bradley Grainger
(This doesn't work on VS2005 btw - I get "unable to set the next statement to this location the next statement cannot be set to another function")
ripper234