JetBrains Rider 2026.1 Help

Code inspection: try-catch and try-finally statements can be merged

This inspection reports a try block whose only statement is another try block. Nested try statements like this can usually be flattened into a single try with combined handlers, which makes the control flow easier to read.

Example

try { try { DoWork(); } catch (InvalidOperationException) { Recover(); } } catch (Exception) { Log(); }
try { DoWork(); } catch (InvalidOperationException) { Recover(); } catch (Exception) { Log(); }

Quick-fix

Merge the nested try statements into a single try statement.

29 March 2026