It's dangerous to code alone! Take this.

Stepping Into a new Run of an Application

Published on 26 Mar 2022.

I had a need, the other day, to debug my program, but I wanted to stop before any actual lines of code ran. Most of the time, when I want to do this, I can just place a breakpoint on the first line of the program and start debugging. In this case, I actually didn’t even know what the first line of my program was.

In these scenarios, there’s a simple alternative in Visual Studio. From the menu, choose Debug > Step Into.

The Step Into command

This causes your program to compile and run, but will stop immediately upon entering your main method, so you can step through the code at your whim.

In most circumstances, you can also just place a breakpoint at the start of your main method, but this option spares you the need to add and then later remove the breakpoint. (And if you’re dealing with the compiler warning CS7022, and have accidentally introduced global code and don’t know where to find it, this may be a useful too to help you find it.)