

This command also has the debugger execute the highlighted line. This way ‘Step Into’ follows our program’s code one line at a time. Then after that method ends we return back to where we called it. When that line has a method call, the debugger moves into that method. Each time we execute this command the debugger executes the currently highlighted line. There are three debugging features that allow us to execute just a bit of code each time (Liberty & MacDonald, 2009 Price, 2017 Stephens, 2014): (Cannot find the ‘Debug’ toolbar? See start debugging in Visual Studio for how to enable it.) That ‘Debug’ toolbar looks like the following. Then when our program pauses under the debugger, we use the ‘Debug’ toolbar to go through the code step by step. To execute our program line by line under the debugger, we first start debugging. # Step through C# code with the ‘Debug’ toolbar Let’s see how we step through C# code in Visual Studio. This way we get a detailed view of how our program executes its code. That way we execute just one or are few lines at a time (Asad & Ali, 2017). A helpful tool for that is ‘stepping through’ code. Then once our application pauses under the debugger we begin to search for the bug. Or we start debugging and break at a particular line with Visual Studio’s ‘Run To Cursor’ option. We can place breakpoints that pause the program when those breakpoints execute.

There are a couple of ways to make our program ‘break’ under the debugger. That way we can figure out what’s going on at that particular point (Liberty & MacDonald, 2009). For that we typically pause (or so-called ‘break’) our program while it runs. But for bigger and complex programs we need debugging tools.ĭebugging is the process in which we identify and remove errors from our program (Asad & Ali, 2017). Sometimes a look over the code is enough to find the mistakes. When we program C# applications we sooner or later run into errors. # Execute a program line by line with Visual Studio’s debugger Start a new Visual Studio debugging session with ‘Restart’.Jump to another debug point with ‘Continue’.Jump over C# methods with Visual Studio’s ‘Step Over’.Debug C# code one line at a time with ‘Step Into’.

Step through C# code with the ‘Debug’ toolbar.Execute a program line by line with Visual Studio’s debugger.
