dougferg (12) [Avatar] Offline
On page 21, you are using a Task.WaitAll call to show waiting for the completion of Async processes. Using WaitAll when code is using async/await can cause blocking issues. I think you should favor Task.WhenAll instead. WaitAll is more appropriate for true parallel (CPU-based) operations, whereas WhenAll is used for Async operations.

See: Stephen Cleary's Async/Await best practices post (

Figure 5 The “Async Way” of Doing Things

To Do This … Instead of This … Use This
Retrieve the result of a background task Task.Wait or Task.Result await
Wait for any task to complete Task.WaitAny await Task.WhenAny
Retrieve the results of multiple tasks Task.WaitAll await Task.WhenAll
Wait a period of time Thread.Sleep await Task.Delay
Tamir Dresher (35) [Avatar] Offline
Thanks for the feedback.
In the example, i tried to show how we can do concurrent work and then join it.
WhenAll is by no doubt the best-practice and i will add a comment to make it clear.

Thank you