“The breakpoint will not currently be hit. A copy of file was found in dll file, but the current source code is different”

时光毁灭记忆、已成空白 提交于 2019-12-05 15:10:29

问题


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


回答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.




回答2:


Here are some things to look at:

  1. 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\

  1. Check your views to make sure your referencing the right class names.



回答3:


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 :)




回答4:


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.




回答5:


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




回答6:


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. :)




回答7:


This happens to a debugging project when you try copying successfully built project from root(project's root) folder and saving the copy of same in "Project" folder of your respective Visual Studio.

When you do the above step, Visual Studio debugging location sometimes keep referencing to the built DLLs in the copy/back-up folder.

The same can be changed BY ONE OF THE METHODS written here.

But if you are using Visual Studio's built-in IIS-EXPRESS, then you need to navigate to project properties "Properties|alt+enter" => "Web" => In Servers Section, select IIS Express => For current Project URL, click "Create Virtual Directory".

This will warn you that the current Project Url is referred by some other Project Location(Your Copy|back-up Folder), Confirm your selection for the dialog box, and there you are, as HITTING your breakpoints again.




回答8:


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.




回答9:


I had the same trouble and decided it by deleting attribute [System.Diagnostics.DebuggerStepThroughAttribute()] on the class.



来源:https://stackoverflow.com/questions/37821377/the-breakpoint-will-not-currently-be-hit-a-copy-of-file-was-found-in-dll-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!