In Visual Studio 2008, after debugging for about 1-2 minutes, when I press F10 (Step Over), the debugger freezes, and Visual Studio freezes for 5-10 seconds, and then proceeds to the next line. Then, no matter what I do (F10, F5, F11, etc.), the Debugger continues execution, as if I pressed F5 and all my forms that I debugged. I always have to restart the application.
It is very difficult to reproduce, and this does not happen every time I want to debug something. Does anyone have a solution?
EDIT: I was able to reproduce my problem with the following code:
static void Main(string[] args) { XElement e = new XElement("root"); Test(e, 0); } static void Test(XElement parentElement, int i) { if (i < 1000) { XElement element = new XElement("element"); parentElement.Add(element); Test(element, ++i); } }
You need to put a conditional breakpoint on the line "XElement element = new XElement (" element "); with the condition" i == 999 ". Then run the program, wait 2-3 seconds and set a normal breakpoint on the line" parentElement.Add ( element); ". Now VisualStudio freezes and debugging is impossible. In the WinForm application, it closes all forms that are open after pressing F10.
But I found that if I turn off the debug option “Convert call string function for objects in variable windows” to “Tools → Options → Debugging”, I can debug it. It is slow, but at least VisualStudio does not freeze. Does anyone know why he is doing this? Because I do not want to disable this option, it is really annoying to debug without it.
I also noticed that if I only put a breakpoint at the end of the main method, the code works very quickly, comparing it with a conditional breakpoint in a recursive method.
debugging visual-studio-2008 visual-studio
Alexandre Pepin
source share