Introduction
The faster you discover and identify bugs, the faster you can get your code stabilized and released. Visual Studio Code supports code debugging for C# and most other software development languages through the use of Extensions. Once you've learned to use Visual Studio Code's debug tools, you'll spend less time wondering why your code stopped working and more time developing great applications.
Suppose you're using Visual Studio Code to develop a C# console application. The primary purpose of the application is to process customer data based on business rules. You develop the application using a small sample data set and it runs without errors. However, when you run the code using the larger data set, your code produces some unexpected results. You've read through the code several times but it's difficult to find the errors in your logic. You've heard that Visual Studio Code has good debugger tools, but you've never had to use them. You can't waste any more time reading through the code. You decide that learning the debugger tools is your best chance for completing the project on time.
In this module, you learn how to effectively debug C# programs in Visual Studio Code using breakpoints and other debugging tools, such as resources in the RUN AND DEBUG view.
By the end of this module, you'll be able to configure and use the Visual Studio Code debugger tools for C#.
Learning objectives
In this module, you will:
- Configure the Visual Studio Code debugger for a C# program.
- Create breakpoints and step through your code to isolate issues.
- Inspect your program state at any execution step.
- Use the call stack to find the source of an exception.
Ultimately, you'll be able to isolate code bugs efficiently using the debugger tools, and you won't need to rely on Console.WriteLine anymore.
Prerequisites
- An installation of Visual Studio Code that's configured for C# application development.
- Ability to develop C# console applications that implement business logic using iteration statements, selection statements, and custom methods.
- A basic understanding of code debuggers and the debug process.