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

后端 未结 12 2942
名媛妹妹
名媛妹妹 2021-02-19 13:06

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

相关标签:
12条回答
  • 2021-02-19 13:37

    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.

    0 讨论(0)
  • 2021-02-19 13:38

    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.

    0 讨论(0)
  • 2021-02-19 13:39

    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.
    0 讨论(0)
  • 2021-02-19 13:41

    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:

    1. Find out the reference in GAC, at "C:\Windows\Microsoft.NET\assembly\GAC_MSIL\YOUR DLL" and delete it. And install the newly modified dll, the command for installing is "gacutil -i YOURDLLWITHCOMPLETEPATH"
    2. Make sure you add the same dll in IIS root web.config location. (I was using customhttpmodule). In my case it was "C:\inetpub\wwwroot\WEBSITENAME\bin"
    3. Delete the temporary folder located at "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files"
    4. IISRESET

    It worked for me, hope it works for you as well.

    0 讨论(0)
  • 2021-02-19 13:43

    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.

    0 讨论(0)
  • 2021-02-19 13:44

    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.

    0 讨论(0)
提交回复
热议问题