Gotchas: Visual Studio debugging and stepping through source

Monday, December 24, 2007 – 3:26 PM

I ran into a problem this morning where Visual Studio 2008 wasn’t letting me debug through some source files. These files weren’t part of my solution, I was getting them from an external share. I’d checked all the obvious things; enable just my code was disabled and the symbols were loading correctly. Alas, the “Go To Source Code” menu item was still grayed out.

Turns out that at some point I’d been stepping through code and told VS to not load this file (because the share wasn’t available) and it has used this as the default behavior ever since. By “told VS” I mean at some point I stepped into a method and the Find Source dialog came up and I chose “Cancel”. VS stores a list these ignored source files in the solution settings and will not ask you again. It gives you no indication as to why the source is unavailable – room for some UI improvement here I feel.

How to fix it

To reset the solution do the following:

  • Open the solution properties dialog (right-click on the solution in the Solution Explorer).
  • Open the Common Properties node and select Debug Source Files.
  • Remove the files from the “Do not look for these source files” list.
  • Click “Apply”.
  • You may have to reload the solution to get these new settings applied.

Now you should be able to view the source or at least VS will show you the Find Source dialog again.

This only cost me a few hours. My Christmas present to you, an hour or two of your life back. Enjoy.

Technorati Tags: ,

Currently listening to:
Foo Fighters – The Colour and the Shape


  1. 10 Responses to “Gotchas: Visual Studio debugging and stepping through source”

  2. You just saved me a bit of trouble figuring out where VS stores this annoying preference. Thanks! =)

    By JP on Jan 26, 2008

  3. wow. this was hard to find. Thanks a million.

    By Thank you on Dec 7, 2008

  4. I figured out this problem but rather than using delete key I was trying to use the ‘x’ button.

    By Vaishnavi on Feb 13, 2009

  5. Many thanks indeed for this tip!

    By Sir Garence on Jun 3, 2009

  6. Thanks man! Exactly what I was looking for (exact experience as you described too!)

    By appreciative on Jun 17, 2009

  7. Great! I ‘ve always just ignored that “source code unavailable” box; now I know how make it work.

    By K Reid on Jan 19, 2010

  8. I was wondering what put them their!

    Thanks

    By Bassem on Apr 17, 2010

  9. You saved me from pulling out what little hair I have left, thanks much! :)

    By Patrick Montelo on Apr 28, 2010

  10. Thanks for the info! I always wonder how to undo these Cancels…

    By splintor on Jun 22, 2010

  11. Thanks, exactly what I was looking for.

    By Fletch on Jun 17, 2011

Sorry, comments for this entry are closed at this time.