A method denotes itself as asynchronous by returning a Task
and using the Async
suffix. However, it does not use the async
and await
keywords but returns the tasks explicitly.
If such a potentially async method throws an exception inside its body, it behaves differently to methods using the async
principles. The latter encapsulates the thrown exceptions inside the return task object. The former throws the exception upon invocation.
Encapsulate the exceptions in a task using Task.FromException(...)
.
# A white-space separated list of exception types to not report. The sub-types of these types will be excluded too.
# Format: <type-specifier1> <type-specifier2> ...
dotnet_diagnostic.PH_S032.exclusions = System.ArgumentException System.NotImplementedException