"The breakpoint will not currently be hit. A copy of file was found in dll file, but the current source code is different"
Solution 1
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.
Solution 2
Here are some things to look at:
- If you've recently changed namespacing or class names, an old version of the dll may be hanging around in the asp.net cache. Often deleting the files here and rebuilding will solve the issue.
c:\Users\yourname\AppData\Local\Temp\Temporary ASP.NET Files\
- Check your views to make sure your referencing the right class names.
Solution 3
IIS problem in my case, someone or some migration component changed the Physical Path of my web application (basic settings). Was not pointing to my solution on disk, but to another location with an older version of the app. Restoring the proper path, fixed it.
Solution 4
Check the physical directory the CS file is stored in, there may be two seperate files, and if not open the .csproj in a text editor (not VS). See if the file is referenced twice. If so, just delete one of the lines. If that doesn't work, you could always do what it says and set the breakpoint location :)
Related videos on Youtube
Varda Elentári
Updated on September 16, 2022Comments
-
Varda Elentári over 1 year
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 files in the obj and bin folders, closing VS and restarting it, restarting the whole machine (It's Windows! Sometimes the most complicated, unexplained problems get fixed like this :\ )
Any idea what else I can try? it's a .net project on VS2015
-
Arek about 6 yearsHad a very similar issue. Restarting VS helped.
-
Javier Sanchez over 5 yearsif you are running a web project, go to the project settings / web / Under Servers, click the button Create Virtual Directory, this will remap the folder and get the proper source files...
-
Grengas over 5 yearsIn my case these files were here: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files