I have this code:
Process internetExplorerProcess = Process.Start("iexplore", "-noframemerging about:blank");
internetExplorerProcess.EnableRaisingEvents = true;
internetExplorerProcess.Exited += OnInternetExplorerProcessExited;
in this case the exited event is executed immediately.
If we change the first line to open a web instead of a blank page:
Process internetExplorerProcess = Process.Start("iexplore", "-noframemerging www.stackoverflow.com");
in some machines the exited event does not run immediately, it may take up to twenty seconds.
Extra information:
If during the delay we open the task manager and force the kill of iexplore the event is fired, it seems that some external process blocks the close of iexplore.
We have examined the machine with anti-malware tools and everything is ok.