Chapter V.7. Handling Exceptions and Debugging
In This Chapter
Anyone who has done even a little coding has been deflated by seeing the Visual Studio Debugger open instead of a beautiful masterpiece — because of an error that occurs in the program code. Sometimes, you spend more time with the Visual Studio Debugger than you do writing code. Of course, you might see less of the Debugger if you start using structured exception handling to capture exceptions when they do occur. And this chapter shows you how to do just that.
This chapter provides you with a full view of the Debugger. For example, you discover the wonders of using breakpoints to control when Visual Studio pauses your code and lets you debug it. You can also read how the Watch window works. All these tools can make your debugging significantly easier.
Structured Exception Handling to the Rescue
Whether you're writing code as a professional or a hobbyist, you want your code to perform as advertised. For example, when a user clicks a button to load information from a file, you want to make sure that file is there. If the file isn't there, you need to have some way to deal with the error.
In object-oriented programming (OOP), errors are often called exceptions. An exception is just what it sounds like — anything that occurs in your code that's exceptional or out of the ordinary. For example, if your code opens a file and the file server goes down while you're accessing the file, that's an exception. Comparatively, not being ...
Get Visual Studio® 2008 ALL-IN-ONE DESK REFERENCE FOR DUMMIES® 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.