Visual Studio Breakpoint Warning

后端 未结 5 2146
遇见更好的自我
遇见更好的自我 2020-12-15 05:14

When debugging my code, I often throw breakpoints in to check the values of local variables to make sure everything is on the right track.

Lately, when I make change

5条回答
  •  不知归路
    2020-12-15 05:49

    This can happen for a few reasons

    • The code the debugger is using is different from the code that the application is running
    • The pdb file that the debugger is using is different from the code that the application is running
    • The code the application is running has been optimized and debug information has been stripped out.
    • The code in which you have breakpoints on hasn't been loaded into the process yet (assuming the things above are not the culprits)
    • If you are attaching the debugger, pay attention to what .net framework it's attaching to (i've had issues with it using .net 4 when code was all .net 2.0)
    • The assembly you have is also in the GAC. This might happen if say you installed your program so you could debug it, but the installer put the dll in the GAC.
    • Remove the reference and re-add it (thanks to forsvarir). Typically this occurs when the project that is referenced is not in the solution, and VS will copy the dll from the bin directory of another project. You will know this was the issue when you try to re-add the reference, and can't find the project :)

    It's pretty tough to figure out what's going on here, but i would suggest using the fusion log viewer to see what is being loaded and where it's being loaded from and then you can look at the dll and see if it's old code, etc.

提交回复
热议问题