Exclude certain projects from stepping through during debug in VS2010?

ぐ巨炮叔叔 提交于 2019-12-19 07:52:14

问题


I am working on a couple of projects (A and B) in a large VS2010 solution (all in C#). There are many cases where methods from project A call through to one or more of the projects in the solution for which I am not responsible, which in turn call through to project B. When stepping through with the debugger from project A, I am forced to step through a host of methods in these other projects, in which I have no interest, before I finally reach the call to project B. Further, when stepping out of project B, I have to step all the way back through the call stack of uninteresting methods before I am back to project A.

I am currently working around this by setting breakpoints at the entry and exit points in projects A and B, but I find that a lot of my time is spent setting these breakpoints in the correct places, and I feel that my life would be a lot easier if I could just disable step-through for certain projects.

I am aware of the DebuggerStepThroughAttribute, but its use is not workable in my situation as (i) I would have to add it in many places and (ii) the guys in my office who ARE interested in stepping through this code would not be happy.

Any ideas?


回答1:


Yes, this is possible by enabling Just My Code and preventing symbol loading for the DLLs you don't care about.

To enable Just My Code:

  • Debug » Options and Settings... » General » check "Enable Just My Code (Managed only)".

To prevent symbols from loading for a DLL:

  • Debug » Options and Settings... » Symbols » click "All modules, unless excluded"
  • Click "Specify excluded modules"
  • Add the names of the modules you want to exclude. Their symbols will not be loaded when you debug your application.

Now, when you do an F11 step-into from project A into project B that goes through project C, as long as you don't have the symbols for C loaded, the step-into will go directly into B.

To ensure that the symbols for C aren't loaded:

  • Start debugging
  • Get to a point where C is loaded
  • Open the Modules window (Ctrl+Alt+U), scroll to the entry for C
  • The "Symbol Status" column should say "Loading disabled by Include/Exclude setting."


来源:https://stackoverflow.com/questions/3878888/exclude-certain-projects-from-stepping-through-during-debug-in-vs2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!