title: TransactionScope across multiple threads using Task.WhenAll
body: <p>I am trying to make multiple parallel updates to database using Task.WhenAll. The code flow goes like this.</p>
  
  <p>In the main method, i have created a transaction scope and created clones of the main transactions and passed to the child. Main transactions is blocked until child is completed</p>
  
  <pre><code>using (var scope = DalcHelper.GetTransactionScope())
  {
      DependentTransaction transaction = Transaction.Current.DependentClone(DependentCloneOption.BlockCommitUntilComplete);
      var task1= Dalc.UpdateDetails1(transaction );
  
      DependentTransaction transaction1 = Transaction.Current.DependentClone(DependentCloneOption.BlockCommitUntilComplete);
      var task2 = Dalc.UpdateDetails2(transaction1);
  
      await Task.WhenAll(task1, task2 ).ConfigureAwait(false);
  
      scope.Complete();
  }
  </code></pre>
  
  <p>The DalcMethod goes like this. Here the clone created from the outer transaction goes as a parameter. The dependent transaction is completed notifying the main transaction that the dependent is completed </p>
  
  <pre><code>try
  {
      using (SqlCommand databaseCommand = DalcHelper.GetCommand(SPName))
      using (var scope = new TransactionScope(dependentCloneTransaction, TransactionScopeAsyncFlowOption.Enabled))
      {
          -- Update database
          scope.Complete();
      }
  }
  finally
  {
      //Call complete on the dependent transaction
      dependentCloneTransaction.Complete();
  }
  </code></pre>
  
  <p>Dalc methods are asynchronous methods which returns Task</p>
  
  <p>I am getting the below exception </p>
  
  <blockquote>
    <p>The transaction has aborted.Failure while attempting to promote transaction.There is already an open DataReader associated with this Command which must be closed first.The wait operation timed out</p>
  </blockquote>
  
  <p>. Can anyone tell me what am i doing wrong here? </p>