gpt4 book ai didi

c# - .net 是否在每次打开 try block 时注册一个新的异常处理程序?

转载 作者:太空狗 更新时间:2023-10-29 21:51:43 25 4
gpt4 key购买 nike

只是阅读第一次和第二次机会异常。并且在调试调试器时,调试器会在程序出现之前获得第一次机会异常。请记住,附加异常处理程序是如何工作的。是否每次打开 try block 时都会附加另一个异常处理程序?

最佳答案

这是我在 Junfeng Zhang's 中找到的精彩文章: "From Unhandled Exception to Debugger Attach"

这称为事后调试设置,您可以在 Windows 系统注册表中自行设置事后调试器,当 Visual Studio 安装注册表项时 \\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug 包含:

"C:\WINNT\system32\vsjitdebugger.exe"-p %ld -e %ld

因此 Visual Studio JIT 调试器被定义为默认的事后调试器。

只是关键点:(有关详细信息,请参阅文章)

Windows can handle user-mode errors in a variety of ways. The following sequence shows the precedence used for error handling:

  1. If a user-mode debugger is currently attached to the faulting process, all errors will cause the target to break into this debugger.

  2. If no user-mode debugger is attached and the executing code has its own exception handling routines (for example, try - except), this exception handling routine will attempt to deal with the error.

  3. If no user-mode debugger is attached, and Windows has an open kernel-debugging connection, and the error is a breakpoint interrupt, Windows will attempt to contact the kernel debugger.

关于c# - .net 是否在每次打开 try block 时注册一个新的异常处理程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7819725/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com