Code inspection: Exception rethrow possibly intended
This inspection reports throw ex; inside a catch block when the code most likely intended to rethrow the current exception. Using throw ex; resets the stack trace. A plain throw; preserves the original call stack.
Example
try
{
DoWork();
}
catch (Exception ex)
{
throw ex;
}
try
{
DoWork();
}
catch (Exception ex)
{
throw;
}
Quick-fix
The quick-fix replaces the explicit exception variable with a plain rethrow.
01 April 2026