views:

136

answers:

1

When working on console applications in Visual Studio, I will run the application by pressing F5 to bring it into debug mode. Occasionally (and I'm not sure how this happens), I'll get back into "edit mode" in Visual Studio and the debugged console window will still be open.

It will remain open but entirely unresponsive. I can't close the window by right-clicking the window and clicking "close"; I can't close it via the Task Manager, and I can't close it by ending a particular process (to my knowledge). In fact, I can't even exit Windows when this happens without physically pressing the power button to reboot my computer.

How can I get the window to close without having to reboot my computer?

System Info: Windows XP SP3, Visual Studio 2010

EDIT: It usually happens after I break into debug mode. All exceptions are bubbled up and printed to the console, so it's not because the exception causes the application to break, but sometimes I do step through the application until I get to the part of the application that the exception is caught, but before it actually gets thrown back to the UI.

+2  A: 

The first part is normal, the console window cannot respond to close requests while the debugger has a the process in break mode.

Debug + Stop Debugging should terminate the program. There's however an issue that's specific to XP and earlier, a process cannot terminate if a kernel thread is executing an I/O request for the process. You can see this condition from Taskmgr.exe, Processes tab. View + Select Columns and tick "Handles". You've got a zombie process when you see it show 1 handle in use.

Not so sure how you get out of the condition, it is rather specific to the I/O request that isn't completing. Having ditched XP a long time ago, I vaguely remember killing devenv.exe to solve the problem. Windows 7 is nice, recommended.

Hans Passant
@Hans I use Win 7 at home and love it. Hopefully this problem will resolve itself when we upgrade to 7 at the end of the year.
Ben McCormack