There are many different types of built-in exception classes in .NET.
You'll see some more often than others, however it's helpful to have a basic understanding of all of them, as you'll likely encounter each one at least once!
Most common exceptions
Below is a list of the most common .NET exceptions:
| Exception Type | Why was the exception thrown? |
|---|---|
| ArgumentException | A non-null argument was passed into a method that was invalid. |
| ArgumentNullException | An argument that should not be null was passed into a method. |
| ArgumentOutOfRangeException | A non-null argument passed into a method was outside the valid range. |
| DivideByZeroException | There was an attempt to divide a numerical value by zero. |
| FileNotFoundException | Unable to find a file at the specified location. |
| FormatException | The specified value is not in the required format (typically when converting to another format). |
| IndexOutOfRangeException | An array index is outside the lower or upper bounds of an array or collection. |
| InvalidOperationException | A method call is invalid within an object's current state. |
| KeyNotFoundException | The specified key for accessing a member in a collection does not exist. |
| NotSupportedException | The called method or operation is not supported. |
| NullReferenceException | There was an attempt to access members of a null object. |
| OverflowException | Raised when an arithmetic, casting, or conversion operation results in an overflow. |
| OutOfMemoryException | There is not enough memory to perform the current operation. |
| StackOverflowException | A stack in memory has overflown (typically due to excessively deep or infinite recursion) |
| TimeoutException | The time interval allotted to an operation has been exceeded. |
