Last active
December 15, 2015 23:22
-
-
Save trullock/135f43bf30ef2d48ac02 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ConsoleApp1 | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
Task.Run(() => Foo()).Wait(); | |
} | |
static async Task Foo() | |
{ | |
var result = GetAsync(); | |
await result; | |
// break here and observe result | |
} | |
static async Task<object> GetAsync() | |
{ | |
try | |
{ | |
throw new Exception(); | |
} | |
catch(Exception e) | |
{ | |
return Task.FromException(e); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment