Code inspection: Filter expression is a constant, consider removing the filter
This inspection reports an exception filter whose condition is a constant expression. An exception filter such as when (true) or when (false) does not make the catch logic more precise. It usually means the filter is accidental, incomplete, or should be removed.
Example
try
{
DoWork();
}
catch (Exception) when (true)
{
Handle();
}
try
{
DoWork();
}
catch (Exception)
{
Handle();
}
How to fix
There is no dedicated quick-fix. The usual fix is to remove the constant filter or replace it with a real condition.
21 April 2026