Recently, I encountered this situation where I wanted to display a form on another thread (not the main/UI thread). I used a threadpool thread. The form hosted a RCW (for a COM component). Instantiating the form gave me an exception that the thread must be a STA. I tried to set the apartment state as STA. But, that didn't work either. I finally ended up creating a thread explicitly and that worked(I used ShowDialog and needn't create a meesage pump).
EDIT:
- I know that threadpool threads are MTA. But, why can't it be set to STA? Just curious about this.
- Another question that just popped in
my head: Why don't we require a
message pump when Showdialog() (to
display a form) is used