Skip to content

Instantly share code, notes, and snippets.

@trullock
Last active December 15, 2015 23:22
Show Gist options
  • Save trullock/135f43bf30ef2d48ac02 to your computer and use it in GitHub Desktop.
Save trullock/135f43bf30ef2d48ac02 to your computer and use it in GitHub Desktop.
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