Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Right now I'm trying to Run/Debug my application in Visual Studio, but it cannot create it because the last instance of the app.vshost.exe is still running. Then, by using the Task Manager I'm trying to kill it, but it just remains there with no signal of activity.

Beyond that particular case (maybe a Visual Studio bug), I'm very curious about the technical reasons why sometimes Windows cannot kill a process?

Can, an enlighted OS related developer, please try to explain?

(And please don't start a Unix/Linux/Mac battle against Windows.)

share|improve this question

migrated from stackoverflow.com Mar 20 '10 at 1:33

This question came from our site for professional and enthusiast programmers.

6  
If I only had a nickel for every time I wanted the answer to this question... –  Steven Oxley Mar 20 '10 at 1:20
    
I appreciate the answers, but I would like to read an Operating Systems developer explaining why an OS of this era cannot kill a non-core/kernel (or whatever adjective is appropriate) process. I believed since the 386 there was a "ring 0" (or something alike) giving special privileges to some code over other, I thinked that was the way a (OS) process has authority over others. Maybe I'm completely wrong, but the question remains unanswered. –  Néstor Sánchez A. Jun 18 '11 at 13:24

9 Answers 9

The cause is usually some irresponsive drivers which have unfinished I/O requests in progress. http://blogs.technet.com/markrussinovich/archive/2005/08/17/unkillable-processes.aspx

share|improve this answer
    
This happens in Linux as well. While the x86 architecture has 4 rings, only two of them are used (ring 3 for userspace, ring 0 for kernel). So everything is either kernel mode or userspace, with nothing in between. But, a possible workaround is "user-mode" drivers which depend on a small reliable kernel-mode stub that merely calls userspace code. I believe most print and USB drivers in Windows are this (graphics drivers used to be in Windows 3.1), but userspace carries a performance penalty. –  ultrasawblade Aug 20 '11 at 20:00

One possible reason: You can't kill a task that's attached to a debugger.

The only solution is to stop the task from the debugger itself.

share|improve this answer

Open the Properties page for the project, go to the Debug tab, and check "Enable unmanaged code debugging". Or, uncheck the option for using the host process.

share|improve this answer

One reason would be that you don't have permission to kill it. E.g. if the process is running as administrator and you are a normal user.

share|improve this answer

If the last app.vshost.exe is still running, just connect to that process with the debugger.

Should be found in menu under Debug->AttachToProcess then choose the hanging process and connect to it.

share|improve this answer

When I attach to the process I get "Unable to attach to a crashing process".

This problem is a really annoying one.

share|improve this answer

Perhaps an examination of some of the tools cited here could lead to answers?

http://stackoverflow.com/questions/49988/really-killing-a-process-in-windows

(Just now I found that pskill was the only of several tools that could kill a process running under one user's Windows 7 session, from another user's session (or credentials, I suppose.)

share|improve this answer

You can!

Using ProcessHacker (right click on the process) -> Terminator.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.