title: Capturing Process Termination(Task Manager) in WPF
body: <p>I have a WPF application.when the application closes i do some update/insert action in database which is mandatory for my application.But if my application is forcibly closed by killing the process in taskmanager, i am not able to do operation in database.</p>
  
  <p>I am doing the updating/insertingrecords in DB in "Exit" Event in "App.xaml.cs",this event is not fired when the application is killed in taskmanager.By searching i found that if a process is killed in Process Tab of Task Manager the application closes immediately without waiting for the application to respond.</p>
  
  <p>One way we can capture the process termination is by having a service running which checks this application Process.</p>
  
  <p>Is there any other way to catch the process termination within the same application i.e By not having another service running to check.?</p>
  
  <p>Thanks in advance..</p>