Skip to content

Instantly share code, notes, and snippets.

@ProdigySim
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save ProdigySim/9511953 to your computer and use it in GitHub Desktop.

Select an option

Save ProdigySim/9511953 to your computer and use it in GitHub Desktop.
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
public class Class1
{
static Class1()
{
DoThing();
}
static async void DoThing()
{
Console.WriteLine("Doing something");
await ThrowingTask();
Console.WriteLine("Done with task!");
}
static async Task ThrowingTask()
{
await Task.Delay(100);
throw new Exception("Oh my gosh an exception!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment