title: Garbage collection async methods
body: <p>I just noticed something really strange with regards to garbage collection.</p>
  
  <p>The WeakRef method collects the object as expected while the async method reports that the object is still alive even though we have forced a garbage collection. Any ideas why ?</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          WeakRef();
          WeakRefAsync().Wait();
      }
  
      private static void WeakRef()
      {
          var foo = new Foo();
          WeakReference fooRef = new WeakReference(foo);
          foo = null;
          GC.Collect();
          Debug.Assert(!fooRef.IsAlive);
      }
  
      private static async Task WeakRefAsync()
      {
          var foo = new Foo();
          WeakReference fooRef = new WeakReference(foo);
          foo = null;
          GC.Collect();
          Debug.Assert(!fooRef.IsAlive);
      }
  }
  
  
  public class Foo
  {
  
  }
  </code></pre>