I have a C# program in which the debugger has very peculiar behavior in regards to breakpoints.
If the breakpoints are already set when I "Start Debugging", then the debugger stops at the breakpoints.
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.
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.