[IronPython] Compiled WPF applications with pyc on ipy 2.0 - STA problem?

Chris Whitworth chris at flat3.org
Thu Feb 12 13:11:21 CET 2009


I just tried compiling the WPF example code (on 
http://www.ironpython.info/index.php/WPF_Example) with the pyc.py included 
with the IronPython 2.0 samples, and the resultant assembly basically 
doesn't work. When launched from the stub .exe, I get:

Unhandled Exception: System.InvalidOperationException: The calling thread 
must be STA, because many UI components require this.

...followed by a big stacktrace, showing this was basically triggered by 
the creation of a System.Windows.Input.InputManager as part of the 
System.Windows.Window ctor.

>From what I recall of my Windows development, this basically means the 
thing that's creating the System.Windows.Window() is running in a 
multithreaded apartment, and for arcane COM-related reasons, this isn't 
allowed. Any ideas on how to go about fixing this?

(The sample runs fine if launched directly from ipy, FWIW)

   "Back when I was young, we had to travel back in time to put the tape in so
    the game would load before we died."

More information about the Ironpython-users mailing list