I have an application that I am writting that communicates with a third-party program through a COM connection. I was tasked to strengthen the resilency of our application, in order to do that I wait until the third-party application is ready. I do this by waiting until the return value on a method that returns true only when the third-party application has been fully loaded.
In an effort to avoid the condition where the application crashes during this procedure, and my application just sits there waiting throwing COM errors( caught of course ) I was wondering if the Exited event on the Process itself, is guaranteed to always happen?
I am more then willing to provide additional details when its possible. I am also for the time being limited to .NET Framework 2.0 with this current build.
It depends on the sort of crash – some crashes leave the “process” in memory (for example just stuck in some never-ending loop OR that COM object opened some modal error dialog and waits for user)… these cases are not covered by any method mentioned in your description…
In my experience to be really resilient you need a combination:
I usually start a separate thread before calling such a COM object… that thread monitors the COM object/application for example if it open any window it is not supposed or memory consumption goes through the roof when it is not supposed to etc. – the things monitored and the reaction to each of them is rather specific to that COM object/application…