Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging - how do I execute code line by line?

I am having a hard time debugging my C# app in Visual Studio. I can't figure out how to debug code line by line, but not at the moment the program starts (because I would have to F5 a lot of times as the program takes about 200 lines just to initialize). I mean let's assume I would like the debugging to start in a certain moment. Something like having a breakpoint in every line of code but without actually creating the breakpoints (which would take a lot of time every time I want them to be created).

I hope I am somewhat clear.

like image 718
Mariusz Avatar asked Sep 23 '11 11:09

Mariusz


People also ask

How do you Debug a program line by line?

If you're not sure how to step line, by line, put a breakpoint where you want to start debugging line by line (or pause the app) then use F10 as "Step Over" or F11 as "Step Into" instead of F5 ("Go").

How do you run a code through line by line?

To run to the cursor location, in source code or the Call Stack window, select the line you want to break at, and then right-click and select Run To Cursor, or select Ctrl+F10.

How do you Debug line by code in line blocks?

Again click on (Debug-> start/continue) It will show a console window. Put input on it. Now press Enter button. Click on (Debug-> Next line) or press F7 for line by line debugging.


1 Answers

I'm not entirely clear what you're after...

  • If you're not sure how to step line, by line, put a breakpoint where you want to start debugging line by line (or pause the app) then use F10 as "Step Over" or F11 as "Step Into" instead of F5 ("Go").

  • If you're not sure how to break into the app when you want to, you can hit the "pause" button in the debugger at any time, or add a breakpoint where you want to stop even after the app has started.

If neither of these is helpful, please give more information.

like image 51
Jon Skeet Avatar answered Sep 28 '22 07:09

Jon Skeet