views:

781

answers:

5

When debugging in Visual Studio 2008 I get the error "There is no source code available for the current location" but it does not prompt me to browse for source code. If I click "Show Disasembly" and then right click to select "Go to source code" I get the error "The source code cannot be displayed.

How do I load the source code while in debug mode?

Edit: I have the source code (it is just another class which is not part of this solution) and it is compiled in debug mode.

A: 

I have had similar messages when I was trying to debug a dll compiled in release mode. In these cases I just recompiled them in Debug mode.

William Edmondson
A: 

Looks like you are trying to debug into something that you do not have the source code for. See: this.

Jimmy Chandra
A: 

I just found the problem. There was an incorrect reference in a project just checked in by another developer. This is why I hate solutions with 20 projects.

jellomonkey
A: 

When this happens to me I just add that project to my solution. Alternatively you should be able to load the assembly's PDB into your Symbols.

tsilb
+1  A: 

If you are debugging from a different location to where you originally built the solution, i.e. you have attached to a process which has debugging symbols:

You can tell visual studio where the source is located by right clicking on the solution in the solution explorer and adding the path-to-your-source to the "Directories containing source code" under the "Debug Source Files".

I have tried this under VS2008 only.

Mike