internal void RunTask(ITask task)
{
Exception excep = null;
try {
var obj = task.LinkedIterator;
var iter = task.Execute ();
if (obj != null && iter != null)
Console.WriteLine ("FIX ME PLEASE as I have a nested iterator");
if (iter != null) {
IteratorData id = new IteratorData (iter);
id.Begin (this);
}
if (obj != null)
((IteratorData)obj).Step (task, this);
} catch (Exception e) {
excep = e;
if (UnhandledException != null) {
UnhandledException (this, new UnhandledExceptionEventArgs (e, false));
excep = null;
}
var port = UnhandledExceptionPort;
if (port != null) {
port.Post (e);
excep = null;
}
} finally {
dispatcher.TaskDone (task, excep);
}
}