3

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.

3
  • What kind of project is this? Commented Jul 8, 2009 at 15:32
  • ASP.NET web application and several class projects. Commented Jul 8, 2009 at 15:33
  • I am assuming the source code you are attempting to debug is code you have written... Commented Jul 8, 2009 at 15:38

5 Answers 5

6

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.

Sign up to request clarification or add additional context in comments.

1 Comment

This answer is also useful in cases the "remembered" source code path is not the one you want (for example when you multiple variants of the same source code tree). For Visual Studio 2010 it is also a solution's property but is to be found under "Properties / Common Properties / Debug Source Files".
1

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.

Comments

0

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.

Comments

0

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

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.