public static void CallWFAppOperationsFromACallback(WorkflowApplication workflowApplication, CallBackType callbackType = CallBackType.Idle) { Type exceptionType = typeof(InvalidOperationException); string exceptionMessage = ExceptionStrings.CannotPerformOperationFromHandlerThread; RuntimeHelper.CallAndValidateAllMethods(workflowApplication, exceptionType, new List <string>() { "End", "Abort", "Load", "BeginLoad", "LoadRunnableInstance", "BeginLoadRunnableInstance", "AddInitialInstanceValues" }, exceptionMessage); exceptionMessage = string.Format(ExceptionStrings.WorkflowInstanceIsReadOnly, workflowApplication.Id); RuntimeHelper.CallAndValidateMethods(workflowApplication, exceptionType, new List <string>() { "AddInitialInstanceValues", "LoadRunnableInstance", "BeginLoadRunnableInstance" }, exceptionMessage); if (callbackType == CallBackType.Aborted) { exceptionType = typeof(WorkflowApplicationAbortedException); exceptionMessage = string.Format(ExceptionStrings.WorkflowApplicationAborted, workflowApplication.Id); } RuntimeHelper.CallAndValidateMethods(workflowApplication, exceptionType, new List <string>() { "Load", "BeginLoad" }, exceptionMessage); }