"The source code is different from the original version."

I just started having problems debugging my multi-project C# solution in VS 2005 (Windows Forms with a couple class libraries). When I put a breakpoint on a method header and hit debug, the breakpoint gets hollowed out and a yellow exclamation point is added. The tooltip explains:

"The breakpoint will not currently be hit. The source code is different from the original version."

While not debugging, I noticed that the tooltip for the breakpoint shows a 12 line difference:

"At MyClass.cs line, 48 ('MyNamespace.MyClass', line 36)."

Now, if I put a breakpoint thats not on a method header, it appears to work just fine. It breaks at the correct location and I'm able to step through the code line by line. I don't have any weird situations such as "stepping" through blank lines of code that would usually accompany a mismatch between source code and debugger files. However, when I get to a certain line in my code, it crashes. The line

myButton.Enabled = false;

The error An IndexOutOfRange exception.

So it appears that even though I'm stepping through my source code, it's getting muddled up somewhere.

I've tried deleting all /bin and /obj folders, and I have rebuilt the entire solution half a dozen times. Still the same problem. There was another thread on this forum with this same problem, and the solution was to uncheck the "Require source code to match up exactly..." option in the Debugger options. I've tried that and it still doesn't work (doesn't break).

Are there some temporary files I need to clear

Thanks,
Johann MacDonagh



Answer this question

"The source code is different from the original version."

  • tasleemarif

    Yeah, unfortuantly I'm not seeing any errors at all. I may just roll back the changes I've made and get the latest working copy from the source control and redo my work.
  • Mr.Bean

    I had the same problem and found that you have run the command

    Biuld->clean solution

    and

    Biuld -> clean (name of the proyect)

    in the Biuld menu. the command clean all the resource and exe, dll, etc from the

    head of the proyect netx you need rebuild your aplication

    sorry for my bad english


  • krhoover

    That error means that your build actually failed, but it started to debug the last successful build. At least, that's what it means when I see it.



  • bryanedds

    Are any of the class libraries you are using Gaced If the source code is from a gaced assembly, you have to update the gac after building in order for the dll to match.
  • Earl Jon Daman

    Thanks for the reply.

    I'm able to expliticly hit "Rebuild" on each project and they all succeed. Could there still be some strange build error


  • Sven Rutten

    Hi,

    "At MyClass.cs line, 48 ('MyNamespace.MyClass', line 36)." is the key. You might have 2 identical names.

    Try renaming one of your source-files, and see if it helps.

    /Philip L. Nielsen


  • blemos

    Just do the method that Ragnarsun said.

    Go to Build -----> Clean [Project name]

    And that is all.


  • JDAnthony

    Hey Guys,

    I had a very similar issue,

    I did nothing out of the ordinary just changed some code and all of a sudden it wouldn't build my new changes.

    What was really alarming was my changes were full of errors as I had copied the code from somewhere else in my project and when I built the project it would say build succeeded.

    I also noticed that project would build lighting fast indicating that it wasn't building at all.

    What worked for me was running the code analysis utility under Build\Run Code Anaylsis on [Your Project Name]

    I'm not sure if this utililty is in the express edition

    Hope this helps


  • M. Casco

    I had similiar problem. I solved it by deleting obj\Debug and obj\Release content and *.csproj.FileList.txt file. Don't forget to backup your solution earlier Smile

    Edit: I am working in VC#2005 EE

  • DOSrelic

    I just came across this error but Visual Studio Express C# edition didn't have the: Build-->Clean option.

    For those using XNA stuff...make sure that your CPU is set correctly. When I explicitly set it to X86...everything worked fine.


  • ThisSummer

    my solution was to replace 'CodeBehind' page directive with the new 'CodeFile' directive.
    After I replaced that I was able to use Intellisense to set the path to the source file.
    For some reason, VS 2005 uses 'CodeBehind' page directive by default when it generates the markup pageSad


  • HeatherS2006

    I was just having the same problem using VB in VS 2005. I'm thinking it's a bug in Visual Studio. Everytime I tried to debug my code it would appear to compile but the results were from a previously compiled solution. When I tried to debug to find out why old code was being executed I got that "The source code is different from the original version" message. After I commented out the new code, it would build the new solution. Then I just uncommented the code and it worked again. Very strange. It must be a bug because this is the code it appeared to have a problem with:

    rtb.Text = Date.Now

    go figure...

    Although I didn't try it, another solution might be to delete the files in the /bin/debug folder or where you have your debug files set to build to.


  • ShaneShowers

    No, if the builds all succeed, then they have succeeded. In my case, I just look at the error list nad there are errors there.



  • Dhivya.S

    Did you happen to move some folders in your solution directory This happened to me as a result of "re-organizing" my solution directory which had a number of project folders. I guess one project that had a reference to a class library (another project in the solution) lost its mapping when I moved it so it re-mapped the reference to the copy of the dll in its own bin directory instead of the one in the dll's project directory. Basically, to fix the problem, I removed the reference to the other project and re-added it.

  • "The source code is different from the original version."