I am looking into the exception handling on tasks with below program. The program runs fine and exception was handled if I run with Ctrl + F5. However, it stopped at the throw exception line when I run with F5.
static void Main(string[] args)
{
try
{
Task.Run(() => test()).Wait();
}
catch (Exception)
{
Console.WriteLine("Caught");
}
}
private static Task test()
{
throw new NotImplementedException();
}
I wonder if my test program is working(caught the exception). Could this relate to my Visual Studio setting(I am using VS2013). Thank you