Search code examples
.netkillsystem.diagnostics

How to detect killing of an application?


Imagine, we have two .net applications. Application "A" starts application "B" using System.Diagnostics.Process class. Then "A" wants to kill "B" by method Process.Kill. How "B" can determine that somebody is killing him?


Solution

  • I don't think it's possible for the application to respond to being killed... I think it operates more at the OS level like when using task manager.

    Using Process.Kill() might not be right in this context, can you provide more information about the problem you are trying to solve?