【问题标题】:How can keep the debugger from breaking on NotImplementedException exception?如何防止调试器因 NotImplementedException 异常而中断?
【发布时间】:2010-02-18 17:41:07
【问题描述】:

我试过这个,但它似乎不起作用:

        Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
        Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
        AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

    static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
    {
        //suppress ???
    }

    static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
    {
        //suppress ???
    }

【问题讨论】:

    标签: c# exception debugging suppress notimplementedexception


    【解决方案1】:

    按 Ctrl+D、E 并取消选中您不希望调试器中断的异常。

    编辑:如果对话框不起作用,您也可以按照these answers 中的说明通过宏来完成。

    【讨论】:

    • 这就是我首先要做的,但不知何故我的异常对话框搞砸了,“用户未处理”列丢失或被剪裁,没有滚动条。
    • @John,如果您在主设置中未选中“调试|只是我的代码”选项,“用户未处理”列将消失。如果您重新打开“仅我的代码”,那么您的“用户未处理”列应该会重新显示在“例外”窗口中。
    • 在阅读上述评论之前,我重置了我的 Visual Studio 设置配置文件,它又回来了。它将“只是我的代码”选项重置为选中,所以我猜这就是它回来的原因。我从来不知道有联系。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-08-21
    • 1970-01-01
    • 2011-12-02
    • 2013-08-07
    • 2020-03-02
    • 2011-04-02
    • 2014-09-01
    相关资源
    最近更新 更多