private void ExecuteTask(ITask task) { try { _currentTask = task; task.Execute(this); } catch (Exception ex) { var e = new TaskExceptionedEventArgs(this, task, ex); Event.Invoke(UnhandledException, this, e); // if the exception is not handled by external parties: if (!e.Handled) { DebugLog.WriteCoreException(ex); #if DEBUG // this is not desired situation, so we hold the whole program! Debugger.Break(); #endif } } }