In .NET, there is the class System.Diagnostics.Process. It has the property HasExited, which should tell me whether the process has terminated. However, the documentation says "When standard output has been redirected to asynchronous event handlers, it is possible that output processing will not have completed when this property returns true. To ensure that asynchronous event handling has been completed, call the WaitForExit() overload that takes no parameter before checking HasExited." (https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.hasexited?view=netframework-4.5#system-diagnostics-process-hasexited).
What does "standard output has been redirected to asynchronous event handlers" mean? I don't know this. And, because of this, it seems that this property is not a good way to determine whether a process has terminated. The documentation recommends "call the WaitForExit() overload that takes no parameter before checking HasExited". But that method will wait until the process and event handlers to exit, which is not to simply determine whether the process (and the strange "event handlers") has exited.
So, in .NET, is there a good way to determine whether a process (including those strange "event handlers") has terminated?