Visual Studio 2015打破未处理的异常不起作用

编程入门 行业动态 更新时间:2024-10-28 21:26:45
本文介绍了Visual Studio 2015打破未处理的异常不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Visual studio曾经有一个特定的复选框来打破未处理的异常。在2015年,这已被删除(或移动到我找不到的地方)。所以现在如果我无法提供一个用户级的异常处理程序,我的转换的项目不再破坏。我不想打破所有抛出的异常,因为我处理具体的。只是在那里我不能提供一个特定的处理程序。

现在我的代码只是退出当前的过程,并在下一个调用堆栈位置继续执行,不好。

任何人都知道如何在Visual Studio 2015中得到这个回报?我刚刚升级到社区版。

解决方案

有一个名为异常设置的新窗口出现在右下方的窗格中默认开始调试时。它具有您期望的所有选项。

您可以使用 CTRL + ALT + E

这允许您选择哪些异常导致调试器中断。

关键在于,您还可以设置这些异常是否总是中断,或者只是在未处理的异常时中断,但设置不是很直观。

您需要先在工具>选项>调试下检查启用我的代码。

这样就可以右键单击列标题在新的异常设置窗口中,并添加附加操作列,然后允许您将每个异常设置为在用户代码中未处理时继续。

此处更多:

blogs.msdn/b/visualstudioalm/archive/2015/02/23/the-new-exception-settings-window-in-visual-studio-2015.aspx

Visual studio used to have a specific checkbox to "Break on Un-handled exception". In 2015 this has been removed (or moved somewhere I cannot find it). So now my converted projects no longer break if I fail to provide a user-level exception handler. I don't want to break on all "thrown exceptions" because I handle specific ones. Just where I fail to provide a specific handler.

Right now my code simply exits the current procedure and continues execution at the next call stack location, NOT GOOD.

Anyone know how to get this back in Visual Studio 2015? I just upgraded to the community edition yesterday.

解决方案

There's a new window called "Exception Settings" that appears in the lower right pane by default when you begin debugging. It has all of the options you would expect.

You can bring it up with CTRL+ALT+E

This allows you to cherry-pick which exceptions cause a break in the debugger.

The key, though, is that you can also set whether these exceptions always break, or only break when it's an unhandled exception -- but setting this is not very intuitive.

You will need to first check "Enable Just My Code" under Tools > Options > Debugging.

This then allows you to right-click the column header (Break When Thrown) in the new Exceptions Settings window, and add the "Additional Actions" column, which then allows you to set each exception as "Continue when unhandled in user code".

More on this here:

blogs.msdn/b/visualstudioalm/archive/2015/02/23/the-new-exception-settings-window-in-visual-studio-2015.aspx

更多推荐

Visual Studio 2015打破未处理的异常不起作用

本文发布于:2023-11-10 05:53:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1574526.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   异常   未处理   Visual   Studio

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!