[英]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.当假设 controller 中发生未处理的异常时,每次我按“继续”继续调试时,每个中间件的await next(context)
都会抛出 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.我的问题是,是否有可能避免在有问题的 controller 之前调用的每个中间件都必须按“继续”。
Within the VS Exception Settings window you can configure when a break should happen for each exception type.在 VS 异常设置 window 中,您可以为每种异常类型配置何时应该发生中断。 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 .我通常在调试 session 中打开这个 window,如果我需要调试特定的异常,我通常会在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.现在按 F5 可能会导致无休止的 session 一次又一次地按 F5。
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.如果您现在按 F5,调试器将不会再因处理异常而中断。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.