Reputation: 2322
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
Upvotes: 25
Views: 25978
Reputation: 8850
My case was terribly stupid: breakpoint was set in the other VS Project's Startup.cs (got mislead by Find Usages).
That being said, error-message is very misleading and it took a while and a coffee to open eyes wider and notice that. The count of different "solution" answers was also overwhelming.
Upvotes: 0
Reputation: 341
I am working on the Console App. Restarting the Visual Studio solved the issue for me...
Upvotes: 0
Reputation: 25956
I am working on ASP.NET Core project, restarting Visual Studio does not solve it.
The only way to solve this by killing VBCSCompiler.exe process in the task manager.
Upvotes: 0
Reputation: 31
On Visual studio tools bar, do the following
Upvotes: 3
Reputation: 45
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.
Upvotes: 0
Reputation: 573
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.
Upvotes: 2
Reputation: 2627
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.
Upvotes: 0
Reputation: 81
I had the same trouble and decided it by deleting attribute [System.Diagnostics.DebuggerStepThroughAttribute()]
on the class.
Upvotes: 0
Reputation: 585
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.
Upvotes: 0
Reputation: 2322
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.
Upvotes: 11
Reputation: 2624
Despite the fact that my current project configuration was set to Debug, it seemed that it has been compiling as a Release one.
I removed (deleted) Web.Release.config from my project, recompiled solution, and then put Web.Release.config back.
Now everything works just fine. What a bizarre behavior, eh. :)
Upvotes: 0
Reputation: 1691
Incase someone is having the same issue, go to iis, then application pools on the left then select your application pool then on the right click on View Applications. Now under physical path you will be able to see the physical path to which your virtual path is mapped to, so make sure the physical path is pointing to the right folder and if incase it is not pointing to the right folder then remove your application from the app pool and add it again
Upvotes: 1
Reputation: 4899
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.
Upvotes: 0
Reputation: 1045
Here are some things to look at:
c:\Users\yourname\AppData\Local\Temp\Temporary ASP.NET Files\
Upvotes: 4
Reputation: 1725
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 :)
Upvotes: 1