[Ironruby-core] Handling runtime errors in embedded applications

James Leskovar lists at ruby-forum.com
Fri Jan 1 16:52:05 EST 2010

Hmm, UnhandledExceptionEventArgs seems to only have two properties,
ExceptionObject and IsTerminating, both of which are read-only. After a
bit of investigation, there is another type of unhandled-exception
handler, set with Application.ThreadException, which can prevent
application termination. However, it only catches exceptions in Windows
Forms threads, so it's not applicable for DLR exceptions (indeed, the
event is not fired when an IR exception occurs.)


Jimmy Schementi wrote:
> UnhandledException *does* have the feature to not terminate the process; 
> you need to do "e.Handled = true;" in your exception handler to tell the 
> CLR that the exception has been properly handled. If you don't set it, 
> the CLR doesn't see the exception as handled and continues propagating 
> the exception, which will eventually terminate the process.
> I was pretty sure it worked for Threads as well, since all threads are 
> still bound to the current AppDomain, but let me know if your fixed 
> exception handler still doesn't solve this. However, your work-around 
> will work in the meantime.
> ~js
Posted via http://www.ruby-forum.com/.

More information about the Ironruby-core mailing list