只有打破对某些异常类型 [英] Only break for certain exception types

查看:97
本文介绍了只有打破对某些异常类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,异常处理是一个非常重要的事情,我们在我们所有的项目做。的主要原因是记录发生在客户的错误。这工作得很好,而不是问题的。

I know Exception Handling is a very important thing and we are doing it in all our projects. The main reason is to log errors that occur at the customers. This works fine and is not problem at all.

不过,虽然我仍然编码和运行使用Visual Studio应用程序,我不希望任何异常处理的。我想在该行调试器停止右侧的应用程序崩溃,而不是在某些错误记录我写的。而且我不希望转发与抛出异常!

But while I am still coding and running the application with Visual Studio I don't want any exception handling at all. I want the debugger stop right at the line the application crashed and not in some error logger I wrote. And I don't want to forward exceptions with throw!

但我仍然在寻找一种简单的方法来做到这一点。我可以写无数的#如果调试#如果发布语句周围的所有的try / catch但是这不是我想做的事情。是否有任何其他方式来处理这个问题呢?

But I am still looking for an easy way to do that. I could write countless #if Debug or #if Release statements all around the try/catch but that is not what I want to do. Is there any other way to deal with this problem?

推荐答案

(1)打开Visual Studio与您的项目结果
(2)调试菜单,异常结果
(3)对于您所关心的异常类型勾选时抛出框。

(1) Open Visual Studio with your project
(2) Debug Menu, Exceptions
(3) For the exception types you care about tick the Thrown box.

这将使它所以,每当选择的类型抛出一个异常,你会自动地闯了进去。当你想回到常规的调试回到同一例外窗口,然后单击全部重设,你就会返回到默认设置。

This will make it so that whenever an exception of the types chosen is thrown you will automatically break into it. When you want to go back to regular debugging go back to that same Exceptions window and click "Reset All" and you'll go back to the default settings.

这篇关于只有打破对某些异常类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆