ReSharper
 
Get ReSharper
Get your hands on the new features ahead of the release by joining the Early Access Program for ReSharper 2025.1! Learn more

Code inspection: Redundant catch clause

Last modified: 11 February 2024

Consider the following piece of code:

The catch statement may appear to be doing something, but it really isn't: all it's doing is throwing the exception (with the same stack information), which is exactly what would happen if the catch statement weren't written at all. Note that if we wrote throw ex instead of just throw, we can no longer argue that the catch clause is redundant.