I can’t see how Process.WaitForInputIdle() can return anything but true or throw an exception, but in documentation for that method is stated :
Return Value
Type: System.Boolean
true if the associated process has reached an idle state.
That if is confusing me, is that only documentation copy / paste from overloaded version of for method that have wait parameter or I am not understanding something ?
UPDATE
To clarify my question, I am aware how Process.WaitForInputIdle() works, just courious if it can returns false in some conditions.
I think this might be an operating system compatibility problem. Not sure, I don’t have reliable docs for Windows 98 anymore. The key issue is that it pinvokes the native winapi WaitForInputIdle() function, passing int.MaxValue (0x7ffffffff) instead of INFINITE (-1). So this call can actually time-out, after 24.85 days.
This restriction appears in more than one place, the System.Windows.Automation.Provider.WaitForInputIdle(int) method also specifies a maximum value of int.MaxValue.
So yes, if you get false then your program has been asleep for 25 days. Time to call it quits 🙂