
When a method call is invoked the flow enters the method and returns to the calling line after it has completed. Step-Through: Each and every line of code executed will be debugged. While debugging, you can step through the code in a number of different methods, you can step through line by line using F11, step over using F10 or step out using (Shift+F11). You can also see variables value, but navigating to "Debug -> Windows -> Locals", you should see output as below To Start debugging this code, press "Start" button in Visual Studio, here is the sample gif imageĪs you can see in the above gif image when the breakpoint is hit debugger opens and then you can hover over any variable and check it's it value.

In the above code sample and image, we are debugging line " string stringValue = "Hello" ", so when the red block is hit, it will open debugger and we can then debug code. The red circle will appear once you click it, it is where you have set the debugging breakpoint. On the far left of your source code tab, you will see a narrow gray strip, Click on it in the line you want to debug. Now, we should add a breakpoint in our C# program. Now, as you can see above, we will be using above program in Visual Studio to debug it, and also we can see debug menu available in Visual Studio.Īdd the breakpoint in Visual Studio (C# program)


To start understanding Visual Studio IDE debugging, we would have to create a sample C# console application program, I am using this simple C# program in Visual Studio, which uses variables and we will test how we can see variables output while debugging. This is useful for when you want to make sure the values are correct and if they aren't correct, you can determine a way to work around of the problem. In Visual studio debugging, you can see how variables value changes while the program executes, and it is possible to see these changes. What is debugging?ĭebugging is simply the process to identifying a problem, and then either correcting the problem or determining a way to work around it.

If you have just started learning C# or you are new to Visual Studio IDE and want to learn more about it, one of the best features of visual studio is debugging code, which allows developer to check the output of any variable or output of each line statement while code is executing.
