I\'m trying to use Task.WaitAll on a list of tasks. The thing is the tasks are an async lambda which breaks Tasks.WaitAll as it never waits.
Task.WaitAll
Tasks.WaitAll
Task.Factory.StartNew doesn't recognise async delegates as there is no overload that accepts a function returning a Task.
Task.Factory.StartNew
async
Task
This plus other reasons (see StartNew is dangerous) is why you should be using Task.Run here:
Task.Run
tasks.Add(Task.Run(async () => ...