简体   繁体   中英

How to reduce error-message spam in visual studio when an unhandled exception occurs while debugging in Visual Studio (.NET6 web application)

When an unhandled exception occurs in let's say a controller, every time I press 'Continue' to continue debugging, every middleware's await next(context) throws the error that occurred in the controller.

My question is whether it's possible to avoid having to press 'Continue' for every middleware that's been called before the controller in question.

在此处输入图像描述

Within the VS Exception Settings window you can configure when a break should happen for each exception type. I normally have this window open in a debug session and if I need to debug a specific exception I normally enable the check at Common Language Runtime Exceptions . When the exception gets thrown the debugger breaks and I can inspect what is needed. Now pressing F5 could lead to an endless session of pressing F5 again and again.

To avoid this, restore the default exception settings by pressing the most right toolbar icon or remove the check entirely. If you press F5 now, the debugger won't break anymore on handled exceptions.

VS 异常设置窗口

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM