How to run a method with Task.WhenAll for every item in list and store the results?
<p>I'm working on an application that retrieves RSS feeds every few minutes and downloads the items on the feeds matching a set of criterias. However, I'm struggling to debug the code below. When I set up breakpoints in my code, it doesn't go past the first line in <code>GoThroughFeeds()</code>. I suspect that there is something wrong with the way I create and handle tasks. Initially, I created the tasks using <code>Task.Run()</code>, but they would run twice (the second batch after the await). What am I doing wrong?</p>

<pre><code>private async void RunOnInterval(TimeSpan delay)
{
  do
  {
    await GoThroughFeeds();
    await Task.Delay(delay);

  } while (true);
}

private async Task GoThroughFeeds()
{
  Feed[] updatedFeeds = await Task
    .WhenAll(Repository.Data.Feeds.Select(feed =&gt; new Task&lt;Feed&gt;(() =&gt; FetchRss(feed))));

  // Do more stuff with the feeds
}

public Feed FetchRss(Feed feed)
{
  feed.Items = Repository.GetItems(feed);
  return feed;
}
</code></pre>