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.
Replace the task creation Task.Factory.StartNew(...)
with async
delegate aware Task.Run(...)
.