Skip to content

Files

Latest commit

 

History

History
9 lines (5 loc) · 426 Bytes

PH_S014.md

File metadata and controls

9 lines (5 loc) · 426 Bytes

PH_S014 - Task.Factory.StartNew with async delegate

Problem

The method Task.Factory.StartNew(...) does not recognize async delegates. Therefore, the created task does not wait for the completion of the delegate. Last but not least, the invocation of the delegate will run in a fire-and-forget manner.

Solution

Replace the task creation Task.Factory.StartNew(...) with async delegate aware Task.Run(...).