Console windows that cannot be killed by closing or via Task Manager - debugging

When I run a test harness through the Visual Studio 2005 debugger, it creates a console window every time I run it.
In the past, the console window would close automatically when the test harness process terminated, but now I'm finding that the console window is hanging around afterwards.
After the test harness terminates:
I cannot close the console window by clicking the close (x) button on the top-right
The test harness process doesn't exist anymore in Task Manager
So I cannot seem to kill these console windows.
Does anyone know:
How these console windows can exist without a managing process?
How can I can kill these console windows?
Rebooting is obviously an option, but there must be another way.

It's a known bug in windows, introduced with KB978037 security patch.
You can find out more here
http://blogs.msdn.com/debugger/archive/2010/03/11/help-my-console-windows-won-t-go-away.aspx
and here
http://social.msdn.microsoft.com/Forums/en/vsdebug/thread/e6d4a4f5-7002-401a-90e1-6174d7f9e3ca

In Windows, "Administrator" is not the highest level user. Some processes/files/directories are only accessible by the "SYSTEM" user.
See: http://hackspc.com/how-to-become-the-system-user-in-windows-xp/
This may be the reason why it is unkillable.

Related

Why don't some programs appear on the task manager startup tab?

Many applications start at startup, however, some of them do not appear on the task manager startup tab. What is that due to?
Is there any way to do this with a program, for example, spotify?
What do I need to do in order for a program to start at startup, but not showing in the startup applications tab?
Setting it in HKCU/Microsoft/Windows/CurrentVersion/Run doesn't seem to work, as it starts, but still shows on the mentioned tab.
Thank you in advance.
Its mostly a factor of how the program itself is written. If its written to run as a service, or as a System Tray application, or otherwise.
I know there are wrappers for running any exe as a service NSSM being the main one I have experience with (but this is mostly for when there is going to be NO user interaction)
I do not know if there is anything that can allow an application to run in the system tray only, not in the taskbar, if it doesn't support it.
But since Spotify does support running minimized to the tray, it does seem like there are some ways to "start spotify minimized", Spotify or other applications might have command line options or other settings to tell them to start "hidden"

VS2013 won't debug a specific web application

I have a web application that uses IIS, but when I try to debug it VS just locks up and gives me the hour glass cursor icon. No browser window opens, nor does an instance pop up in the Task Manager. VS says its Running / not "Not Responding", but I cannot interact with the IDE. Can't Ctrl-Break to stop or anything.
I was able to run it before, and I'm not aware of any system or IIS changes that could cause this. I've disabled source control and I've tried launching the app in both Chrome and IE but it still behaves the exact same way as described above.
Has anyone else encountered this? The only threads I could find just describe general slowness in the IDE but otherwise its functional. The recommended fix was to disable the source control functionality, which as I said I already tried.
I should note that I don't seem to have an issue running & debugging winforms applications. I also just created a web application and was able to launch it in Chrome and get to the homepage. Also, it doesn't make a difference if I have a breakpoint set or not.
This solution has 4 different projects. If I set a different project as the Startup Project, it does run and launches the browser but it just gives me a 'file explorer' sort of view where it just lists the files in that project's directly which is obviously not what I want.
Edit; If I manually open a browser tab, try to navigate to http://localhost/myApplication, VS pops up and asks if I want to attach process w3wp.exe to IIS APPPOOL\myAppPool. If I attach, it opens a new tab in Chrome and my application runs. But unless I do these 2 steps, it does not run.

MSMQ Trigger opens executable as background process

I'm using a Microsoft Message Queuing (MSMQ) Trigger to launch a standalone executable on Windows 8.1. The exe was not launching so I tried opening Notepad instead (thanks John). That did not work either so I peaked at the Task Manager and noticed that it was opening as a Background Process.
My question is: why does the application open as a background process and how do I prevent this?
Is it possible to add a launch Parameter, for example?
Edit
I should note that I'm okay with the exe running in the background once my application goes live. I would like to prevent it from doing so during development, however.

How to terminate a windows console application that has not associated process?

I have an application the when launched in debug mode in visual studio will some times hang but not have an associated process.
The console windows is there, but it does not respond to exit or Ctrl-C.
It prevents me from rebooting as well.
Is there a way to kill this console session?
Have you looked with Process Explorer from Sysinternals (free) where it has a "target" that you can use to click a window and it will highlight from the list what the program is associated with to kill it or get information?
Known issue with debugging in XP and Server 2003.
To exit the console windows just change the return type of the main() to int and put the return 0; in the last of the main() function. console window automatically terminates.

console windows not close after stopping program

Visual Studio 2005 C++
Windows XP Pro
I have a sample application that I am testing, that links with boost libraries.
However, the program runs ok. However, when I try and stop the program by clicking the 'Stop Debugging' button. The program ends, but the console window remains open. So I have many of them, as during my testing I am starting and stopping the application.
Even when I try and close it by clicking the close button it has no affect. And it doesn't seem to appear under task manager when the program ends.
The only way I can close them if I reboot windows.
I am thinking it might be a thread that has not closed, and maybe that is keeping the console windows open.
Many thanks for any advice,
I have also seen this issue, I think it happens when a mutex or semaphore is still locked, or a thread hasn't cleanly exited. The only way I've found to prevent this is to make sure all mutexes/ semaphores/threads are cleaned up after before stopping the debugger.
Also it's interesting to note that this problem doesn't happen on Windows 7 or Linux. I have tried stopping the same program at the same places and the program always cleanly exits.
Good luck and happy coding!

Resources