views:

224

answers:

2

Hi,

My Visiual studio hangs all of a sudden when debugging the windows application. It's takes while to repond and but it's closing my application. I keep getting this issue everytime in every debugging session.

Please help to fix this problem.

A: 

Smells of infinite loop somewhere...

Otávio Décio
+1  A: 

Your application also stops responding right? If so, I presume that your application is giving VS problems. Presumably because some operation is tying up the main thread. When that is tied up no other events can be processed (button clicks, screen redrawing, close buttons, etc). That could be caused by an infinitive loop, or perhaps Disk IO or waiting for a network connection or a database query result, or a deadlock.

My suggestion would be to do some type of logging so you can identify where the problem is at. For instance, put a breakpoint at the top and bottom of major functions. After you break at the top one, hit play. If you don't hit the bottom one you know that the problem is somewhere in that area.

Or, do some sort of logging like putting Console.WriteLn("Entering MyFunction()") at various places in the code.

Once you know where the problem is at, you can fix it.