title: Catching the original exception with TransformBlock
body: <p>I am using the <a href="http://msdn.microsoft.com/en-us/library/hh194782%28v=vs.110%29.aspx" rel="nofollow">TransformBlock</a> from the TPL Dataflow library, and I have realized that when a exception is thrown during the transform, I get a generic exception in the "Receive" method, but no mention to the original one.</p>
  
  <p>In this code:</p>
  
  <pre><code>Func&lt;Int32, Task&lt;String&gt;&gt; transformer = async i =&gt; { await Task.Yield(); throw new ArgumentException("whatever error"); };
  TransformBlock&lt;Int32, String&gt; transform = new TransformBlock&lt;int, string&gt;(transformer);
  transform.Post(1);
  
  try
  {
      var x = await transform.ReceiveAsync();
  }
  catch (Exception ex)
  {
      // catch
  }
  </code></pre>
  
  <p>The exception <code>ex</code> contains:</p>
  
  <pre><code>System.InvalidOperationException was caught
    HResult=-2146233079
    Message=The source completed without providing data to receive.
    Source=System.Threading.Tasks.Dataflow
    StackTrace:
         at System.Threading.Tasks.Dataflow.Internal.Common.InitializeStackTrace(Exception exception)
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
         at DoubleQueueTest.Program.&lt;testwhatever&gt;d__5.MoveNext() in c:\Users\vtortola\Documents\Visual Studio 2013\Projects\DoubleQueueTest\DoubleQueueTest\Program.cs:line 43
    InnerException: 
  </code></pre>
  
  <p>No mention to the original exception type or its message. Is there a way to force it to throw the original one? or at least, use it as inner exception?</p>