Cannot find .cs files for debugging .NET source code

Solution 1:

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:

You can configure Visual Studio to automatically step over system, framework, and other non-user calls and collapse those calls in the call stack window.

https://docs.microsoft.com/en-us/visualstudio/debugger/just-my-code

Solution 2:

Checking Tools -> Options -> Debugging -> General -> Enable source server support mysteriously made everything work. I hope the same is true for you

Solution 3:

This took me an hour as well. I fixed it finally by resetting the Settings -> Tools -> Import and Export Settings -> Reset all settings

Solution 4:

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.

Solution 5:

Clean the solution before build solved the issue for me.

Just navigate and click on:

  1. Build -> Clean Solution.
  2. Build -> Build Solution (Ctrl + Shift + B).