示例#1
0
 static Task MyMethodAsync(string message)
 {
     using (AsyncDiagnosticStack.Enter("  My message is: " + message))
     {
         return(MyMethodAsync(message, CancellationToken.None));
     }
 }
示例#2
0
        private static void Main(string[] args)
        {
            try
            {
                using (AsyncDiagnosticStack.Enter("Hi"))
                {
                    Test.MainAsync().Wait();
                }
            }
            catch (AggregateException ex)
            {
                foreach (var exception in ((AggregateException)ex.InnerException).InnerExceptions)
                {
                    Console.WriteLine(exception.ToAsyncDiagnosticString());
                }
            }

            Console.ReadKey();
        }