0
votes

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? - Willem van Rumpt
I have both references to other projects in the same solution and also references to assemblies in another path on my drive. - LVBen
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. - Willem van Rumpt

3 Answers

1
votes

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

0
votes

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.

0
votes

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!