I tried setting up debugging the .NET source by following this MDSN walkthrough. The Symbol cache is setup properly, as is the check 'Enable .NET Framework source stepping'.
But subsequently, whenever I want to step into .NET code, I am prompted to specify the location of the relevant cs file. The error message is
You need to find <filename>.cs to view the source for the current call stack frame
and The debugger could not locate the source file <filename>.cs
.
I am offered to browse for the file (but I don't have it) or view a disassembly (but I don't want that).
How to step into the .NET source code?
I've tried all the answers from above and nothing worked.
This solved it for me:
Debug
->Delete all Breakpoints
and it solved the problem! So many different things causing this issue.
I got this error when updating a NuGet package in a project, while missing to update it in other projects of the solution.
Going to the NuGet Manager of the solution and using the consolidate function, which ensures all projects in the solution use the same version, resolved the problem for me.
Well, in my case I was not trying to debug the .Net framework, but I was getting the same error: Cannot find .cs files for debugging .NET source code. So I had to turn on the "Enable just my code" option under:
Tools -> Options -> Debugging -> General -> Enable just my Code
Per MS docs:
https://docs.microsoft.com/en-us/visualstudio/debugger/just-my-code
This took me an hour as well. I fixed it finally by resetting the Settings -> Tools -> Import and Export Settings -> Reset all settings