3 ms·
I agree, `UnreachableException` is really poorly used here, and most of these are argument exceptions, and clearly are reachable. However, for other "unexpected
by whoisthemachine 4y ago
I agree, `UnreachableException` is really poorly used here, and most of these are argument exceptions, and clearly are reachable. However, for other "unexpected behaviors", you should really throw an `InvalidOperationException` - you did something that is invalid. And even better if you sub-class Invalid with a custom exception that more clearly describes the unexpected behavior (also easier to search for that exception type in your log analysis tool).
[0] https://learn.microsoft.com/en-us/dotnet/api/system.invalidoperationexception?view=net-7.0 https://learn.microsoft.com/en-us/dotnet/api/system.invalido...