Thanks Dino - here&#39;s the info:<div><br></div><div><div>Unhandled Exception: System.Threading.ThreadStateException: ActiveX control &#39;8856f961-340a-11d0-a96b-00c04fd705a2&#39; cannot be instantiated because the current thread is not in a single-threaded apartment.</div>
<div>&nbsp;&nbsp; at System.Windows.Forms.WebBrowserBase..ctor(String clsidString)</div><div>&nbsp;&nbsp; at System.Windows.Forms.WebBrowser..ctor()</div><div>&nbsp;&nbsp; at _stub_$24##21(Closure , CallSite , CodeContext , Object )</div><div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 target, CallSite site, Object[] args)</div>
<div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args)</div><div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)</div><div>&nbsp;&nbsp; at S$1.__init__$7(Closure , Object self)</div>
<div>&nbsp;&nbsp; at _stub_$18##15(Closure , CallSite , CodeContext , Object , Object )</div><div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.MatchCaller.Call3[T0,T1,T2,TRet](Func`5 target, CallSite site, Object[] args)</div><div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args)</div>
<div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.UpdateDelegates.Update3[T,T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)</div><div>&nbsp;&nbsp; at _stub_$17##14(Closure , CallSite , CodeContext , Object )</div><div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 target, CallSite site, Object[] args)</div>
<div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args)</div><div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)</div><div>&nbsp;&nbsp; at _stub_$16##13(Closure , CallSite , CodeContext , Object )</div>
<div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet](Func`4 target, CallSite site, Object[] args)</div><div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args)</div><div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.UpdateDelegates.Update2[T,T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)</div>
<div>&nbsp;&nbsp; at S$1.Initialize(Scope $scope, LanguageContext $language)</div><div>&nbsp;&nbsp; at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression code, Scope scope)</div><div>&nbsp;&nbsp; at Microsoft.Scripting.ScriptCode.Run(Scope scope)</div>
<div>&nbsp;&nbsp; at IronPython.Runtime.PythonContext.CreateModule(String fileName, Scope scope, ScriptCode scriptCode, ModuleOptions options)</div><div>&nbsp;&nbsp; at IronPython.Runtime.PythonContext.CompileModule(String fileName, String moduleName, SourceUnit sourceCode, ModuleOptions options, ScriptCode&amp; scriptCode)</div>
<div>&nbsp;&nbsp; at IronPython.Runtime.PythonContext.CompileModule(String fileName, String moduleName, SourceUnit sourceCode, ModuleOptions options)</div><div>&nbsp;&nbsp; at IronPython.Runtime.Importer.LoadFromSourceUnit(CodeContext context, SourceUnit sourceCode, String name, String path)</div>
<div>&nbsp;&nbsp; at IronPython.Runtime.Importer.LoadModuleFromSource(CodeContext context, String name, String path)</div><div>&nbsp;&nbsp; at IronPython.Runtime.Importer.LoadFromDisk(CodeContext context, String name, String fullName, String str)</div>
<div>&nbsp;&nbsp; at IronPython.Runtime.Importer.ImportFromPathHook(CodeContext context, String name, String fullName, List path, Func`5 defaultLoader)</div><div>&nbsp;&nbsp; at IronPython.Runtime.Importer.ImportFromPath(CodeContext context, String name, String fullName, List path)</div>
<div>&nbsp;&nbsp; at IronPython.Runtime.Importer.ImportTopAbsolute(CodeContext context, String name)</div><div>&nbsp;&nbsp; at IronPython.Runtime.Importer.ImportModule(CodeContext context, Object globals, String modName, Boolean bottom, Int32 level)</div>
<div>&nbsp;&nbsp; at IronPython.Runtime.Builtin.__import__(CodeContext context, String name, Object globals, Object locals, Object fromlist, Int32 level)</div><div>&nbsp;&nbsp; at _stub_$1##1(Closure , CallSite , CodeContext , Object , String , IAttributesCollection , IAttributesCollection , PythonTuple , Int32 )</div>
<div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.MatchCaller.Call7[T0,T1,T2,T3,T4,T5,T6,TRet](Func`9 target, CallSite site, Object[] args)</div><div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args)</div>
<div>&nbsp;&nbsp; at Microsoft.Scripting.Actions.UpdateDelegates.Update7[T,T0,T1,T2,T3,T4,T5,T6,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6</div><div>rg6)</div><div>&nbsp;&nbsp; at IronPython.Runtime.Importer.Import(CodeContext context, String fullName, PythonTuple from, Int32 level)</div>
<div>&nbsp;&nbsp; at IronPython.Runtime.Operations.PythonOps.InitializeModule(Assembly precompiled, String main, String[] references)</div><div>&nbsp;&nbsp; at PythonMain.Main()</div></div><div><br></div><div>Repro code is:</div><div><div><br>
</div><div>import clr</div><div>clr.AddReference(&#39;System.Windows.Forms&#39;)</div><div>from System.Windows.Forms import *</div><div><br></div><div>class MainForm(Form):</div><div>&nbsp;&nbsp; &nbsp;def __init__(self):</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;self.Dock = DockStyle.Fill</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;self.Controls.Add(WebBrowser())</div><div>form = MainForm()</div><div>Application.Run(form)</div><div><br></div></div><div>Compiled with:</div><div>ipy pyc.py /out:wf /target:winexe /main:repro.py<br></div><div>
<br></div><div>-X:ExceptionDetail didn&#39;t alter the output from the exe. Run from ipy there was no issue.<br></div><div><br></div><div>Cheers,</div><div>Davy<br><br><div class="gmail_quote">On Sat, Nov 8, 2008 at 5:39 PM, Dino Viehland <span dir="ltr">&lt;<a href="mailto:dinov@microsoft.com">dinov@microsoft.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I&#39;d start w/ -X:ExceptionDetail to get the full stack trace. &nbsp;Presumably there&#39;s something higher up the stack then the MatchCaller on the stack.<br>

<div><div></div><div class="Wj3C7c"><br>
-----Original Message-----<br>
From: <a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a> [mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>] On Behalf Of Davy Mitchell<br>

Sent: Saturday, November 08, 2008 6:19 AM<br>
To: Discussion of IronPython<br>
Subject: Re: [IronPython] ActiveX STA Issue in compiled Winforms EXE<br>
<br>
Hi Michael<br>
<br>
&gt;Are you doing this from a separate thread?<br>
<br>
No.<br>
<br>
It&#39;s a couple of modules deep from the &#39;main&#39; script. Was going to try<br>
a single py file to repro.<br>
<br>
&gt; I assume it works fine when run uncompiled?<br>
<br>
Yep, runs great.<br>
Cheers,<br>
Davy<br>
<br>
<br>
On 11/8/08, Michael &lt;<a href="mailto:fuzzyman@gmail.com">fuzzyman@gmail.com</a>&gt; wrote:<br>
&gt; Are you doing this from a separate thread? I assume it works fine when<br>
&gt; run uncompiled?<br>
&gt;<br>
&gt;<br>
&gt; Michael<br>
&gt;<br>
&gt; <a href="http://www.ironpythoninaction.com" target="_blank">http://www.ironpythoninaction.com</a><br>
&gt;<br>
&gt; On 8 Nov 2008, at 12:10, &quot;Davy Mitchell&quot; &lt;<a href="mailto:daftspaniel@gmail.com">daftspaniel@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; IPY 2.0 RC1<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; ActiveX Issue in a pyc compiled Winforms EXE which uses the<br>
&gt;&gt; WebBrowser control.<br>
&gt;&gt;<br>
&gt;&gt; Unhandled Exception: System.Threading.ThreadStateException: ActiveX<br>
&gt;&gt; control &#39;8856f961-340a-11d0-a96b-00c04fd705a2&#39; cannot be<br>
&gt;&gt; instantiated because the current thread is not in a single-threaded<br>
&gt;&gt; apartment.<br>
&gt;&gt; &nbsp; &nbsp;at System.Windows.Forms.WebBrowserBase..ctor(String clsidString)<br>
&gt;&gt; &nbsp; &nbsp;at System.Windows.Forms.WebBrowser..ctor()<br>
&gt;&gt; &nbsp; &nbsp;at _stub_$643##332(Closure , CallSite , CodeContext , Object )<br>
&gt;&gt; &nbsp; &nbsp;at Microsoft.Scripting.Actions.MatchCaller.Call2[T0,T1,TRet]<br>
&gt;&gt; (Func`4 target, C<br>
&gt;&gt;<br>
&gt;&gt; Help!! :-)<br>
&gt;&gt;<br>
&gt;&gt; Any thoughts before I delve further into this?<br>
&gt;&gt;<br>
&gt;&gt; Thanks<br>
&gt;&gt; Davy Mitchell<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Users mailing list<br>
&gt;&gt; <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
&gt;&gt; <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
&gt; _______________________________________________<br>
&gt; Users mailing list<br>
&gt; <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
&gt; <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
&gt;<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
</div></div></blockquote></div><br></div>