3

Some days back, I had enabled third-party debugging for the Ninject DLL to test some things. Now I am unable to detach the debugger from the Ninject source files and because of that the code is stepping (trying to step if it could not find the source file) into the Ninject source. The same problem is happening for Telerik source code too. I have checked "Enable Just My Code (Managed Only)" in the debugging options, but the Visual Studio still steps into third-party code. How do I debug just my code and avoid stepping into the third-party DLL file?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jatin
  • 4,023
  • 10
  • 60
  • 107

2 Answers2

1

JeffN825's answer didn't work for me either unfortunately.

This did:

Create a post build step for your executable project:

Under Build Events > Post-build event command line, add the following script (replacing with your path) to remove the pdb files following their creation:

ECHO Y | DEL  $(SolutionDir)<MyProject>\bin\Ninject.pdb
ECHO Y | DEL  $(SolutionDir)<MyProject>\bin\Ninject.Web.Mvc.pdb

Now when I run my project, the Ninject code is not stepped into.

gbro3n
  • 6,729
  • 9
  • 59
  • 100
  • 1
    +1. I don't believe Ninject ought to be publishing the pdb files this way in the first place, and I have opened an issue to this effect [here](https://github.com/ninject/ninject/issues/62). – StriplingWarrior Jul 02 '12 at 18:53
0

You need to clean the symbol cache for Visual Studio - see Stack Overflow question How do you clear your Visual Studio cache on Windows Vista?.

Also check under Tools -> Options -> Debugging -> Symbols.

and remove and source locations in there that you don't want to debug. And delete the files in the "Cache symbols in this directory" textbox value, and click Empty Symbol Cache (I say to do all of these because sometimes I find it a bit quirky).

Then restart Visual Studio, and make sure your Ninject/Telerik DLL files don't have .pdb files sitting next to them when you start debugging again.

Community
  • 1
  • 1
Jeff
  • 35,755
  • 15
  • 108
  • 220
  • 1
    Jeff, I cleared the cache and symbols cache following the link given, but somehow I could not get VS from stepping into Ninject code. However I noticed a strange thing. When I "uncheck" the "Enable Just My Code" checkbox of debugging options, the VS does not step into Ninject code. Its very strange that the Visual Studio's "Enable Just MY Code" option works in reverse way. Or perhaps I am not able to understand it at a basic level. – Jatin Aug 13 '11 at 06:50
  • Jeff, I cannot get rid of the Ninject/Telerik pdbs. If I delete them manually, they get created the next time I build the solution. – Jatin Aug 13 '11 at 13:57
  • Are you building the Ninject/Telerik sources yourself? – Jeff Aug 13 '11 at 21:30
  • Jeff, I am afraid not. For Telerik I just import the dll by using "Add Reference". For Ninject, I install Ninject.MVC3 from the Nuget using "Add Library Reference". As far as source code is concerned, I had built up the source for Ninject for debugging purpose (generating pdb's) some days back when I wanted to debug it. I think that seems to be the problem but I am not sure how to handle it. – Jatin Aug 14 '11 at 02:05