I would like to start a process from my application with Process.Start() and I would like that in case of my app crash or the user close it then the child process is automatically killed.
Is it possible to obtain something like this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the
AppDomain.ProcessExitevent to catch when your process is about to exit and have it kill the other process. I am unsure as to how it works in reaction to an unhandled exception, so you may have to useAppDomain.UnhandledExceptionand have it use FailFast to handle any normal exceptions. As part of that handler, you have it kill the other process too.