O'Reilly logo

C# 4.0 Unleashed by Bart De Smet

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

Causes of Exceptions

Different situations give rise to exceptions:

• Code defects, such as forgetting null checks causing NullReferenceExceptions or passing invalid arguments to some method that signals the defect using an ArgumentException or variation thereof.

• Runtime disasters that prevent the CLR’s execution engine from continuing execution; for example, due to insufficient memory (OutOfMemoryException) or a stack overflow.

• Error conditions in the environment where the code is operating, such as a missing configuration file, failure to connect to a web service or a database, or an external component failing.

• Rarely ever recommended, exceptions can sometimes be (mis)used to drive certain aspects of code execution. An example is the runtime’s ...

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