0

If I go to Configuration Manager and set the Configuration field to "Debug" and hit F5, the breakpoints are not hit. (these are breakpoints in the first line of the Main() method).

If I set the Configuration field to "Release" and run the app the breakpoints are hit.

I also noticed that when I run the Debug build, the breakpoints are hit only if I select Target x86 or x64, but not when I select ANY CPU.

What is the cause of this behavior?

Devraj Gadhavi
  • 3,541
  • 3
  • 38
  • 67
John Smith
  • 4,416
  • 7
  • 41
  • 56
  • Did you make a fresh build before? Did you read http://stackoverflow.com/questions/2468852/the-breakpoint-will-not-currently-be-hit-the-source-code-is-different-from-the?rq=1 and tried what was suggested there? – Doc Brown Nov 27 '12 at 23:05
  • 3
    make sure that Configuration Manager options in your solution are set to build your projects in Debug – Paul Farry Nov 27 '12 at 23:12
  • Doc Brown, I did read the answers to that question and none of the solutions seem to work. It's interesting that I have this problem ONLY when I'm working with a Debug build of a particular application. – John Smith Nov 27 '12 at 23:16
  • Paul Farry, I made sure of that – John Smith Nov 27 '12 at 23:34
  • When `Optimize Code` is on, some information stored in the debug file (pdb) is not accurate anymore. By default this is on when you set your build to `Release` mode. – Silvermind Nov 27 '12 at 23:44
  • When you start debugging, what does the breakpoint look like? Is it a hollow circle with a yellow mark? This would mean it isn't able to match the symbols(.PDB) to your current process. – taylorjonl Nov 28 '12 at 00:29
  • Silvermind, I made sure that all configurations have Optimize Code off and still have the same problem. taylorjonl, that's exactly what I see the moment I hit F5. How do I fix this problem? – John Smith Nov 28 '12 at 00:47
  • Ah, the "symbols have not been loaded." :) Provided that your configuration manager options are set up properly for the build, what generally fixes this issue for me is to do a full solution clean, then in Explorer, completely wipe all /bin and /obj folders from the solution then doing a rebuild. I've seen this issue most commonly on things like web projects or customized /bin output setups. What seems to happen is VS doesn't detect that a project needs to be rebuilt/copied and does not overwrite an assembly in one of the output folders. (leaving an incorrect one, gumming the works.) – Steve Py Nov 28 '12 at 04:34

1 Answers1

1

I solved the problem :)

   Solution Explorer ->
   Right click on the solution ->
   Properties ->
   Build ->
   Advanced button ->
   Debug Info: <change from none to pdb-only>
John Smith
  • 4,416
  • 7
  • 41
  • 56