title: Why is AsyncContext needed when using async/await with a console application?
body: <p>I'm calling an async method within my console application.  I don't want the app to quit shortly after it starts, i.e. before the awaitable tasks complete.  It seems like I can do this:</p>
  
  <pre><code>internal static void Main(string[] args)
  {
      try
      {
          Task.WaitAll(DoThisAsync());
      }
      catch (Exception ex)
      {
          Console.Error.WriteLine(ex);
          throw;
      }
  }
  
  internal static async Task DoThisAsync()
  {
      //...
  }
  </code></pre>
  
  <p>But according to <a href="http://blog.stephencleary.com/2012/02/async-console-programs.html" rel="noreferrer">Stephen Cleary's article</a> it seems like I can't do that and should instead create some kind of context for the async to return to when it's done (e.g. <a href="https://github.com/StephenCleary/AsyncEx/wiki/AsyncContext" rel="noreferrer">AsyncContext</a>).</p>
  
  <p>The code above works though, and it returns on the main thread after <code>Task.WaitAll(DoThisAsync());</code>, so why do I need to use a custom context?</p>