views:

210

answers:

2

I am trying to debug a unit test. When I step into the code of the class I want to test VS2008 show the disassembly rather than the source. I have checked in the modules window and the status for the module in question reads "symbols loaded" so everything looks OK

The project is c#, I am using Visual Studio 2008 SP1, anyone got any ideas, it is driving me nuts!

+1  A: 

Symbols and source code is not the same thing. You need either have the source code for your module in the same place on disk it was on the build machine, or set up the source server: http://msdn.microsoft.com/en-us/magazine/cc163563.aspx

Grzenio
What about showing the disassembly? Will Source Server do that?
Robert Harvey
Sorry, I should have been more clear... I have a class library project and Test project that references the class library as a project reference both of which are in the same VS2008 solution so I therefore have the source code as well as the debugging symbols (pdb files)
withakay
@withakay, this is a bit weird then. My guess is that the reference could go wrong, could you try to delete it and recreate it?
Grzenio
@Robert with the right redirects in your PDBs registered in your Source Server symbols, it will actually pull the version of the source code out of source control that was used to build that assembly... not just use whatever is on the filesystem. Now that's nice!
Anderson Imes
A: 

If you right click in the source window, there will be a context menu option "Go To disassembly". That will show you what your looking for. Though, typically most people tend to ask how to get to source code from disassembly, not how to get to disassembly from source code! :)

@Grzenio is correct in that if you have the source and symbols and are still seeing dissassembly, something is out of whack.

Try checking for versions of the dll in the global assembly cache (GAC). You might also find other clues by checking the properties of any custom dlls that have been referenced. Specifically the properties "Specific Version" and "Copy Local". If either of these values are true, it could be a clue that the project references a GAC'd copy of a dependency dll.

Zach Bonham
"typically most people tend to ask how to get to source code from disassembly, not how to get to disassembly from source code! :)"Um, yeah that is what I want :-/
withakay
Sorry, got completely dyslexic on my response then! :)
Zach Bonham