-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Source Gen] Add retry options diagnostic descriptors (#1683)
- Loading branch information
Showing
7 changed files
with
96 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# AZFW0012: Invalid Retry Options | ||
|
||
| | Value | | ||
|-|-| | ||
| **Rule ID** |AZFW0012| | ||
| **Category** |[AzureFunctionsSyntax]| | ||
| **Severity** |Error| | ||
|
||
## Cause | ||
|
||
This rule is triggered when a retry attribute is incorrectly used on an Azure Function. | ||
|
||
## Rule description | ||
|
||
This rule is triggered in two scenarios: | ||
|
||
- A retry strategy is not recognized (only Fixed Delay and Exponential Backoff are supported) | ||
- A retry attribute is used on a trigger type that does not support function-level retry. | ||
|
||
A list of triggers that support function-level retry can be found [here](https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-error-pages?tabs=fixed-delay%2Cin-process&pivots=programming-language-csharp#retries). | ||
|
||
## How to fix violations | ||
|
||
Use the supported retry attributes on the correct trigger types. This information can be found [here](https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-error-pages?tabs=fixed-delay%2Cin-process&pivots=programming-language-csharp#retries). | ||
|
||
Example functions using retry attributes can be found on the [extensions sample app](https://github.com/Azure/azure-functions-dotnet-worker/tree/main/samples/Extensions) in the source repository. There are examples on the CosmosDB function, the timer function, and more. | ||
|
||
## When to suppress warnings | ||
|
||
This rule should not be suppressed because this error will lead to unexpected retry behavior. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters