dougferg (12) [Avatar] Offline
#1
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 (https://msdn.microsoft.com/en-us/magazine/jj991977.aspx)

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
#2
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