I'm making workflow on Tridion 2013 SP1, but when I start workflow, automatic activity fails.
I made a simple workflow that has only 2 activities. 1st one is a manual activity and 2nd one is an automatic activity. The automatic activity source code is following (it only outputs text to a file "WorkflowFailure.log").
class Activity1 : ExternalActivity
{
protected override void Execute()
{
outputlog("Activity1 start:" + ProcessInstance.Title);
System.Threading.Thread.Sleep(5000);
CoreServiceClient.FinishActivity(ActivityInstance.Id, new ActivityFinishData { Message = "Finished" }, null);
}
public static void outputlog(string msg)
{
StreamWriter sw = new StreamWriter("C:\\tridion\\log-custom\\WorkflowFailure.log", true, System.Text.Encoding.UTF8);
sw.WriteLine(DateTime.Now.ToString("yyyyMMdd hh:mm:ss:fff") + ":" + msg);
sw.Close();
}
}
This automatic activity often fails, but it has very weired symptom.
- When I start same workflow again and again, sometimes it succeeds and sometimes it fails.
- When it fails, no log is output to Windows eventlog, and any Tridion log file.
- When it fails, no text is output to "WorkflowFailure.log" (This file is made by above automatic activity).
Because of 3rd symptom, I guess automatic activity itself is not called.
Does anyone know same issue?
What is problem?
StreamWriter
, which is blocking file while it's in use. Can it be the case that other activities are trying to write to it at the same time?ActivityInstance.SuspendOrFailReason
Property through API