2008-10-06

Make Visual Studio Prompt You For Debug Source Code File After Cancelling the First Time

I've run into this problem a few times where I've been given a copy of a dll from another development team that has a PDB file with it... but they forget to send me the source code...

While debugging, I get the prompt for the source code file the PDB has signalled the debugger for (since it doesn't know where to find it initially...) and of course, since I don't have it, I click Cancel.

When you click cancel at this prompt, it adds to a repository in the solution of files NOT to search for. This is annoying, because after that first prompt, you ask the team for the source code so you can go back, expecting the prompt again, and step into the potentially problematic code.

Well, Visual Studio supresses the prompt because of this list within the solution of files not to search for.

"How do I get this back?!" you ask...

Here's the "solution" (get it?!):

The 'Do not search for these source files' dialog

Right-click your solution in Solution Explorer and go to Properties.
Then click on the "Debug Source Files" section under Common Properties.
At the bottom-right of the dialog, there is a "Do not look for these source files:" section. There lies the last-known path to the source-code file (which I assume is provided by the PDB.)
Delete that sucker and Apply/OK out.

Debug again and when you get to the point you want to step into that code again, you will get the prompt and life will be happy again (well, happier, until you fix your bug.)

Happy coding...

3 comments:

Anonymous said...

YOu dead set legend. Thanks.

That One Guy said...

I'm glad it worked for you.

I love Visual Studio, but that's one of the most annoying things about it I've run into. It should ask you if you don't want to have that prompt again; maybe some checkbox on the dialog that comes up.

Maybe they've done so in Visual Studio 2010; here's to hoping.

Unknown said...

Awesome, thanks for the info! This one could have turned into a real head-scratcher... ;)