I keep getting this error saying there\'s a copy of the .cs file hence the break point will not get hit.
I have tried cleaning solution, rebuilding , deleting the .pdb
This can happen when you are debugging a .cshtml
file with the same name as another file in the project. The debugger picks one of the files as the correct match (seemingly at random), so it will often find a mismatch when it compares the file from the Temporary ASP.NET Files to the source code in your project. The solution in my case was to rename one or both of the files from Standard.cshtml
to something more specific.
I found the issue, it turns out IIS was configured to use a different copy of the project I had in my backup folder. It sounds pretty silly but I'll keep this question open if someone had something similar.
Here are some things to look at:
c:\Users\yourname\AppData\Local\Temp\Temporary ASP.NET Files\
This is for those who have attempted all of the above approaches and still in search for the solution. I had similar problem, not matter what ever I do, I couldn't hit the break point. Finally, what I realized is the dll I am referring to is not the same one which IIS (root web.config) is using. The dll is installed in the GAC(Global Assembly cache) and that's the reason the debugger never hits and we see this kind of warnings. Follow these steps to resolve it:
It worked for me, hope it works for you as well.
Try rebuilding the solution.
Sometimes there are post-build
scripts that copy the DLLs
from one project to another in order to keep the DLLs updated in different projects. If you modify and compile just one project, then some of these scripts might not be executed and the old DLLs
might not be updated.
This can be due to pointing to the wrong library in your link.
When I got this problem, I had just started a new solution with an old project. I had not changed the target library in the Project->link->input section. So as soon as I made changes, I got this error. Each solution keeps a copy of the library.