I’ll Get Back to You: Task, Await, and Asynchronous Methods
There’s a lot of confusion about async/await, Task/TPL, and asynchronous and parallel programming in general. So let’s start with the basics and look at how we can consume asynchronous methods using Task and then see how the “await” operator can makes things easier for us. Along the way, we’ll look at continuations, cancellation, and exception handling.
One of the things he covered was something I saw a fellow programmer at work run into. The issue is when a Task completes you have a couple properties “IsFaulted”, “IsCompleted”, and “IsCanceled” and the fact that IsCompleted just means it is done running and this is set to true even if faulted. Therefore you cant use it to tell that the task ran to completion SUCCESSFULLY.
I remembered in the talk this came up and was discussed and way to handle it nicely was given. I could not recall exactly the way Jeremy showed that handled it and went searching for more on his site. I found the following post
And reading through that post I found the information I wanted.
Thanks again Jeremy! And if you are near anyplace he speaks (which is LOTS of places) I would go see him. He is a really good presenter and covers his topics in a well organized way and really gets the concepts across well.
Check his site and his upcoming speaking is right on his home page.