Debugging all events in Visual Studio 2010 without setting break points

Ying Chan picture Ying Chan · Oct 20, 2010 · Viewed 24k times · Source

I am trying to debug a windows form application which has a large number of events: button presses, timers, etc..

Is there a way to catch every line of code being executed by the application without setting a break point?

edit: The program was not written by me, so I am unfamiliar with the code. I wish to step through the entire program, catching every line of code being executed. Setting break points in every event is impractical as various controls are created dynamically.

Answer

Austin Salonen picture Austin Salonen · Oct 20, 2010

For debugging a button click without setting breakpoints:

  1. Start the app with the debugger.
  2. Get to the state immediately before the intended click.
  3. Go back to the debugger and press Pause then F11 (Step Into) -- nothing will happen.
  4. Go to the app and press the button -- the debugger should take over and drop you into the event handler.

Note: This will not work if Paint, any Mouse event, or probably some other events are handled. The debugger will drop you into those handlers any time you attempt the steps above.