Guaranteed process termination

Got a FATAL code and don't know if it will be handled in a service or an application, but you need a guaranteed way to abort [Beware: Its not pretty]

I recommend you only ever use this if you are running inside exception handling code, which would otherwise keep everything running, if at all!

//Now lets commit Hari-Kiri
Process.GetCurrentProcess().Kill();

Update: DotNet 2.0 has the XXX function to do exactly the same. And that's not good code either

Add comment

  Country flag


  • Comment
  • Preview
Loading