title: Ambiguous Invocation on Generic ContinueWith
body: <p>I'm writing a simple C# console application that uses Asynchronous Tasks and Entity Framework (with the intent to run it under Linux (RHEL) with Mono, but that's a whole other challenge).  Note that I'm targeting .NET 4.0, so I'm using <code>.ContinueWith()</code> instead of <code>await</code>.</p>
  
  <p>This, plus the EF DB model of a Northwind Database, is the entirety of the application:</p>
  
  <pre class="lang-cs prettyprint-override"><code>using System;
  using System.Linq;
  using System.Threading.Tasks;
  
  namespace MonoEF
  {
      class Program
      {
          private static Model.NorthwindEntities _db = new Model.NorthwindEntities();
  
          static void Main(string[] args)
          {
              try
              {
                  GetCustomerNamesAsync().ContinueWith(t =&gt; {
                      if (t.IsFaulted) Console.WriteLine(t.Exception.Flatten.ToString);
                          else if (t.IsCompleted) foreach (string result in t.Result) Console.WriteLine(result);
                      });
  
                  Console.ReadLine();
              }
              catch (Exception ex)
              {
                  Console.WriteLine(ex.ToString());
              }
          }
  
          private static Task&lt;string[]&gt; GetCustomerNamesAsync()
          {
              return Task.Factory.StartNew(() =&gt; (from c in _db.Customers select c.ContactName).Distinct().ToArray());
          } 
  
      }
  }
  </code></pre>
  
  <p>The problem is I'm getting the following error at the <code>.ContinueWith()</code>:</p>
  
  <pre><code>Ambiguous Invocation:
    System.Threading.Tasks.Task.ContinueWith(System.Action&lt;System.Threading.Tasks.Task&lt;string[]&gt;&gt;) (in class Task&lt;string[]&gt;)
    System.Threading.Tasks.Task.ContinueWith(System.Action&lt;System.Threading.Tasks.Task&gt;) (in class Task)
  match
  </code></pre>
  
  <p>To me, the invocation shouldn't be ambiguous, the compiler should prefer the generic Task over the non-generic Task, especially as it's the output of <code>GetCustomerNamesAsync()</code>.  However, as a VB.NET developer, I'm probably relying on <code>Option Infer</code> in this situation.</p>
  
  <p>How would I go about explicitly letting the compiler know which invocation I want it to use in C#?</p>