0

I'm writing a console app that uses lots of async methods; so I've made an async Main method that I can await in:

static void Main(string[] args)
{
    MainAsync(args).Wait();
}

static async Task MainAsync(string[] args)
{
    // Can use await here
}

However, when an exception occurs; the debugger will always break me on the .Wait() call. This is not a very good experience.

Is there anything I can do so that the debugger breaks where the exception occurs rather than here? I'm using VS2015 and targeting .NET 4.6 if that influences the answer.

Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275
  • See [this](http://stackoverflow.com/questions/18084983/debugger-not-breaking-stopping-for-exceptions-in-async-method) – Yuval Itzchakov Jul 22 '15 at 18:19
  • See [the second part of this blog post](http://blogs.msdn.com/b/visualstudioalm/archive/2015/07/20/finding-swallowed-and-async-exceptions-using-intellitrace-in-vs2015.aspx). – Stephen Cleary Jul 22 '15 at 19:37

0 Answers0