Recently I switched to ASP.NET Core and mainly I love it!
There is one annoying part though - when I have an Exception this bubbles up through all the parts of await next.Invoke()
in my whole application. That means every custom Middleware or filters that use async/await.
This means I have to press continue / F5 about 8 times every time an Exception occurs. Especially while working on tricky code this is super annoying and a big waste of time and mental energy.
See this example below:
What I tried:
- enabled Just my Code - does not solve - as this is happening in my code.
- disable this type of exception in the Exception Settings - this does not solve my problem, because the first (yellow) I actually need.
- fill my whole application with [DebuggerNonUserCode] - also something that I don't like to do - as there might be legit exceptions not related to some deeper child exceptions.
- see for more information this question
Questions:
- As Visual Studio seems to be able to differentiate between these two Exceptions (yellow and green) - is it possible to not break at all at the "green" Exceptions?
- How is everyone else handling this? Or do most people not have 5+ await next.Invoke() in their code?
- Any other workarounds?
UPDATE The workaround of @MichelleWang works with specific cases, but it has a lot of configuration and maintenance if you work with a lot of different or complicated projects. Usually the async / awaits are scattered over a lot of different classes. Some filters, some base projectcode, some domain code, etc.
In a way VS already distinguishes between these two types of breaks - how to just break on yellow in general?
UPDATE
Found an existing feature request - please help and upvote there: