Reputation: 1405
Sometimes, in debugging mode, I try to watch code at some level of the call stack, and I get an error:
There is no source code available for the current location.
I know what it means. If I know where the file is, how can I give the source file to Visual Studio?
The first time, it gives me a browse window for search, but at this time I didn't have the code. When I downloaded it from SVN and tried (after restart of the whole computer) to access the code again, I get the error.
Please don't explain me that Visual Studio can't find the file and because of it gives disassembly, I know it. I searched for the option to give it the file.
Upvotes: 29
Views: 17415
Reputation: 53
None of the above steps worked correctly in VS 2013 for me.
After removing the incorrect source path from the Solution -> Properties -> Common Properties -> Debug Source Files list, closing all instances of Visual Studio, each time I ran and stepped into the code, I would see a file dialog would pop up and go away and then VS would step to the incorrect source location again.
After numerous attempts at this, I used a hex editor to do a Unicode string search and found the offending path was still in my solution's .suo file. Deleting that file still did not fix the problem.
Finally, I opened the solution again, went to the Solution -> Properties -> Common Properties -> Debug Source Files list and changed the incorrect source location to the correct one (i.e. instead of deleting it). I then Ctrl+Shift+S to save all, exited VS, started VS again and started a debug session. This time it stepped to the correct code.
So, if the above is not working for you, there's an issue in VS 2013 with it caching the path that prevents deletion from working and you must change the existing path.
Upvotes: 5
Reputation: 38795
In Visual Studio (at least since v.2005) you have to check the Solution properties:
In the Solution Explorer, right-click on the Solution -> Properties -> Common Properties -> Debug Source Files
.
There is a list here: "Do not look for these source files:" - remove (all) entries from this list, then VS should ask you for the source path again.
Here's a screenshot from VS 2013 Express:
Upvotes: 34
Reputation: 239724
If I remember correctly, if you fail at the task of locating source code when it first occurs, the modules are added to the excluded modules list.
Go to Tools -> Options -> Debugging -> Symbols. Under "All Modules, unless Excluded", there's a link button "Specify Excluded Modules". Open that dialog, and I think you'll find your modules in there.
Upvotes: 2