Console application becomes ghost and does not show on task manager processes tab
<p>My program uses MSSQL database and has been working fine. However, after making some changes including converting from VS2008 to VS2010, generating 32bit application. It starts having the following strange problem:
When I try to shutdown the console by clicking the system menu(X button), it does not shutdown, you can move the console around, you can also click on the left hand system menu such as properties, etc, but the program does not show up on the taskmanger's processes tab, therefore, there is no way to shut it down, but to restart box.</p>

<p>Also, while the program is in this ghost mode, I can actually start another instance. That means the ghost application already release most of the resources such as file handle, db etc.</p>

<p>The problem seems to occur after we have some issues with ms-sql server, such as time out exception.  I simulate the situation by throwing an exception in the same db function call, but that does create the ghost situation. box is Windows Server Standard without Hyper-V, SP2, 32bit.</p>
