.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Threading.Tasks;		

public class Program
{
	public static void Main()
	{			
		MainAsync().Wait();
		Console.WriteLine("Hello World");
	}
	
	public static async Task MainAsync()
	{
		try
		{
			await Task.Run(async () => 
			{
				throw new Exception("Exception in Task");
			});
		}
		catch (Exception ex)
		{
			Console.WriteLine("Caught Exception: {0}", ex.Message);
		}	
	}
}
;