title: TPL Dataflow, guarantee completion only when ALL source data blocks completed
body: <p>How can I re-write the code that the code completes when BOTH transformblocks completed? I thought completion means that it is marked complete AND the " out queue" is empty? </p>
  
  <pre><code>public Test()
      {
          broadCastBlock = new BroadcastBlock&lt;int&gt;(i =&gt;
              {
                  return i;
              });
  
          transformBlock1 = new TransformBlock&lt;int, string&gt;(i =&gt;
              {
                  Console.WriteLine("1 input count: " + transformBlock1.InputCount);
                  Thread.Sleep(50);
                  return ("1_" + i);
              });
  
          transformBlock2 = new TransformBlock&lt;int, string&gt;(i =&gt;
              {
                  Console.WriteLine("2 input count: " + transformBlock1.InputCount);
                  Thread.Sleep(20);
                  return ("2_" + i);
              });
  
          processorBlock = new ActionBlock&lt;string&gt;(i =&gt;
              {
                  Console.WriteLine(i);
              });
  
          //Linking
          broadCastBlock.LinkTo(transformBlock1, new DataflowLinkOptions { PropagateCompletion = true });
          broadCastBlock.LinkTo(transformBlock2, new DataflowLinkOptions { PropagateCompletion = true });
          transformBlock1.LinkTo(processorBlock, new DataflowLinkOptions { PropagateCompletion = true });
          transformBlock2.LinkTo(processorBlock, new DataflowLinkOptions { PropagateCompletion = true });
      }
  
      public void Start()
      {
          const int numElements = 100;
  
          for (int i = 1; i &lt;= numElements; i++)
          {
              broadCastBlock.SendAsync(i);
          }
  
          //mark completion
          broadCastBlock.Complete();
  
          processorBlock.Completion.Wait();
  
          Console.WriteLine("Finished");
          Console.ReadLine();
      }
  }
  </code></pre>
  
  <p>I edited the code, adding an input buffer count for each transform block. Clearly all 100 items are streamed to each of the transform blocks. But as soon as one of the transformblocks finishes the processorblock does not accept any more items and instead the input buffer of the incomplete transformblock just flushes the input buffer. </p>