简体   繁体   English

在 Visual Studio(.NET6 web 应用程序)中调试时发生未处理的异常时,如何减少 Visual Studio 中的错误消息垃圾邮件

[英]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,调试器将不会再因处理异常而中断。

VS 异常设置窗口

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 2008 - 发生未处理的异常时应用程序关闭 - Visual Studio 2008 - Application closes when unhandled exception occurs 发生未处理的异常时 Visual Studio 监视变量值 - Visual Studio watch variable values when an unhandled exception occurs 如何在Visual Studio中调试时强制执行异常? - How to force an exception while debugging in Visual Studio? 使用.Net6 Windows 10 的 OmniSharp 的 Visual Studio 代码出现错误 - Getting Error on Visual Studio Code for OmniSharp with .Net6 Windows 10 阻止Visual Studio调试打破明显的“未处理的异常” - Prevent Visual Studio debugging breaking on an apparent “unhandled exception” 在Visual Studio中调试时捕获/取消未处理的异常 - Catch / cancel an unhandled exception whilst debugging in Visual Studio 调试asp.net应用程序时在Visual Studio中查看会话 - View sessions in Visual Studio when debugging a asp.net application Visual Studio Designer未处理的异常 - Visual Studio Designer unhandled exception Visual Studio 2017 工作室显示错误“此应用程序处于中断模式”并引发未处理的异常 - Visual Studio 2017 studio showing error 'This application is in break mode' and throws unhandled exception 在Visual Studio中调试.NET应用程序时,如何远程访问端口? - How do I access a port remotely while debugging a .NET application in Visual Studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM