Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting the debugger to break at the next click event

Tags:

in a .net windows forms project which has 100s of forms, and all those forms has countless custom made controls with base classes involved, its very difficult for me to know where a particular button is, i mean whats the form name which I'm looking at while i'm running the application, and where exactly is the button click event, in code, of the button that I just clicked. Is there a debugging feature in Visual Studio, which would just break the execution for me to the line where the click happened. Can I tell VS to break at which ever Click event comes next? (running visual studio 2012/13 these days).

thanks.

like image 833
user734028 Avatar asked Jan 05 '15 08:01

user734028


People also ask

How do you get to the next step in Debug mode?

You can click the Debug | Step Over menu or press the keyboard shortcut F10 to execute the current line and jump into the next line for execution.

How do you breakpoint in debugging?

To set a breakpoint in source code: Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.

How do you go to the next breakpoint in Visual Studio?

You can press F5 while debugging to jump to next breakpoint and F10 to jump line by line.

What is break in debugger?

If a user-mode debugger is attached, the program will break into the debugger. This means that the program will pause and the debugger will become active.


2 Answers

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.

like image 97
Jakob Olsen Avatar answered Sep 23 '22 04:09

Jakob Olsen


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
like image 40
Damian Vogel Avatar answered Sep 25 '22 04:09

Damian Vogel