private UnhandledExceptionAction OnUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs args) { var e = args.UnhandledException; _eventBroker.Publish(new WorkflowUnhandledException(e)); return(UnhandledExceptionAction.Cancel); }
private UnhandledExceptionAction WorkflowUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs e) { console.WriteLine(Environment.NewLine + "** Unhandled Exception **"); console.WriteLine(Environment.NewLine + (e.UnhandledException != null ? ExceptionManager.GetExceptionMessage(e.UnhandledException) : string.Empty)); isBusy = false; return(UnhandledExceptionAction.Cancel); }
/// <summary> /// Initializes a new instance of the <see cref="NinjectWorkflowApplicationUnhandledExceptionEventArgs"/> class. /// </summary> /// <param name="workflowApplicationUnhandledExceptionEventArgs">The <see cref="System.Activities.WorkflowApplicationUnhandledExceptionEventArgs"/> instance containing the event data.</param> public NinjectWorkflowApplicationUnhandledExceptionEventArgs(WorkflowApplicationUnhandledExceptionEventArgs workflowApplicationUnhandledExceptionEventArgs) : base(workflowApplicationUnhandledExceptionEventArgs) { this.UnhandledException = workflowApplicationUnhandledExceptionEventArgs.UnhandledException; this.ExceptionSource = workflowApplicationUnhandledExceptionEventArgs.ExceptionSource; this.ExceptionSourceInstanceId = workflowApplicationUnhandledExceptionEventArgs.ExceptionSourceInstanceId; }
private UnhandledExceptionAction OnUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs args) { ExecutableServiceRepository.Instance.Remove(this); _waitHandle.Set(); ExecutionStatusCallbackDispatcher.Instance.Post(_result.ExecutionCallbackID, ExecutionStatusCallbackMessageType.ErrorCallback); return(UnhandledExceptionAction.Abort); }
public virtual UnhandledExceptionAction OnUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs e) { Console.WriteLine("工作流出现异常!ID:{0}\n异常信息:{1}", e.InstanceId, e.UnhandledException.Message); return(UnhandledExceptionAction.Terminate); }
private UnhandledExceptionAction OnUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs e) { OutputWriter.WriteLine(e.UnhandledException.StackTrace); OnRunningStateChanged(new WorkflowExecutingStateEventArgs(false)); return(UnhandledExceptionAction.Terminate); }
private UnhandledExceptionAction WorkflowApplicationOnUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs e) { var name = e.ExceptionSource.DisplayName; SharedObject.Instance.Output(SharedObject.enOutputType.Error, string.Format("{0} 执行时出现异常", name), e.UnhandledException.ToString()); return(UnhandledExceptionAction.Terminate); }
private UnhandledExceptionAction UnhandledExceptionEvent(WorkflowApplicationUnhandledExceptionEventArgs args) { _reloadWaitHandler.Set(); _log.Error("An exception occured InstanceId=" + args.InstanceId.ToString() + " Activity=\"" + args.ExceptionSource.DisplayName + "\"", args.UnhandledException); ActivityUnhandledExceptionEvent?.Invoke(args); //Abort so the workflow does not stop. This will allow it to be persisted and become idle. return(UnhandledExceptionAction.Abort); }
UnhandledExceptionAction WorkerManagerUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs e) { ExtensionMethods.TraceError("OnUnhandledException in WorkerManager {0}\n{1}", e.InstanceId, e.UnhandledException.Message); Trace.Flush(); return(UnhandledExceptionAction.Terminate); }
private UnhandledExceptionAction OnException(WorkflowApplicationUnhandledExceptionEventArgs arg) { Log.WarnFormat("Error: {0} - {1}", arg.ExceptionSource, arg.UnhandledException); lock (Result) { Result.Error = arg.UnhandledException; } Unloaded.Set(); return(UnhandledExceptionAction.Abort); }
private UnhandledExceptionAction AppException( WorkflowApplicationUnhandledExceptionEventArgs e) { if (Incomplete != null) { Incomplete(e.InstanceId, "Exception", e.UnhandledException.Message); } RemoveInstance(e.InstanceId); return(UnhandledExceptionAction.Cancel); }
private UnhandledExceptionAction wfapp_OnUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs e) { lock (syncRoot) { var workflow = workflows[e.InstanceId]; workflow.LastException = e.UnhandledException; } // Force the workflow to execute the cancel logic return(UnhandledExceptionAction.Cancel); }
UnhandledExceptionAction OnUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs args) { // save unhandled exception to be thrown if (args.UnhandledException != null) { UnhandledExceptionInfo = ExceptionDispatchInfo.Capture(args.UnhandledException); } // abort workflow return(UnhandledExceptionAction.Abort); }
private UnhandledExceptionAction OnUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs a) { var h = WorkflowNotHandledException; if (h != null) { h(this, a); } RemoveActivityInstance(a.InstanceId); return(UnhandledExceptionAction.Terminate); }
UnhandledExceptionAction IWorkflowApplicationHandler.OnUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs e) { lock (managerStateLock) { if (this.state == ManagerState.Opened) { WriteException(e.UnhandledException, string.Format("Exception encountered in activity {0}", e.ExceptionSource.DisplayName)); } } return(UnhandledExceptionAction.Terminate); }
private UnhandledExceptionAction _workflowInstance_UnhandledException(WorkflowApplicationUnhandledExceptionEventArgs e) { _synchronizationContext.Post( state => { if (e.UnhandledException != null) { HandleError(e.UnhandledException.Message, true); } }, null); return(UnhandledExceptionAction.Terminate); }
private static WorkflowHandlerBase GetStateContent(WorkflowApplicationUnhandledExceptionEventArgs args) { WorkflowHandlerBase stateContent = null; var exts = args.GetInstanceExtensions <ContentWorkflowExtension>(); if (exts != null) { var ext = exts.FirstOrDefault(); if (ext != null) { stateContent = Node.Load <WorkflowHandlerBase>(ext.WorkflowInstancePath); } } return(stateContent); }
private static string DumpException(WorkflowApplicationUnhandledExceptionEventArgs args) { var e = args.UnhandledException; var sb = new StringBuilder(); sb.AppendLine("An unhandled exception occurred during the workflow execution. Please review the following information.<br />"); sb.AppendLine(); sb.Append("Workflow instance: ").Append(args.InstanceId.ToString()).AppendLine("<br />"); sb.AppendFormat("Source activity: {0} ({1}, {2})", args.ExceptionSource.DisplayName, args.ExceptionSource.GetType().FullName, args.ExceptionSource.Id); sb.AppendLine("<br />"); sb.AppendLine("<br />"); sb.Append(DumpException(e)); return(sb.ToString()); }
private UnhandledExceptionAction wfapp_OnUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs e) { // This is important to gracefully unload faulted or canceled/timed-out. // It causes the runtime to cancel the workflow instead of abort it instantenously. // This will cause the cancel logic and finally activities of a try-catch-finally activity to // execute prior to the unloading of the workflow. // First we have to store the exception because it won't be available after the // workflow gracefully cancels lock (syncRoot) { var workflow = workflows[e.InstanceId]; workflow.Job.Status = JobStatus.Failed; workflow.LastException = e.UnhandledException; } // Force the workflow to execute the cancel logic return(UnhandledExceptionAction.Cancel); }
/// <summary> /// 记录异常日志 /// </summary> /// <param name="eventArgs">异常事件信息</param> private static void LogException(WorkflowApplicationUnhandledExceptionEventArgs eventArgs) { Exception exception = eventArgs.UnhandledException; Task.Run(() => { WriteFile(string.Format(_ExceptionLogPath, DateTime.Today), "===================================工作流运行异常, 详细信息如下===================================" + Environment.NewLine + "[当前活动名称]" + eventArgs.ExceptionSource.DisplayName + Environment.NewLine + "[当前活动类型]" + eventArgs.ExceptionSource.GetType().FullName + Environment.NewLine + "[工作流实例Id]" + eventArgs.InstanceId + Environment.NewLine + "[异常时间]" + DateTime.Now + Environment.NewLine + "[异常消息]" + exception.Message + Environment.NewLine + "[异常明细]" + exception + Environment.NewLine + "[内部异常]" + exception.InnerException + Environment.NewLine + "[堆栈信息]" + exception.StackTrace + Environment.NewLine + Environment.NewLine); }); }
internal UnhandledExceptionAction WorkerUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs e) { lock (_lock) { if (!OneUnhandledExceptionMessageLogged) { if (job.AbortRequested) { //if job was forcefully aborted, we would like to ignore errors and send a clean error message string errorMessage = string.Empty; if (job.AbortReason == Services.Job.AbortReasons.TimedOut) { errorMessage = string.Format("The Job '{0}' timed out. The time out was set to {1} minutes.", job.JobIdentifier, IdpeConfigurationSection.CurrentConfig.TimeOut); errorMessage += string.Format(" Started at {0} & file {1} had {2} records.", job.StartedAt, job.FileNameOnly, job.TotalRowsToBeProcessed); } else { errorMessage = string.Format("A business rule has requested to abort the job '{0}'! Aborting job...", job.JobIdentifier); } ExtensionMethods.TraceInformation(errorMessage); new PostMan(job, false).Send(PostMan.__errorStartTag + errorMessage + PostMan.__errorEndTag); } else { //We dont want to send from here. commented 10/12/2016 //StringBuilder sb = new StringBuilder(); //sb.AppendLine(string.Format("Fatal Error: A worker {0} was aborted because of an unhandled exception. Forcefully aborting the job!", e.InstanceId)); //sb.AppendLine(); //sb.Append(string.Format("Exception occurred in worker {0}\n{1}.\nExceptionSource: {2}", e.InstanceId, e.UnhandledException.ToString(), e.ExceptionSource.DisplayName)); //job.TraceError(sb.ToString()); } Trace.Flush(); OneUnhandledExceptionMessageLogged = true; } } AbortJob(); return(UnhandledExceptionAction.Terminate); }
private UnhandledExceptionAction workflowUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs e) { string objType = ExecuteScalar("select [ObjType] from [WorkflowInstance] where [InstanceGUID] = '" + e.InstanceId + "'"); string objID = ExecuteScalar("select [ObjID] from [WorkflowInstance] where [InstanceGUID] = '" + e.InstanceId + "'"); DynEntity log = new DynEntity("Log"); log["LogID"] = GetNextID("Log"); log["LogName"] = e.ExceptionSource.DisplayName; log["LogType"] = "工作流异常"; log["ObjType"] = objType; log["ObjID"] = objID; log["Comment"] = e.UnhandledException.Message + "实例为:" + e.InstanceId; log["OperateTime"] = DateTime.Now; log["OperaterName"] = e.ExceptionSource.Id; log["OperaterID"] = 0; ////将工作流对应的对象状态置为异常终止,可以重新启动 //string updateSql = "update " + objType + "set State = '异常终止' where " + objType + "ID = " + objID; //ExcuteNoneReturnQuery(updateSql); GatewayFactory.Default.Save(log); return(UnhandledExceptionAction.Cancel); }
private static UnhandledExceptionAction HandleError(WorkflowApplicationUnhandledExceptionEventArgs args) { try { Logger.WriteException(args.UnhandledException); WorkflowHandlerBase stateContent = GetStateContent(args); if (stateContent == null) { Logger.WriteWarning(Logger.EventId.NotDefined, "The workflow InstanceManager cannot write back the aborting/terminating reason into the workflow state content."); } else { WriteBackAbortMessage(stateContent, DumpException(args)); } } catch (Exception e) { Debug.WriteLine("##WF> OnUnhandledException: " + e.ToString().Replace("\r\n", "<br/>").Replace("\r", "<br/>").Replace("\n", "<br/>")); Logger.WriteException(e); } return(UnhandledExceptionAction.Abort); }
private void OnWorkflowNotHandledException(object sender, WorkflowApplicationUnhandledExceptionEventArgs e) { var mess = e.UnhandledException == null ? null : ExceptionHelper.GetErrorMessage(e.UnhandledException); var source = e.ExceptionSource == null ? null : e.ExceptionSource.DisplayName; // здесь выводим предупреждение в лог (пока есть вся информация) _log.WarnFormat("Occur exception in activity {1} of process {0}.{2}{3}", e.InstanceId, source, Environment.NewLine, mess); // обрабатываем политикой if (e.UnhandledException != null) { ExceptionPolicy.Instance.HandleException(e.UnhandledException, "BP"); } var ctx = GetContext(e.InstanceId); if (ctx == null) { return; } ctx.Error(e.UnhandledException); RiseCompleted(e.InstanceId, ctx); }
private static UnhandledExceptionAction HandleError(WorkflowApplicationUnhandledExceptionEventArgs args) { try { Debug.WriteLine("##WF> WFException: " + args.UnhandledException.Message); Logger.WriteException(args.UnhandledException); WorkflowHandlerBase stateContent = GetStateContent(args); if (stateContent == null) { Logger.WriteWarning("The workflow InstanceManager cannot write back the aborting/terminating reason into the workflow state content."); } else { WriteBackAbortMessage(stateContent, DumpException(args)); } } catch (Exception e) { Debug.WriteLine("##WF> EXCEPTION in the InstanceManager.HandleError: " + args.UnhandledException.Message); Logger.WriteException(e); } return(UnhandledExceptionAction.Abort); }
static UnhandledExceptionAction OnUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs e) { Console.WriteLine("Unhandled exception: " + e.UnhandledException.Message); syncEvent.Set(); return(UnhandledExceptionAction.Terminate); }
public UnhandledExceptionAction OnUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs e) { this._errorLogger.Log("istance id:" + e.InstanceId + " has exception :" + e.UnhandledException.Message, LoggerInfoTypes.Error); return(UnhandledExceptionAction.Abort); }
private UnhandledExceptionAction OnWfAppException(WorkflowApplicationUnhandledExceptionEventArgs arg) { //arg.UnhandledException Console.WriteLine("出现了未处理的异常:" + arg.UnhandledException.ToString()); return(UnhandledExceptionAction.Terminate); }
private static UnhandledExceptionAction OnUnhandledExceptionHandler(WorkflowApplicationUnhandledExceptionEventArgs arg) { Console.WriteLine("OnUnhandledExceptionHandler"); return(UnhandledExceptionAction.Abort); }
private UnhandledExceptionAction OnUnhandledException(WorkflowApplicationUnhandledExceptionEventArgs uh) { return(UnhandledExceptionAction.Terminate); }