[Mono-list] Opening a form on a new thread, called from C API

Jonathan Pryor jonpryor at vt.edu
Tue May 3 16:12:30 EDT 2011


On May 3, 2011, at 2:59 PM, valdiorn wrote:
> I confirmed that it's the act of opening a form on the new thread that is causing the trouble.

In System.Windows.Forms (and WPF, and SL, and iOS, and Android, and Java Swing, and Qt, and...), UI objects are tied to the thread running the message loop (the UI thread), and all operations on those UI objects must be performed from the UI thread.

In short, don't try to access UI objects from the non-UI thread. If you need to do cross-thread invocation, use Control.Invoke().

 - Jon



More information about the Mono-list mailing list