0

I have a C# program in which the debugger has very peculiar behavior in regards to breakpoints.

  1. If the breakpoints are already set when I "Start Debugging", then the debugger stops at the breakpoints.

  2. If I add breakpoints while the program is running, the debugger will not stop at any of those breakpoints. However, the debugger will continue to stop at the breakpoints which were already set when I started the program. To get the new breakpoints to work correctly, I have to stop the program and then start it again or detach and then re-attach the debugger.

  3. Also, if I disable a breakpoint while the program is running and then I re-enable the breakpoint, then the debugger no longer stops on that breakpoint. In order for the breakpoint to work correctly again, I have to stop the program and then start it again or detach and then re-attach the debugger.

I would prefer not to have to detach and re-attach the debugger every time that I want to add a new breakpoint. Does anyone know why this is happening and how to make it so that the debugger correctly stops at breakpoints which are added during runtime? This doesn't happen with any other programs. Only this 1 program has this issue. With all of other programs I've ever debugged, I am able to set breakpoints during runtime and the debugger stops with no problems.

I am using Visual Studio 2010 service pack 1 and .NET framework 4. Though, the issue also existed when I was using older versions of the .NET framework.

3
  • Do you use project references as assembly references, or assemblies from some path on your drive? Commented May 16, 2014 at 19:05
  • I have both references to other projects in the same solution and also references to assemblies in another path on my drive.
    – LVBen
    Commented May 16, 2014 at 19:13
  • Are the assemblies on the other paths also changed/rebuild/redeployed. Or does one of your projects accidently reference an assembly by path instead of a project reference? Those for are usually the only weird cases of not being able to debug properly. Commented May 16, 2014 at 19:17

3 Answers 3

1

Clean your solution and rebuild again. It will solve the problem

2
  • Not all the time. Sometimes you have to manually delete everything in the bin folder.
    – Nathan
    Commented May 16, 2014 at 18:58
  • @Nath I've rebuilt the entire solutions hundreds of times and the problem persists. I've only manually deleted all of the bin folders and other output directories a small number of times, but that also has no affect.
    – LVBen
    Commented May 17, 2014 at 0:05
0

Your source code and assembly could be out of sync - rebuild the application and try again. P.S : it is strange that i have heard a lot about this problem with VS2010 :D

EDIT : if you are using some kind if dlls, maybe you nead the debugging symbols (the "pdb" file) to be in the same folder as the dll.

1
  • I've re-built the entire solution many times and it has no affect on this issue.
    – LVBen
    Commented May 17, 2014 at 0:06
0

I have finally figured out what the problem was. We use a tool that strips information from our .DLLs. Using these 'stripped' .DLLs caused the debugging issues.

Using the unstripped .DLLs makes all of these breakpoint issues go away!

Not the answer you're looking for? Browse other questions tagged or ask your own question.