CHAPTER 7 UNDERSTANDING STRUCTURED EXCEPTION HANDLING
static void Main(string[] args)
{
Console.WriteLine("***** Handling Multiple Exceptions *****\n");
Car myCar = new Car("Rusty", 90);
myCar.Accelerate(500);
Console.ReadLine();
}
The result of ignoring an exception would be rather obstructive to the end user of your application,
as an “unhandled exception” dialog box is displayed (see Figure 7-3).
Figure 7-3. The result of not dealing with exceptions
Debugging Unhandled Exceptions Using Visual Studio
Do be aware that Visual Studio supplies a number of tools that help you debug unhandled custom
exceptions. Again, assume you have increased the speed of a Car object beyond the maximum. If you
start a debugging session within Visual Studio (using the Debug Start Debugging menu selection),
Visual Studio automatically breaks at the time the uncaught exception is thrown. Better yet, you are
presented with a window (see Figure 7-4) displaying the value of the Message property.
278