Details
-
Improvement
-
Resolution: Fixed
-
Minor
-
3.2.6
-
None
-
None
-
1
Description
Per https://github.com/davidfowl/AspNetCoreDiagnosticScenarios/blob/master/AsyncGuidance.md#always-create-taskcompletionsourcet-with-taskcreationoptionsruncontinuationsasynchronously, it's best to create TaskCompletionSource<T> with the option TaskCreationOptions.RunContinuationsAsynchronously in most cases. This causes any awaits waiting on the task to have the continuation queued to another thread.
While this is a slight perf hit in many cases, we only use TaskCompletionSource to cover some corners around ConnectionPool scale down. The improved safety of RunContinuationsAsynchronously is preferable.