diff --git a/docs/fundamentals/code-analysis/quality-rules/ca2219.md b/docs/fundamentals/code-analysis/quality-rules/ca2219.md index f55087c355f91..7efa0023a1582 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca2219.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca2219.md @@ -10,6 +10,8 @@ helpviewer_keywords: - CA2219 author: gewarren ms.author: gewarren +dev_langs: +- CSharp --- # CA2219: Do not raise exceptions in exception clauses @@ -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.