12

So here's my pickle. I'm using Visual Studion 2012 and been developing my application without a hitch. I opened VS today and I can open all the files as I normally would (cs files). After I press the Start button to begin debugging...I get xxx.cs not found errors.

| Source Not Found | <-The tab

xxx.cs not found

You need to find xxx.cs to view the source for the current call stack frame.

Try one of the following options:

Source search information

Locating source for '[PATH]\xxx.cs'. Checksum MD5 {14 3a e d4 8d 6c e5 0 e2 56 3e 4b 3 dc 22 7a}

Determining whether the checksum matches for the following locations:

1: [PATH]\xxx.cs Checksum MD5 {14 3a e d4 8d 6c e5 0 e2 56 3e 4b 3 dc 22 7a} Checksum matches.

The file'[PATH]\xxx.cs' exists.

The debugger found source in the following locations:

1: [PATH]\xxx.cs Checksum {14 3a e d4 8d 6c e5 0 e2 56 3e 4b 3 dc 22 7a}

The debugger will use the source at location 1.

Now if I click on the linked text to browse for the file...nothing happens. I stop the debugger and double click on xxx.cs and nothing happens either. I can click on other cs files and SOME work and SOME don't. It seems completely random... Anybody has experienced this before?

I reset all my settings via Tools | Import and Export Settings and that did not do the trick.

xxx.cs and all the other files DO contain data (at least VS should open an empty file!) and I'm very confused as to what's going on... Any thoughts?

Regards,

Antonio

Community
  • 1
  • 1
InfOracle
  • 129
  • 1
  • 1
  • 7
  • It sounds like the **Project Solution** doesn't contain those files anymore (moved or deleted) but your **Solution Explorer** hasn't *synchronized* those changes so it is causing an error. – Greg Sep 23 '13 at 20:38
  • Can you open the files (using the path from VS) in another text editor? Can you modify/save them? – DSway Sep 23 '13 at 20:48
  • Do a clean rebuild of all your code. It sounds like the debugging database is corrupted or out of sync with the source code. – Jason Williams Sep 23 '13 at 21:29
  • Greg/DSway...The files are still there and I can open them via Windows Explorer in Visual Studio 2005 and Notepad. Jason...I should've mentioned in the post that I had cleaned and rebuilt the code and still gotten the errors...Is there a way to resync the debugging DB manually? – InfOracle Sep 24 '13 at 16:16
  • 1
    Even after debugging stops...I am completely unable to open the cs files it had problems with in debug mode. Right-Click Open fails. Right-Click Open with. If I select C# Editor (default) it fails. If I select Notepad, that works. SO WEIRD. – InfOracle Sep 24 '13 at 16:24
  • OK, now I tried Right-Click Open with C# Editor with encoding and it said that the file was already open (even though I cannot see it) and if I wanted to close it. I clicked Yes and it prompted me for the encoding selection. Chose the first one and that opened. I closed that and reopened by double-clicking and that worked. I seems the problem is with the C# Editor itself... – InfOracle Sep 24 '13 at 16:27
  • I put a breakpoint in the file. If I leave the file open and start debugging, the file closes and then the debugger yells at me that it can't find it...I'm going to reinstall VS2012 and see if that fixes the situation at this point. – InfOracle Sep 24 '13 at 16:30
  • Well...Reinstalling VS2012 did NOT do the trick. WTF. – InfOracle Sep 26 '13 at 17:52
  • My "Browse and find XYZ.cs" link does not work either. Geeze Louise. – granadaCoder Nov 04 '13 at 16:53
  • @InfOracle did you find any solution to this problem? I am experiencing the same exact issue and I have tried all of these steps plus trying to repair the .NET Fwk and starting VS in safe mode. Anyone have any other ideas? – Daniel McQuiston Jan 15 '14 at 21:14
  • Posted to MS Connect https://connect.microsoft.com/VisualStudio/feedback/details/813882/cannot-debug-simple-console-application-source-not-found – Daniel McQuiston Jan 16 '14 at 01:51
  • Got the same issue. :( – ysrb Jan 22 '14 at 13:05
  • I had to reimage my machine. Not surprisingly, that worked. – Daniel McQuiston Jan 30 '14 at 22:47
  • Yes, I had too this problem. I searched the web but couldn't find solution. Lastly I realised that my .cs file got corrupted and i replaced it from the file history. – Suvendu Shekhar Giri Apr 16 '14 at 09:46
  • Same problem here, it is a bug in Visual Studio as far as I'm concerned. It goes away if I restart Visual Studio but returns when I least expect. The same projects never do this in 2010. If I find a solution I will post here. – codenheim Apr 19 '14 at 21:39
  • @DanielMcQuiston, I did what Suvendu said and that did the trick. What a pain! Sorry for the late reply. I must check in more often. – InfOracle Jun 23 '14 at 20:27
  • @InfOracle unfortunately reformatting my machine was all that worked for me – Daniel McQuiston Jun 24 '14 at 18:35

6 Answers6

4

I have had this problem randomly with VS 2012, and though I haven't found the root cause (I feel it is a bug in Visual Studio because it doesn't happen in 2010 in the same projects), I found how to disable the annoying symptom and just proceed with debugging. There is an option to turn off the checksum file check, in Tools -> Options -> Debugging -> General:

Require source files to exactly match the original version Tells the debugger to verify that a source file matches the version of the source code used to build the executable you are debugging. If the version does not match, you’ll be prompted to find a matching source. If a matching source is not found, the source code will not be displayed during debugging.

http://msdn.microsoft.com/en-us/library/85yzd16c.aspx

The downside is, if you have breakpoints in a particular file that is affected by this issue, then you may find VS won't trace into that file, so this option should only be used (IMO) if there are files causing trouble that you don't care to debug.

I will update my answer as I find more.

codenheim
  • 20,467
  • 1
  • 59
  • 80
3

In my case the files had some unicode characters or other encodings, possibly a result of corrupted file. I right clicked-> Open With...-> and switched to the "C# Editor with encoding" option. Note this will prompt every single time to ask if it should auto detect encoding, which is very annoying but hopefully you can find the offending characters and fix them.

AaronLS
  • 37,329
  • 20
  • 143
  • 202
1

I also had this issue with Visual Studio 2013 (a.k.a. version 12.0), driving me nuts. Repairing, uninstalling, reinstalling, deleting .dlls, .csprojs, .suos, cleaning, rebuilding. Nothing helped. As a last resort before doing a clean install of Windows, I went through these steps which successfully solved the problem:

  • Removed VS through Windows' Add/Remove feature.
  • Deleted all files and folders referencing Visual Studio 12.0 in %AppData%, %ProgramData% and Program Files (x86) (this last one left me 13k files totaling 200 MB+ after uninstall)
  • Rebooted
  • Ran CCleaner's file and registry cleaning tools
  • Used regedit to search for 'Visual Studio 12' and '12.0', essentially removing all keys/folders referencing Visual Studio 12.0 (leaving pure file references as they amounted an insane number)
  • Rebooted, ran CCleaner again, rebooted.
  • Installed Visual Studio 2013 again, changing the path from '... 12.0' to '... 12'.
  • Manually applied a Windows hotfix (KB2664825) which somehow failed during installation.

Done, and it worked!

On a side note, my parallel installs of VS2010 and VS2012 was not affected at any point of the issue I was having with VS2013.

Mats Adborn
  • 504
  • 2
  • 7
0

Well, this might not have fixed your issue, but what I did was delete my .suo files, and it stopped prompting me for files that were long-since gone.

I'm just posting this here for others who might come along and find this helpful.

Christopher Davies
  • 4,461
  • 2
  • 34
  • 33
0

https://stackoverflow.com/a/10028684/4222878 works perfect for me. After deleting file path in solution debug ignore list you should rebuild entire solution.

Community
  • 1
  • 1
SGP
  • 176
  • 2
  • 9
0

I had this same error and it was caused by my dlls in one project not getting up to date with another project dependency. I tried rebuilding, deleting bin files, clearing cache and a few other things. None of it worked for me.

Here is a simple example of my scenario. Project A was dependent on Project B. Whenever Project A hit a point in debugging where it called a method in project B I received the error.

What worked to fix my issue:

  • Put both Project A and Project B into a single VS solution. (If you have many projects that all depend on each other, you can place them all in the same solution, I actually had 9)
  • Clean and Build both projects. (to get them synced within the new solution)
  • Set your startup project to be Project A (or whatever you were previously trying to debug.)

Now you should be able to step through both project's code.

cmartin
  • 2,819
  • 1
  • 26
  • 31