getting the debugger to break at the next click event

Just before you click the button in the program do this:

Go to visual studio and pause the program. Just press the pause button. Then press F11 (Step Into).

Now press the button in the program, and you should be taken into the event handler.


For web projects, the technique suggested by Jakob Olsen will not really work, because you have no active thread in between the calls, and hence no thread to resume upon the next action. However what worked for me was:

  • Find some code (any code in your app) you know for sure it gets executed and set a breakpoint
  • Trigger this breakpoint, use SHIFT-F11 to step out until you're out of all methods
  • Now do the action of which you don't know what code is executed, and it will break