<NME> TraceRunner.cs
<BEF> using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;

public class TraceRunner
{
    public static List<string> Capture(Action action)
    {
        var myTraceListener = new MyTraceListener();
        try
        {
            Trace.Listeners.Add(myTraceListener);
            action();
            Thread.Sleep(100);
        }
        finally
        {
            Trace.Listeners.Remove(myTraceListener);
        }
        return myTraceListener.Messages;
    }

}

<MSG> Simplify async method handling and fix some bugs (#128)

* Simplify async method handling and fix some bugs

* Improve generation of StopMethodTimerStopwatch method of async state machine in release mode

<DFF> @@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Threading;
+using System.Threading.Tasks;
 
 public class TraceRunner
 {
@@ -21,4 +22,20 @@ public static List<string> Capture(Action action)
         return myTraceListener.Messages;
     }
 
+    public static async Task<List<string>> CaptureAsync(Func<Task> action)
+    {
+        var myTraceListener = new MyTraceListener();
+        try
+        {
+            Trace.Listeners.Add(myTraceListener);
+            await action();
+            Thread.Sleep(100);
+        }
+        finally
+        {
+            Trace.Listeners.Remove(myTraceListener);
+        }
+
+        return myTraceListener.Messages;
+    }
 }
\ No newline at end of file

Simplify async method handling and fix some bugs (#128)