1

I have simple C# console app that is starting a chrome process via this simple code :

var chromeProcess = Process.Start(chromeLocation, chromeArguments);

Currently when I close my app, the chrome process stays open. What i need is to close the chrome process everytime my console app is closed. Even better would be if the chrome process would be closed even when app crashes or is force killed. Is there a way to accomplish this ? I tried listening to AppDomain.CurrentDomain.ProcessExit but it doesn't fire (and even then, it would not work in event of crash or force fill). I need this to work on Windows 7 and up - I found a lot of solutions for Win XP only.

Thanks

molnarriso
  • 113
  • 8
  • @Alex I know how to close the process. My issue is, how to close the process when my app is killed or crashes - you have no opportunity to kill the process. – molnarriso Aug 07 '18 at 10:20
  • @JeroenMostert Indeed. Answer from adam smith works in VS 2017/Win 10, will see how it works on Win Server 2012/16. – molnarriso Aug 07 '18 at 10:31

0 Answers0