Exception handling
Exception handling is an integral part of running any application. Below you will find all the relevant information regarding the subject.
The basics
Learn about the concept of exception handling and how it differs from using error codes.
Exception classes
Learn about exception classes and how they are used in exception handling.
Best practices
All the best practices you'll need to maximize effectiveness with exception handling in .NET.
Do not catch exceptions
Best practice number 1: do not catch exceptions. Let's start by defining what "handled" means when talking about exceptions.
Use argument exceptions
Learn about why it's crucial to use argument exceptions when coding a robust application.
Fulfil the contract or die trying
If you want to avoid side effects in your application, always make sure the method can deliver what it promised.
Always reproduce errors
If you cannot reproduce an error, you are most likely writing a workaround instead of a real fix. Be careful.
Try to include context in the exception message
Reproducing bugs can be hard. Try to write informative exception messages to make the process easier.