5

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?

Chris Schmich
  • 29,128
  • 5
  • 77
  • 94
Mike Chamberlain
  • 39,692
  • 27
  • 110
  • 158

1 Answers1

14

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."
Chris Schmich
  • 29,128
  • 5
  • 77
  • 94
  • This helped us solve a problem where none of our breakpoints were getting hit so we finally saw that "Loading disabled by Include/Exclude setting" and removed the checkbox for our dll. Now our breakpoints hit OK! Strange thing is...we don't know how it got in there the first time! – Josh P Mar 03 '17 at 00:44
  • You can also right-click the project you want to exclude, select Properties > Build > Advanced, and set the Debugging information to 'None'. – user886079 Jul 19 '20 at 15:47