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

  • Question

  • 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?

    Johann MacDonagh

    Monday, July 10, 2006 10:00 PM


  • 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

    Monday, July 23, 2007 1:37 AM

All replies

  • 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.


    Monday, July 10, 2006 10:08 PM
  • 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?

    Monday, July 10, 2006 10:10 PM
  • 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.


    Monday, July 10, 2006 10:11 PM
  • 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.
    Monday, July 10, 2006 10:14 PM
  • I had the same problem and found that you have run the command

    Biuld->clean solution


    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

    Wednesday, August 2, 2006 2:45 AM
  • 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.

    Thursday, February 1, 2007 11:33 PM
  • 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.



    Wednesday, February 28, 2007 3:31 PM
  • 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.
    Wednesday, February 28, 2007 7:24 PM
  • 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.
    Wednesday, April 4, 2007 1:31 PM
  • 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

    Monday, July 23, 2007 1:37 AM
  • 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
    Thursday, October 11, 2007 9:47 AM
  • 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


    Thursday, November 8, 2007 11:00 AM
  • Just do the method that Ragnarsun said.


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


    And that is all.

    Tuesday, November 13, 2007 11:15 PM
  • 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

    Tuesday, November 20, 2007 8:08 PM
  • This just happened to me while writing an asp.net application in VS2005.

    The solution for me was to make a simple change to my web.config file.  The code analysis didn't work, nothing else worked.  I updated the web.config, rebuilt the project, and it actually rebuilt instead of the "lightning-fast" build, and now it's hitting the breakpoints.

    I've had a similar issue before when updating code on a precompiled site.  For some reason IIS will sometimes not refresh its cached reference to the precompiled .dll of your code.  So if you just copy over a new precompiled version of your site, IIS will look for the cached name of your precompiled assembly and when it's not there, you get a cryptic error.  Our solution again was to always make an update to the web.config.  If any change is made to this file, IIS will always detect it and refresh its cache.

    I would image there is a similar issue on Windows forms apps, but I'm more familiar with asp.net apps.
    Thursday, November 29, 2007 10:53 PM
  • Hello

    I tried deleting the obj/debug and obj/release folder and it worked..The rebuilded code works and break points set do not

    give any error message. Thanks for the help.




    • Proposed as answer by Roger Tranchez Thursday, May 24, 2012 11:29 AM
    Saturday, February 2, 2008 7:26 AM

    I had the same problem, but the reason was that while coding, i changed my date back by 2 months to test stuff and then whatever code changes i made was probably seen as an older file being chucked in somehow and was then ignored by V.Studio.

    (Was using C# Express 2005)

    Tuesday, April 1, 2008 8:00 AM
  • I had the same error and my problem was that not all projects were being rebuilt.  Check out the Build, Configuration Manager menu item and verify that either all projects are being rebuilt or at least the projects that have been changed.
    Wednesday, June 11, 2008 7:40 PM
  •  I am using VS.Net 2008 and I am facing the same Problem "source code is different from original version" and I am not able to debug my project...

    I did not find the code analysis utility under Build so Could you please help me ...

    Thanks in Advance...
    amr sinan
    Friday, December 19, 2008 7:38 AM
  • older code is being loaded at runtime.

    this issue happened to me because i forgot to set the output directory back to my main output folder for a sub project (it was building to its own /bin)

    my main project was loading an outdated assembly.

    Wednesday, January 28, 2009 5:03 PM
  • For me, the solution to this issue was to make sure that "Enable Optimizations" was unchecked in Project Properties->Compile->Advanced Compile Options...

    A better error description would have been appreciated - VS had no business telling me the source code was different when it clearly wasn't.
    Tuesday, March 3, 2009 1:59 PM
  • I tried the following, but none of them worked in my case :

    * restart the computer
    * clean build
    * rebuild solution
    * empty temporary asp.net folder
    * ...and more...

    The final thing that solved the problem for me was to go to IIS manager and delete the site, then go to the applications properties in VS and under the web-tab click Create Virtual Folder...Finally I can debug. Maybe in VS 2018 web-developing will finally be as easy as windows developing. I HATE developing web-apps....
    Wednesday, July 1, 2009 9:21 AM
  • ...and now it stopped working again, can't I be allowed to be happy for more than couple of minutes!!! Now I really hate web developing...
    Wednesday, July 1, 2009 9:33 AM
  • Using Visual Studio 2008, I encountered the same problem. 

    In my case, I had created a new Solution Platform (x86), and changed my active Solution Platform to this new one.  After that, I was not able to debug anymore.  What I had to do was to revert back to the old Solution Platform (Any CPU), go in Debug mode (right there, the breakpoints were hit), stop debugging, change the Solution Platform to x86, and that's it, I was now able to debug normally.

    Monday, July 20, 2009 5:08 PM
  • Seems like that is not a permanent solution. After a change, I am back to the same issue.  While the trick of switching Solution Platforms still works, there must be something else to do...
    Monday, July 20, 2009 5:14 PM
  • i have fix it easy.
    right click solution > properties> configuration and check that field  "build " is checked for all entities.
    Wednesday, September 16, 2009 4:14 AM
  • Deleting \obj\Release + \obj\Debug and the SolutionName.suo file then reopening the solution did the trick for me.
    Friday, September 25, 2009 1:36 AM
  • If you have two projects with the same base output names, such as proj.exe and proj.dll and you are using a shared output dir - $(SolutionDir)\$(ConfigurationName) then both projects will try to create proj.ilk. Same issue happens with proj.pdb.

    If this is your scenario, explicitly set intermediate and debugging file names.

    Thursday, October 1, 2009 2:59 AM
  • I wasn't able to debug my silverlight app all of a sudden??
    Think I can blame the combination of running them both from Blend awa VS2008...

    Seems I had an entry in '(right click Solutions - properties - Debug source files): "do not look for these source files" which had the troublemaker listed.
    Selected the line and deleted it, after a clean and a rebuild (to be sure) I was able to debug again


    Take care yall,

    Thursday, December 31, 2009 11:53 AM
  •  I had the same problem that the debug session did not reflect changes in the source code.
    It turned out that i had been fiddling around with the settings of ie 8 and forgotten al about it.
    I changed in the internetoptions settings - general - browserhistory - check for newerpages to never
    After changing this to Automatic i was back on track.
    Saturday, January 2, 2010 4:01 PM
  • Start of current week of 2010 I started suddenly have this same problem that I could not debug any earlier made solution or project. Problem was hollow debug circles and not hitting them. My solution has several C# projects, no ASP, no IIS things, no WEB things at all. just basic C# dlls and forms. I have currently Windows 7 and visual studio 2008 professional installed.

    The source code is different from the original version

    I tried

    • Check "Enable unmanaged code debugging"
    • Check over and over again Working directories and build directories
    • Delete obj/bin and obj/debug directories, deleting SUO file and making clean solution & rebuild
    • Making whole new solution, importing projects there
    • Making new solution, making new projects and importing .cs files to current projects and redo references
    • Just delete all references and redo them
    • Adjusting and checking computer clock.
    • Uninstalling .NET framework as far it can be on windows 7 and reinstall
    • Checked soltion properties several times that all have build option enabled + configurations
    • Read all relevant threads from google.
    • used 2 whole days for this

    UNTIL I tried is it from my user settings and made new Windows user account and logged in, opened solution and by the miracle it worked like a charm.

    So I would believe it has nothing to do with visual studio or .NET framework bugs. If I find a correct solution, I will post it here, but now If u strugle with debugging, it has no harm to try to make new user account and test. Might work, might not. On my case it did.

    ** EDIT 25.5.2010 ****

    On my case it really had to do something with administrator rights or compability. I had checked to start Visual Studio 2008 on compability mode as XP SP3 . I checked that out. I added a check to "run as administrator". Now I can again run and debug all my programs on my old current user what makes my life more easier. Hope this info helps someone out there.


    Friday, May 7, 2010 9:20 AM
  • I experienced the same error. in my case it was caused by MVC 2 and areas and having two controllers with the exact same file name in both the Root/Areas/Controllers folder and the Root/Controllers folder.

    See https://connect.microsoft.com/VisualStudio/feedback/details/575699/bug-in-debugger-when-using-areas-and-controllers-with-the-same-name#


    Friday, July 16, 2010 9:03 AM
  • thanks Matt Searles

    i was getting this error : "The breakpoint will not currently be hit. The source code is different from the original version."

    i tried almost everything suggested in this thread and also looked and tried other threads on this and other forums, but at last solved it by manually removing the files in debug directory and then also removing the solution's .suo file, as said by Matt Searles .

    i have windows 7 64-bit with visual studio 2005, and my project was containing crystal reports. i had to set the target cpu type to x86 from solution property and from project property for crystal reports to work.

    the problem could have been occurred bcoz of target cpu type and/or opening (not edited) the .suo file in notepad to solve the crystal report problem. i had to set the cpu type to x86 bcoz my os is x64 and vs will, i think, create an x64 exe, but the crystal reports installed on my computer is not for x64 and thus while compiling/running the project, a runtime error regarding crystal report was generated.

    Wednesday, September 8, 2010 8:55 PM
  • I faced the same error and resolved it by clean all files from the obj/debug and obj/release folders
    I think the problem raised due to I have changed the PC system clock for some tests with different time formats and some of the files got a future date.

    Thursday, September 16, 2010 7:49 AM
  • Got same problem, no able to set valid breakpoint at runtime. Running on windows 7 64 bits. I soilved this by running VS 2005 as admin, and turning off XP SP3 compatibility mode.


    Hope it helps

    • Proposed as answer by Jeff Roper Thursday, September 22, 2011 3:58 PM
    Saturday, October 16, 2010 9:44 AM
  • Windows 7 x64, Visual Studio 2008. Debugs fine in "Any CPU" configuration and displays error "The source code is different from the original version" in "x86" configuration ...until it is run with "Run as Administrator".
    Thursday, November 25, 2010 8:25 AM
  • Hi!!

    Identical problem... Although it happened perhaps because I changed the system date to test stuff... using VC# 2010 Express...

    Deleted the 'obj\x86\Debug\projectname.pdb' (Debug database) file and it's working fine. And I see it has cooked up a new .pdb file. Hope it works for you...



    Wednesday, December 15, 2010 7:51 AM
  • This is vaguely similar to a problem I have been seeing. I am finding that VS2005 automatically swaps lines of source code for me!!!!  If I have a breakpoint set while debugging a .cpp file, then run and hit that breakpoint, then sometimes (seems random) if I click on the red break symbol to remove it, it will also swap that line of source with the line below it.  If not using a version control system, this is maddeningly difficult to find later if you didn't notice it happening.
    Tuesday, January 4, 2011 8:51 PM
  • Hi, I have the very same problem, it happens from time to time and usually can be solved by 1. Rebuilding the very special project, 2. Cleaning the whole solution and rebuilding it, 3. restarting Visual Studio or 4. deleting all dll's (also the one in obj)

    But since today morning it happens all the time and the only thing i can do ist to commit all my changes, delete the whole folder and check it out again. The projects can all be compiled one by one, the build works on our build server with deployment and still on my workstation it just keep shouting errormessages like this, or when i change a interface the other projects don't compile because "the property or method doesn't exist on the object of type xy" and currently i'm at the end of my tether so what the hell is fucked up with the stupid IDE???

    i'm using Visual Studio 2010 on Windows 7 x64, my solution contains ~100 c# and 1 vb.net project using WPF and WCF - SOAP, .net 4.0 x86

    and as i said, a fresh checkout works fine and after some runs everything is messed up again from the ~5h i'm at work, i spent at least 3 trying to compile and run the project, and the build server also works fine



    Thursday, February 17, 2011 2:30 PM
  • Hi, i'm still waiting for an answer, how can i configure Visual Studio or the MSBuild so it uses the freshly compiled DLLs instead of some cached old ones???
    Friday, February 18, 2011 9:09 AM
  • still waiting for an answer, i deleted everything i found, and somehow he managed to get old libraries, for exemple one control i changed yesterday looks and behaives exactly like 2 days ago ... where does the msbuild or VS get the old libraries from???

    i tried everything that worked for me before, most of it is allready mentiond above by other users, but this time NOTHING ...

    Friday, February 18, 2011 1:15 PM
  • I had such problem because of in the shortcut "Compatibility" tab,  uncheck "run this program in Compatibility Mode" (in my case Win XP SP3)
    • Proposed as answer by Jeff Roper Thursday, September 22, 2011 3:58 PM
    Friday, February 25, 2011 2:06 PM
  • For me, the problem was, that my projects were not in the same pool in IIS.

    I configured all applications to use the same pool, and it worked for me.

    Wednesday, March 30, 2011 2:43 PM
  • I was also having this problem. What worked for me was:

    1. Right click the Solution from Solution Explorer in Visual Studio (i am using VS 2010 Pro).

    2. Select Configuration Manager

    3. Make sure the project that contains the file has its build checkbox checked for each platform / configuration.


    For me the current platform was x86 and the project i was working on was not checked so it was not being built. Very difficult to track down issue.

    • Proposed as answer by SmithM5 Monday, September 17, 2012 6:12 PM
    Friday, August 5, 2011 9:08 PM
  • I encountered this issue and found the solution occasionally. Hope it work for you.

    1. Right click the Solution from Solution Explorer in Visual Studio

    2. Select "Properties"

    3. "Common Properties" -> "Debug Source Files"

    4. Remove files in the text area below "Do not look for these source files"

    • Proposed as answer by Junheng Zang Wednesday, August 31, 2011 9:28 AM
    Wednesday, August 31, 2011 9:27 AM
  • Same problem, got it several years, still not solution. Unbelieable. Microsoft should learn from Apple, try think for users, build something that works, including small things.

    My solution for this is waiting for days and it will go eventually. Can you imagine what user experience is that!

    Thursday, December 22, 2011 5:37 AM
  • who changed my vs2010 debug config to x64. hırrrr?

    wasted time.

    Mustafa Torun

    • Proposed as answer by MustafaTorun Wednesday, July 11, 2012 9:56 AM
    Tuesday, May 15, 2012 3:11 PM
  • thanks for the answer, it works for me.
    Wednesday, July 11, 2012 8:56 AM
  • Tomi - I know this is nearly 2.5 years late.  But if you're ever in Boston, I'll take you to the bar of your choice.  This killed me for a week.  I NEVER would have figured out to look for that Compatability mode setting. Never.
    Friday, November 16, 2012 8:57 PM
  • closing vs2012, loggoff/logon fixed the problem.  Somethings we never truly understand.
    Monday, March 11, 2013 4:47 PM
  • I really didn't think this would fix the issue but after a day of pulling my hair out I was willing to try anything. I'm using VS 2012 Ultimate coding in C#. It kept running old code and wouldn't stop on my break points. Ran the Code Analysis on the entire solution and sure enough it worked fine after that. Thanks for the heads-up!
    Saturday, April 26, 2014 12:48 AM
  • This basically occurs because some other WebApp in your visual studio have the same port number , you can check the deployed virtual directory for your localhost at C:\Users\<username>\Documents\IISExpress\config

    file .

    search for the port number and check if that path refers to your web project dll , if not change it to point to your dll location.

    • Proposed as answer by meetashish08 Wednesday, October 19, 2016 9:12 AM
    Wednesday, October 19, 2016 9:11 AM
  • Hey Thanks For Your Solution. It Helps Me to Cure my unvalueable  project.Thanks Again.
    Tuesday, June 19, 2018 10:54 AM