title: C# Task memory leak
body: <p>I have a memory leak issue with a Task object in C#.</p>
  
  <p>This code will give me the memory leak:</p>
  
  <pre><code> Task task = Task.Run(() =&gt;
              {
                  result = analysis.InspectImageAsync(arg1, arg2);
              });
  
      await task;
  
  
  
      task.ContinueWith( (thisTask) =&gt;
              {
                  MessageBox.Show("kill");
                  thisTask.Dispose();
                  thisTask = null;
                  GC.Collect();
              });
  </code></pre>
  
  <p>If I run it without the Task.Run():</p>
  
  <pre><code>result = analysis.InspectImageAsync(arg1, arg2);
  </code></pre>
  
  <p>everything works great and my memory is flat flat flat (no leaks!)... but I need this to be async.</p>