views:

963

answers:

5

C# desktop application on express edition. Worked then didn't work 5 seconds later.

I tried the following.

  • Ensure debug configuration, debug flag, and full debug info are set on all assemblies.
  • Delete all bin and obj folders and all DLLs related to the project from my entire machine.
  • Recreate projects causing the problem from scratch.
  • Reboot.

I have two WinForms projects in the solution. One of them loads the debug info, one doesn't. They both refer to the assembly I'm trying to get debug info on in exactly the same way in the project file. Any ideas?

+3  A: 

Start debugging, Debug + Windows + Modules. Right-click the assembly in the list, Symbol Load Information. You'll get a dialog that lists all the directories where it looked for the .pdb file for the assembly. Verify that list against the actual .pdb location. Make sure it doesn't find an old one.

In normal projects, the assembly and its .pdb file should always have been copied by the IDE into the same folder as your .exe. The bin\Debug folder of your project. Make sure you remove one from the GAC if you've been playing with it.

Hans Passant
This did enable me to ensure it was loading correctly in VS 2010 beta. What made it start working is entirely beyond me, but I will give you the answer since I think this would've worked if it hadn't started working arbitrarily.
Daniel Straight
+1  A: 

Hey Daniel,

Seems like a strange issue. I've had it a couple of times before as well.

Just something simple to try - you may have tried it already. Right click the Solution in solution explorer, click "clean solution", this deletes all the compiled and temporary files associated with a solution.

Do a rebuild of the solution and try to debug again.

I've also had troubles with breakpoints multiple projects in a solution - some compiled as x86, some as x64. Is this your setup?

Patrick

Patrick
A: 

Did nothing. Working now. Sigh.

Daniel Straight
Funny. I've been there. Assemblies make DLL hell seem like a cozy and familiar place.
Mark Wilkins
A: 

You need to enable "Generate debug info" in compiler settings

DS
A: 

I was receiving the same error message on breakpoints in source code that I purchased for the purpose of embedding a discussion forum in our existing application. There are numerous possible solutions posted here and elsewhere online, but none worked for me .

However, with the help of Microsoft support, we found the cause of our problem. Are you ready for this? This code was using the "CodeBehind" attribute in the Page directive of the .aspx file instead of the "CodeFile" attribute (ASP.NET 2.0 and beyond). After days of desperation, a simple search and replace solved the problem.

cjo30080