程序异常总是捕获不到未处理异常问题

 

.net程序排除不可预见的错误就会抛出上述错误,但是有时候上述错误不一定影响程序的正常运行,但是给用户看到这样的东西是不太好的,因此需要将其disable

方法如下

 

方法一:

To disable Just-In-Time debugging of a Windows Form

  1. Set the jitDebugging value in the machine.config or application.exe.config file, located in thesystem.windows.forms section totrue. For example:

    <configuration>
        <system.windows.forms jitDebugging="false" />
    </configuration>
    
  2. In addition, Windows Forms created by using C++ must have the DebuggableAttribute set in a .config file or within their code. If you compile with/Zi and without/Og, the compiler sets this attribute for you. If you want to debug a non-optimized release build, however, you must set this yourself by adding the following line to your application's AssemblyInfo.cpp file:

    [assembly:System::Diagnostics::DebuggableAttribute(false, false)]; 
    

    For more information, see DebuggableAttribute.

 

方法二:

To disable Just-In-Time debugging by editing the registry

  1. In the Start menu, click Run.

  2. In the Run dialog box, type regedit, then clickOK.

  3. In the Registry Editor window, locate and delete the follow registry keys:

    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger

    • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\DbgManagedDebugger

  4. If your computer is running a 64-bit operating system, delete the following registry keys also:

    • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug\Debugger

    • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\DbgManagedDebugger

  5. Take care not to accidentally delete or change any other registry keys.

  6. Close the Registy Editor window.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值