如何强制调试器跳过一段代码? [英] How to force debugger to skip a piece of code?

查看:43
本文介绍了如何强制调试器跳过一段代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目中有大量代码已经调试了其中的50%.
每次尝试调试它时,都必须在不需要的代码段之后手动设置断点来跳过它.
有没有办法告诉调试器不要调试那部分代码?对此有任何扩展吗?

There is huge amount of code in my project which already debugged 50% of it.
Every time I try to debug it I have to manually set breakpoints after unwanted piece of code to skip it.
Is there a way to tell debugger not to debug that part of code ? Any extension for this ?

我们的面部调试器在1500行上.

Let's face debugger is on line 1500.

Method1(){
   Line 1500 CODE
   Line 1501 CODE
   ...
   Line 1726 CODE
   Line 1727 CODE
   ...
   Line 2200 CODE
}

我不需要调试1727年至2200年之间的线路.

I won't need to debug lines between 1727 and 2200.

注意:这不只是一件.否则,我可以手动设置断点

推荐答案

如果有问题的代码封装在方法中,则可以通过应用

If the code in question is encapsulated in a method, you can skip the method by applying the DebuggerStepThroughAttribute on it.

除此之外,如何设置断点.

Other than that, setting breakpoints is how to do it.

因此,将这段代码提取到一个方法中,然后将属性应用于它;)

So, extract this code into a method and apply the attribute to it ;)

这篇关于如何强制调试器跳过一段代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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