Async and AggregateException

Monday, January 14, 2013

Async and AggregateException this post is a complementary to Eran Stiller's post. I was reading Eran Stiller's post about exception handling using async methods and I want to add a few side notes. 1) the exception handling behavior decisions is well documented in this post (by the TPL team), it decided after they had consider different options. 2) I was suggesting that compiler will check whether the a catch of AggregateException is implemented and if so to avoid the unwrapping behavior. in this case the...

Async – Handling multiple Exceptions

Monday, December 10, 2012

Async - Handling multiple Exceptions the SDP conference was ended a few week ago and I finally find a time to write some comments. It was a very successful conference, the feedback and evaluations, of most sessions scored higher than 4.5, some well-over it. For example, one workshop had a perfect 5 / 5 score, and two other workshops scored 4.92 / 5 and 4.9 / 5. The highest score for a breakout session was 9.39 / 10, which is the highest score we’ve seen to date. my score was 4.90 / 5. but this post...
one comment

SDP 2012 – Day 2

Monday, November 19, 2012

SDP 2012 - Day 2 the SDP 2012 conference has day 2 had completed. I was speaking about async / await, Rx and TPL Dataflow. you can find the materials for my lecture in here. I will give the same lecture on Wednesday next week, there is a chance that some place is still available, so if you are interesting, you can check it with Sela Marketing.

SDP 2012 – Day 1

Sunday, November 18, 2012

SDP 2012 - Day 1 the SDP 2012 conference has started today. I was speaking about what's new in .NET 4.5 parallelism. you can find the materials for my lecture in here. tomorrow I'm giving a full day tutorial about async / await, Rx and TPL Dataflow.
no comments

Tpl Dataflow walkthrough – Part 5

Saturday, January 28, 2012

Tpl Dataflow walkthrough - Part 5 this post is a complete walkthrough of a web crawler sample that was build purely by using Tpl Dataflow. it was built on .NET 4.5 / C# 5 (on a virtual machine using VS 11). I will analyze each part of this sample, both by discussing the Dataflow blocks and the patterns in used. the sample code is available in here (it is a VS 11 project). during the walkthrough you will see the following Tpl Dataflow blocks: TransformBlock ...

async / await, some reasoning

Thursday, January 19, 2012

async / await, some reasoning this post will try to make some reasoning about the .NET 4.5 / C#5 await keyword. I will begin with a quiz. how long will it take to the following method to produce the 42 value? Code Snippet async Task<int> Execute() {     await Task.Delay(1000);     await Task.Delay(1000);     return 42; } you should remember that conceptually the await keyword will translate to a continuation. the above code can be compare to the following TPL 4 code snippet: ...
no comments

Using async / await

Sunday, January 15, 2012

Using async / await this post will discuss parallel disposal. whenever we want to dispose a parallel execution upon completion we can't use the convenient using keyword. for example, the following code may be dispose the command before completion: Very bad Code Snippet using (var conn = new SqlConnection(CONN_STR)) using (var cmd = new SqlCommand("Select * from Employee", conn)) {     conn.Open();     cmd.BeginExecuteReader(ar =>         {             int affected = cmd.EndExecuteNonQuery(ar);         }); } the using is absolutely wrong for the above sample. what should be...

async \ await and Exception Handling

Thursday, January 12, 2012

async \ await and Exception Handling this post will discuss how async / await is handling exceptions. as we mention in previous post, about the async / await concept, await is all about continuation. before .NET 4.5 parallel execution exceptions has to be handle in separate of the synchronic handling. for example: handling ThreadPool execution: Code Snippet void Foo() {     try     {         Console.WriteLine("Synchronic");         ThreadPool.QueueUserWorkItem(state =>             {                 try                 {                     Console.WriteLine("Parallel");                 }                 catch (Exception exAsync)                 {                     EventLog.WriteEntry("application", exAsync.ToString());                 }             }, null);     }     catch (Exception ex)     {         EventLog.WriteEntry("application", ex.ToString());...

the concept of async \ await

Thursday, December 29, 2011

the concept of async \ await in this post I will survey the new .NET 4.5 / C# 5 concept of async / await. I will focus on how to understand what is really happens behind the new async / await syntax. What's it all about? the new async / await syntax is using the C# syntactic compiler to generate async operation from code that is looking very much like a synchronous code. but before we start we should discus the new C# 5  syntax. the syntax include 2 keywords: ...

What is the cost of async/await?

Thursday, December 15, 2011

What is the cost of async/await? .NET 4.5 (C# 5) had brought the new async/await syntax. I will cover async/await syntax in more details in future post, but in the meanwhile in case that you are not yet familiar with this syntax, what's  you should have to know is that the syntactic compiler transform that syntax (and the lines that follow the await keyword) into IL, the generated IL is following the concept of the TPL ContinueWith. the syntactic compiler is actually generating fair amount of IL which represent a state-machine of the async execution. ...
no comments