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

15

24

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

Breakpoint error

Apparition answered 14/6, 2016 at 20:19 Comment(1)
All of a sudden, one of my startup projects was removed from the list of startup projects which resulted in this error as I tried to set a breakpoint in a file in this very project. Re-adding the project to the startup projects solved the problem for me.Strangles
A
11

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.

Apparition answered 15/6, 2016 at 14:14 Comment(2)
Had a very similar issue. Restarting VS helped.Childe
if 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...Reactive
B
4

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.
Borgerhout answered 14/6, 2016 at 21:11 Comment(1)
In my case these files were here: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET FilesGarcia
S
2

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.

Sweltering answered 16/6, 2020 at 14:31 Comment(0)
B
2

On Visual studio tools bar, do the following

  1. Goto Tools, Options
  2. Scroll to the Debugging item and click
  3. select the options General
  4. Disable the option REQUIRE SOURCE FILE TO EXACTLY MATCH THE ORIGINAL
Banta answered 4/8, 2021 at 6:55 Comment(0)
S
1

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

Sepulcher answered 14/6, 2016 at 20:25 Comment(2)
I checked the physical location and there's only one file. the .csproj references that file only once.Snarl
This is a good tip. I had migrated files from an old project and somehow had one opened from the old location. There was only 1 reference to the file, but having it opened twice (once in the old location and once in the new location) was enough to cause this error.Galaxy
S
1

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

Schaffhausen answered 7/2, 2018 at 21:28 Comment(0)
S
0

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.

Spheroid answered 10/4, 2017 at 17:16 Comment(0)
C
0

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

Cyclothymia answered 29/5, 2018 at 19:59 Comment(0)
T
0

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.

Tarter answered 27/12, 2018 at 22:24 Comment(0)
R
0

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

Rumple answered 18/10, 2019 at 8:51 Comment(0)
V
0

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.

Vauban answered 15/6, 2020 at 7:40 Comment(0)
Z
0

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.

Zeba answered 26/10, 2020 at 16:9 Comment(0)
C
0

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.

Cariotta answered 6/10, 2021 at 7:52 Comment(0)
D
0

Recycling the app pool did the trick for me

Dorsman answered 23/9, 2022 at 8:8 Comment(2)
what do you exactly mean by "recylcing" ?Medalist
In the IIS Management console, select the App pool and click "Recycle" at the rightDorsman
E
0

I am working on the Console App. Restarting the Visual Studio solved the issue for me...

Elisabeth answered 27/5, 2024 at 7:46 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.