Accessing the AggregateException with await

Monday, December 31, 2012

The await keyword is a new keyword in C# 5.0 which, in tandem with async keyword, allows us to easily author methods which execute asynchronously in regards to the calling code. In previous posts I’ve shown certain issues you should look out for when using these keyword. In this post we’ll look at another issue with the await keyword – how to access the AggregateException. await Only Throws One Exception As we saw in a previous post, await (unlike Task.Wait()) does not wrap a thrown exception in an AggregateException and instead just re-throws the exception thrown within...
no comments

Task.Wait() vs. await

Sunday, December 23, 2012

The await keyword is a new keyword in C# 5.0 which, in tandem with async keyword, allows us to easily author methods which execute asynchronously in regards to the calling code. In a previous post I’ve shown a certain issue you should look out for when using the async keyword. In this post we’ll check a similar issue with the await keyword. The await Trap Let’s remember our test code from the previous post: class AsyncClass { public void Process(string s) { if (s == null) throw new ArgumentNullException("s"); ...
no comments