Chapter 10. Basic Debugging

The debugger is your friend. There is simply no more powerful tool than a debugger for learning VB.NET and for writing quality VB.NET programs. The debugger will help you understand what is really going on when your program is running. It is the x-ray of software development, allowing you to see inside programs and diagnose potential problems.

Without a debugger you are guessing. With a debugger you are seeing. It is as simple as that. Whatever time you invest in learning to use your debugger is time well spent.

The debugger is also a powerful tool for understanding code written by others. By putting someone else’s code into the debugger and stepping through it, you can see exactly how the methods work and what data they are manipulating.

This book assumes you are working with Visual Studio .NET. The debugger we’ll investigate is the debugger integrated within VS.NET, which is a very powerful symbolic debugger.

The VS.NET debugger provides a number of windows for watching and interacting with your program while it executes. Getting comfortable with the debugger can make the difference between quickly finding bugs and struggling for hours or days.

Setting a Breakpoint

To get started with the debugger, return to Example 9-1. To see how this code actually works, you’ll put a breakpoint on the first line of Main( ). A breakpoint is an instruction to the debugger to stop running. You set a breakpoint and then run the program. The debugger will run the program ...

Get Learning Visual Basic .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.