O'Reilly logo

Applied Microsoft® .NET Framework Programming by Jeffrey Richter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exception Stack Traces

As I mentioned earlier, the System.Exception type offers a public, read-only StackTrace property. An exception filter or a catch block can read this property to obtain the stack trace indicating what events occurred up to the exception. This information can be extremely valuable when you’re trying to detect the cause of an exception so that you can correct your code. In this section, I’ll discuss some issues related to the stack trace that aren’t immediately obvious.

The Exception type’s StackTrace property is magical. When you access this property, you’re actually calling into code in the CLR; the property doesn’t simply return a string. When you construct a new object of an Exception-derived type, the StackTrace property ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required