STAThread and Process output capture in c#
Posted
by alex
on Stack Overflow
See other posts from Stack Overflow
or by alex
Published on 2010-03-17T00:14:30Z
Indexed on
2010/03/17
0:41 UTC
Read the original article
Hit count: 457
Hi:
This is a strange problem I encountered. I have an window application written in c# to do testing. It has a MDI parent form that is hosting a few children forms. One of the forms launch test cripts by creating processes and capture the scripts output to a text box. Another form open serial port and monitoring the status of the device I am working on(like a shell). If I ran both of them together, the output of the script seems only appear in the text box after the test is done. However, If I don't open the serial port form, the output of the script is captured in real time.
Does anyone knows what's causing the problem? I notice the onDataReceived even handler for serial port form has a [STAThread] header to it. Will this cause the serial port thread having higher priority than other processes?
Thanks in advance.
© Stack Overflow or respective owner