Standard Exception Hierarchy in .NET Core
The official Microsoft documentation is not very good at giving an overview of the available exception types in .net Core, so this is my attempt at doing so. In other words, this list is far from exhaustive; instead, I try to list the exception types that I find generally useful.
System.Exception
System.ApplicationException
11 Should not be used in client code (indicates something is wrong with the code on the source level), but I have seen it used.System.Net.Http.HttpRequestException
System.SystemException
System.ArgumentException
System.ArgumentNullException
System.ArgumentOutOfRangeException
System.FormatException
22 Parser failure.System.IndexOutOfRangeException
System.InvalidOperationException
33 Under the current configuration, this operation cannot be performed.System.NotImplementedException
System.NotSupportedException
44 The operation is not supported and not meant to be supported either, e.g. modifying a read-only collection.System.PlatformNotSupportedException
55 The operation is not supported due to the platform the program runs on.
System.NullReferenceException
66 Prefer validating early and throwingSystem.ArgumentNullException
.System.TimeoutException
System.IO.InvalidDataException
77 Raw binary data in an i/o stream did not conform to expectations.System.IO.IOException
System.IO.DirectoryNotFoundException
System.IO.EndOfStreamException
System.IO.FileNotFoundException
System.Security.SecurityException