Lesson 24 Learning to use Points Break in Debugging C# Codes

This is our tutorial no 24 and today I will teach you about Points Break in Debugging C# Codes. The first thing you need to learn in the C# or Debugging code operation is to use BreakPoints.

Points Break in Debugging C# Codes

BreakPoints performs just as its name suggests. BreakPoint designates a point in your code where the compiler exits and the programme exits briefly. You can use this tool to double-check your code and the values of variables and expressions in the programme.


To use BreakPoint in a Visual Studio environment, right-click on the program’s side edge, aligned with the code you wish to debug, and the app will draw a red circle for you to position BreakPoint.

For a better understanding, copy the following code snippet into the Visual Studio environment and create a BreakPoint next to it.

namespace DebugTest
{
 class Program
 {
 static void Main(string[] args)
 {
 int a = 5, b = 8, c = 233;
 int d = a + c - b;
 Console.WriteLine(d);
 }
 }
}

The code in the example above is very simple, and you can even calculate the value of a variable at any time with a calculator Calculate and check your code. But in large projects, doing this manually is almost impossible Is.


Create a BreakPoint next to the code line shown in the image below:

VPN

You are now prepared to troubleshoot your first page in C #. Using the F5 key to start the software. The programme will proceed normally and according to schedule. The processing operation to check the code stops when it hits the breakpoint code line. In the code above,

The variables a, b and c have a value, but in the specified line the variable d has not been set yet and the value is prefixed. It has the assumption for integer, ie zero. After running this line of code that variable d is your new value Earns.


Now to the exciting part of the program, move the mouse over the names of different code variables. An open tooHip It tells you how much each variable has at that moment.

The variable d has a default value of zero until this line is run, as previously stated. However, by proceeding to run the application, its value can be altered. In the next session, we’ll learn how to browse through programme codes and focus on debugging activities.

%d bloggers like this: