What thread is Process.OutputDataReceived raised and handled on? What thread is Process.OutputDataReceived raised and handled on? multithreading multithreading

What thread is Process.OutputDataReceived raised and handled on?


You should set the myProc.SynchronizingObject property to your form or control.

Otherwise, I believe the event will be raised on an IO completion thread (from the ThreadPool).


Also see the user comment at the very bottom of this page:

Process.OutputDataReceived is raised on a different thread than the one that instantiated and configured a Process object, and started the process.

If the Process object is instantiated on the main (or UI) thread, you won't be able to update UI running on that thread from the OutputDataReceived event handler. Instead, you'll have to use delegates to send a message to the main thread for processing.