AZF0001: Avoid async void
This rule is triggered when the void
return type is used in an async function definition.
Value | |
---|---|
Rule ID | AZF0001 |
Severity | Error |
Rule description
Defining async
functions with a void
return type make it impossible for the Functions runtime to track invocation completion or catch and handle exceptions thrown by the function method.
Refer to this article for general async void
information: https://msdn.microsoft.com/magazine/jj991977.aspx
How to fix violations
To fix violations, change the function's return type from void
to Task
and make the necessary code changes to appropriately return a Task
.
When to suppress the rule
This rule should not be suppressed. Use of async void
will lead to unpredictable behavior.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for