Skip to content

fix(analyzers): skip RCS1265 for catch clauses with a filter - #1789

Merged
josefpihrt merged 4 commits into
mainfrom
fix/analyzers/rcs1265-catch
Aug 8, 2026
Merged

fix(analyzers): skip RCS1265 for catch clauses with a filter#1789
josefpihrt merged 4 commits into
mainfrom
fix/analyzers/rcs1265-catch

Conversation

@josefpihrt

Copy link
Copy Markdown
Collaborator

Summary

  • RCS1265 no longer reports on catch when clauses that only re-throw, since the filter expression still runs
  • Added test covering catch when (Check()) { throw; }

Fixes #1754

Test plan

  • dotnet test src/Tests/Analyzers.Tests/Analyzers.Tests.csproj --filter FullyQualifiedName~RCS1265RemoveRedundantCatchBlockTests

Made with Cursor

josefpihrt and others added 4 commits August 8, 2026 21:11
Catch clauses with a `when` filter are not redundant even when the
block only re-throws, because the filter expression still runs.

Fixes #1754

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@josefpihrt
josefpihrt merged commit 2bf2343 into main Aug 8, 2026
17 checks passed
@josefpihrt
josefpihrt deleted the fix/analyzers/rcs1265-catch branch August 8, 2026 19:28
This was referenced Aug 16, 2026
This was referenced Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RCS1265 should not be reported when catch block is used with condition

1 participant