Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/fundamentals/code-analysis/quality-rules/ca2219.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ helpviewer_keywords:
- CA2219
author: gewarren
ms.author: gewarren
dev_langs:
- CSharp
---
# CA2219: Do not raise exceptions in exception clauses

Expand Down Expand Up @@ -37,6 +39,20 @@ When an exception is raised in a filter clause, the runtime silently catches the

To fix this violation of this rule, do not explicitly raise an exception from a `finally`, filter, or fault clause.

## Example

```csharp
try
{
// ...
}
finally
{
// This code violates the rule.
throw new Exception();
}
```

## When to suppress warnings

Do not suppress a warning for this rule. There are no scenarios under which an exception raised in an exception clause provides a benefit to the executing code.
Expand Down