简体   繁体   English

如何从代码中更改“引发异常时中断”调试器行为

[英]How can I change “Break When an Exception is Thrown” debugger behaviour from code

I want in some part of code enable Break When an Exception is Thrown debugger behaviour from code, and after some part of code restore initial value. 我想在代码的某些部分中启用“异常发生时抛出异常” ,以便代码中的调试器行为,并在代码的某些部分后恢复初始值。 Is it possible? 可能吗?

maybe you can try do this 也许你可以尝试这样做

try
{
// ... <- your code here
}
catch (Exception e)
{
    System.Diagnostics.Debugger.Break();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在抛出异常时阻止调试器进入我的方法? - How can I prevent the debugger from entering my method when Exception is thrown? 引发异常时,调试器不会破坏代码 - Debugger does not break the code when exceptions are thrown 在C#中,抛出异常时能否执行代码? - in C# can I have code execute when an exception is thrown? 引发异常时更改HTTP状态代码 - Change HTTP status code when exception is thrown 异步:如何打破抛出异常的确切代码行? - Async: How to break on exact line of code that has thrown the exception? 在反序列化具有来自 JSON 的重复键的字典时,如何强制抛出异常? - How can I force an exception to be thrown when deserializing a dictionary with duplicated keys from JSON? 如何从CompletedEventArgs中获取抛出的异常类型? - How can I get the type of thrown exception from CompletedEventArgs? 从第三方组件抛出StackOverflowException时如何中断我的源代码? - How to break at my source code when StackOverflowException is thrown from third party component? 我如何知道是否故意抛出了异常? - How can i tell if an Exception was deliberately thrown? 如何从中断模式异常中获取更多信息 - How can I obtain more information from Break Mode exception
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM