Cannot find .cs files for debugging .NET source co

2020-01-29 04:09发布

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?

10条回答
啃猪蹄的小仙女
2楼-- · 2020-01-29 04:53

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.

查看更多
女痞
3楼-- · 2020-01-29 04:54

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.

查看更多
啃猪蹄的小仙女
4楼-- · 2020-01-29 04:56

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

查看更多
Summer. ? 凉城
5楼-- · 2020-01-29 04:59

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

查看更多
登录 后发表回答