6

When I go to debug my code all my breakpoints are transparently filled (leaving only the outline) and a small triangle with an exclamation point in the middle is in the corner of the break-point.

The error when I hover over the break-point is 'The break-point will not currently be hit. The source code is different from the original version.'

I had not tried to debug my code in over an hour, and during that time I added a new class with multiple threading functions.

Steps I have taken:

  1. Clean and rebuild project
  2. Set option 'On Run, when build or deployment errors occur:' to 'Do not launch'
  3. Re-save project.
  4. Move project folder off of flash drive and onto HD
  5. Close and reopen VS2010
Fantastic Mr Fox
  • 32,495
  • 27
  • 95
  • 175
Reid
  • 4,376
  • 11
  • 43
  • 75
  • 2
    The source code is not hit because "Bang my head into my desk" is different from the last "Bang my head into my desk". Try harder :) – Mrchief Aug 11 '11 at 03:57
  • What type of app is this? Console/Desktop/Windows Service/Web App? – Mrchief Aug 11 '11 at 03:58
  • was looking through http://stackoverflow.com/questions/2468852/the-breakpoint-will-not-currently-be-hit-the-source-code-is-different-from-the don't know if you had seen it; but one of the things mentioned was to check your build configuration and make sure one of the projects hadn't been deslected (i have had that happen); also you could try running not debugging, then attaching to the process after (wouldn't expect it to make a difference just troubleshooting); i've had things like this happen before, commit to source control, then check it out clean in another directory. or clean manually. – shelleybutterfly Aug 11 '11 at 04:01
  • Check/Re-check what source code your compiling is the same assembly your code is referring to. Some times mistmatch gives problem. Worst case, rebuild all. Or even restart visual studio itself. – Zenwalker Aug 11 '11 at 04:19
  • 1
    are you messing up your s/m datetime in this project? http://nickstips.wordpress.com/2010/10/18/visual-studio-the-breakpoint-will-not-currently-be-hit-the-source-code-is-different-from-the-original-version/ – naveen Aug 11 '11 at 04:21
  • WPF app, I allready rebuilt the program and restarted vs2010. – Reid Aug 11 '11 at 04:22
  • Banging my head into my desk worked! (I hit the keyboard) – Reid Aug 11 '11 at 05:24

3 Answers3

4

I had the same problem and it was because VS2010 was not generating debug symbols. I had inadvertently changed a setting whiel trying to analyze a dump file. I was able to fix it this way:

  1. From the Tools menu, select Options
  2. In the Debugging Section select the Symbols dialogue
  3. At the bottom, under Automatically load symbols for select All modules, unless excluded
  4. click the Specify excluded modules link and make sure the list is empty.
4

I understand that your class is executed, but the breakpoints are not hit, and that when you build and run your solution, you find a newly created assembly in your build folder.

To find out where VS is taking your assembly from you could first of all set a breakpoint in some class you have not modified, so it will certainly be hit (e.g at the end of your Main). When the breakpoint is hit look for your assembly in AppDomain.CurrentDomain.GetAssemblies(), and here look for the Location property which should give you the path your assembly has been loaded from.

Francesco Baruchelli
  • 7,320
  • 2
  • 32
  • 40
0

Go to Tools ---> Options --->Debugging ---> General ---> Uncheck "Require source file to exactly match the original version" ---> click ok. This works for VS 2010

Campa
  • 1