tags:

views:

32

answers:

1

in one line of my solution which is made of a couple of projects I want to debug one line of code, something like this:

mThisLibrary.DoSthMethod();

but when I put my break point on that line and press F11, the debugger says that "There is no source code available" so I cannot get into it deeper. BUT the source code is there so for example if I click F12 on the method name, I can go to its implementation easily. I am not sure why the debugger cannot get inside that method.

Any ideas?

+1  A: 

Make sure that the assembly you are referencing was built with a Program Database File for debugging purposes. If the debugging information is not present, this can happen.

Typically, if the library is part of the same solution, just make sure that all of the projects are being built in Debug. By default, Debug will generate the .pdb files required for debugging, as well as turn off the optimizations that can sometimes cause debugging difficulties.

Reed Copsey
Thanks, so I checked and all projects were in Debug mode but still not sure how to see if the pdb file exists or not .
BDotA
@BDotA: Have you tried just doing a full rebuild? THat will often fix this type of thing... However, the .pdb should be sitting next to the .dll/.exe in the bin\Debug (or bin\x86\Debug) folders [default paths]
Reed Copsey
Thanks, Ok I checked all the things you mentioned. but still it cannot step into that method. so this method is in a library that is one of the projects I have included in my solution and one of the other projects in my solution is referencing and using it , so I did change the reference in the References section to point to this Project reference in the solution as well... I marked your answer as the correct answer because I think these are all the things we can check to fix this! However not fixed yet for me! Thanks for the help.
BDotA
@BDotA: Make sure that the projects referencing it use the project, not the .dll, to add the reference, as well. That often helps...
Reed Copsey
Ok, I could fix it but this problem is very annoying. The problem is that although I had changed all the references to their project refs but still it was loading it from the DLL version because Visual Studio looks at the first time that it is using that DLL. so ANOTHER dll in one of the projects was internally using it first so the fix is to ALSO INCLUDE ALL the lower level projects that are using that DLL and change their refs which usually it is even hard to know what to include. VB 6.0 was doing a MUCH BETTER job by only looking at our VBG projects. but VS.NET looks at the FIRST use time
BDotA
@BDotA: Yeah, that's the problem - if you find it from a DLL, and it's a different build, you can't debug. You need to use project refs always, if possible.
Reed Copsey