<div>Under CLR 2, any uncaught exception in a thread other than the primary thread will take down the entire process.&nbsp; This is not specific to IronPython.&nbsp; I don&#39;t know what the Silverlight CLR will do under these circumstances.</div>

<div>&nbsp;</div>
<div>You could make a case that a Python-initiated thread shouldn&#39;t&nbsp;terminate the process given that CPython wouldn&#39;t do the same, but as far as I know, we haven&#39;t gotten any requests along those lines.&nbsp; For now, you&#39;ll probably want to wrap any function used&nbsp;as a thread &quot;main&quot; in a try/except and do something to log the error in the exception handler.<br>
<br></div>
<div class="gmail_quote">On Sun, Jun 8, 2008 at 8:23 AM, Dan Eloff &lt;<a href="mailto:dan.eloff@gmail.com">dan.eloff@gmail.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">I&#39;m having a problem debugging some issues that I suspect are thread<br>related in Silverlight. My application is failing silently, so I have<br>
no way to be sure yet. Is it possible that exceptions in a background<br>thread are quietly swallowed? I&#39;m pretty sure my callback is being<br>called, but all that is in it right now is a raise statement.<br><br>I&#39;ve enabled debug.<br>
&lt;param name=&quot;initParams&quot; value=&quot;debug=true,reportErrors=errorLocation&quot; /&gt;<br><br>I&#39;ve been trying to explore Threads a little more with IronPython to<br>see what might be the problem, but even there I&#39;m not having much<br>
luck. I could swear this used to work in Beta 1. Now it crashes the<br>interpreter.<br><br>IronPython 2.0 Beta (2.0.0.2000) on .NET 2.0.50727.1433<br>Copyright (c) Microsoft Corporation. All rights reserved.<br>&gt;&gt;&gt; from System.Threading import Thread, ThreadStart<br>
&gt;&gt;&gt; def foo():<br>... &nbsp; &nbsp; raise ValueError<br>...<br>&gt;&gt;&gt; t = Thread(ThreadStart(foo))<br>&gt;&gt;&gt; t.Start()<br>&gt;&gt;&gt;<br>Unhandled Exception: System.ArgumentException<br>&nbsp; at foo$1##16(Closure )<br>
&nbsp; at _stub_##25(Closure , CallSite , CodeContext , Object )<br>&nbsp; at Microsoft.Scripting.Utils.InvokeHelper`5.Invoke(Object arg0,<br>Object arg1, Object arg2, Object arg3)<br>&nbsp; at Microsoft.Scripting.Utils.ReflectedCaller.InvokeInstance(Object<br>
instance, Object[] args)<br>&nbsp; at Microsoft.Scripting.Actions.ActionBinder.UpdateSiteAndExecute[T](CodeContext<br>context, CallSite`1 site, Object[] args)<br>&nbsp; at Microsoft.Scripting.Actions.UpdateDelegates.Update1[T0,TRet](CallSite<br>
site, CodeContext context, T0 arg0)<br>&nbsp; at System.Void(), using PythonBinder##20(Closure )<br>&nbsp; at System.Threading.ExecutionContext.Run(ExecutionContext<br>executionContext, ContextCallback callback, Object state)<br>&nbsp; at System.Threading.ThreadHelper.ThreadStart()<br>
<br>What&#39;s going wrong? How should I be doing this?<br><br>Thanks,<br>-Dan<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></blockquote></div><br>