title: What prevents Task.Factory.ContinueWhenAll from calling the specified Action?
body: <p>Take this segment.</p>
  
  <pre><code>IEnumerable&lt;Task&gt; tasks = CreateTierCleanupTasks();
  if (tasks.Count() &gt; 0) {
      Task.Factory.ContinueWhenAll(tasks.ToArray(), OnTierCleanupCompleted,
          m_CancellationTokenSource.Token,
          TaskContinuationOptions.None,
          m_TaskScheduler);
      Array.ForEach(tasks.ToArray(), (t) =&gt; t.Start()); 
      OnTierCleanupStarted();
  }
  </code></pre>
  
  <p>And here is the specified Action.</p>
  
  <pre><code>private void OnTierCleanupCompleted(Task[] tasks) {
      if (tasks.All(task =&gt; task.IsCompleted) &amp;&amp; TierCleanupCompleted != null) {
          TierCleanupCompleted(this, new EventArgs());
      }
      RunTierData();
  }
  </code></pre>
  
  <p>Now in a test run, usually there are 5 tasks that are created, and they all run correctly. I put a <code>Debug.WriteLine("Task Return");</code> at the end of the function body to verify each task returns accordingly. The Action specified for ContinueWhenAll is <em>never</em> fired. I cannot figure out why. I thought the behavior of ContinueWhenAll would trigger the Action when all the specified Actions have returned (ie. completed).</p>
  
  <p>What would prevent ContinueWhenAll from firing the Action?</p>
  
  <p>Edit, here is the method that creates the tasks:</p>
  
  <pre><code>private IEnumerable&lt;Task&gt; CreateTierCleanupTasks() {
      using (FaultTrackObjectContext context = new FaultTrackObjectContext(this.TierInformation.EntityConnectionString)) {
          foreach (TeamCollection collection in context.TeamCollections.ToArray()) {
              yield return new Task(DeleteTeamCollection, collection.ID, m_CancellationTokenSource.Token);
          }
      }
  }
  </code></pre>