0

Suppose I have an Application.exe running on Windows. I want to log "My process was killed.", if someone else kills my process using task manager etc. How can I get the process closure information? Search results did not return any useful information. I am interested in C# and Windows solutions.

System.Diagnostics.Process class has an ExitCode property. But if process is already killed, how can i even use it?

Barış Akkurt
  • 2,255
  • 3
  • 22
  • 37
  • 1
    Considering that if the process is killed, no more code is executed in it, you would have to place handling of that particular code outside of the process. – Lasse V. Karlsen Sep 28 '18 at 08:26
  • 1
    What you're probably looking for is a "watchdog" process that keeps watch on `Application.exe` and logs the data-points you care about when the process terminates (whatever the reason may be) – Rob Oct 02 '18 at 07:28
  • you both are right, after a process is killed, there is nothing to do. thanks. – Barış Akkurt Aug 08 '19 at 06:59

0 Answers0