sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Add Roslyn analyzer to warn of uncaught exception with async main

Open bruno-garcia opened this issue 5 years ago • 2 comments

To address: https://github.com/getsentry/sentry-dotnet/issues/321

The user must have a try/catch block at the top level async Main

Relates to #751

bruno-garcia avatar Sep 15 '20 15:09 bruno-garcia

this should no longer be an issue with https://github.com/getsentry/sentry-dotnet/pull/1646 @mattjohnsonpint will update the docs: https://docs.sentry.io/platforms/dotnet/troubleshooting/#unhandled-exceptions-are-not-captured-when-using-an-async-main-method

SimonCropp avatar Jun 29 '22 22:06 SimonCropp

@SimonCropp, I tried with latest with code similar to what I wrote in the troubleshooting docs, and it still fails. I don't think we fixed it.

mattjohnsonpint avatar Jun 29 '22 23:06 mattjohnsonpint

Thinking through this more, combining async main with exceptions and using blocks is the issue. It's not about Sentry in particular, but rather a general issue with .NET development. It would be a great suggestion for https://github.com/dotnet/roslyn-analyzers

mattjohnsonpint avatar Oct 06 '22 22:10 mattjohnsonpint