<div>Under CLR 2, any uncaught exception in a thread other than the primary thread will take down the entire process. This is not specific to IronPython. I don't know what the Silverlight CLR will do under these circumstances.</div>
<div> </div>
<div>You could make a case that a Python-initiated thread shouldn't terminate the process given that CPython wouldn't do the same, but as far as I know, we haven't gotten any requests along those lines. For now, you'll probably want to wrap any function used as a thread "main" 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 <<a href="mailto:dan.eloff@gmail.com">dan.eloff@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">I'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'm pretty sure my callback is being<br>called, but all that is in it right now is a raise statement.<br><br>I've enabled debug.<br>
<param name="initParams" value="debug=true,reportErrors=errorLocation" /><br><br>I've been trying to explore Threads a little more with IronPython to<br>see what might be the problem, but even there I'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>>>> from System.Threading import Thread, ThreadStart<br>
>>> def foo():<br>... raise ValueError<br>...<br>>>> t = Thread(ThreadStart(foo))<br>>>> t.Start()<br>>>><br>Unhandled Exception: System.ArgumentException<br> at foo$1##16(Closure )<br>
at _stub_##25(Closure , CallSite , CodeContext , Object )<br> at Microsoft.Scripting.Utils.InvokeHelper`5.Invoke(Object arg0,<br>Object arg1, Object arg2, Object arg3)<br> at Microsoft.Scripting.Utils.ReflectedCaller.InvokeInstance(Object<br>
instance, Object[] args)<br> at Microsoft.Scripting.Actions.ActionBinder.UpdateSiteAndExecute[T](CodeContext<br>context, CallSite`1 site, Object[] args)<br> at Microsoft.Scripting.Actions.UpdateDelegates.Update1[T0,TRet](CallSite<br>
site, CodeContext context, T0 arg0)<br> at System.Void(), using PythonBinder##20(Closure )<br> at System.Threading.ExecutionContext.Run(ExecutionContext<br>executionContext, ContextCallback callback, Object state)<br> at System.Threading.ThreadHelper.ThreadStart()<br>
<br>What'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>