Executing workflow through timer causes workflow to error and hang

Jul 12, 2012 at 3:42 PM
Edited Jul 13, 2012 at 3:19 PM

I've been poking around with the workflow timer, and have successfully managed to get it to execute a custom list workflow.

The problem is, it errors somewhere in the process, and that causes the workflow to hang.  When the timer runs again, it errors due to the workflow already running.

I have tested the workflow by itself, and when I run it manually, it functions fine.  It's a simple process; iterate through all the list items and delete duplicates.  Just to double-check, I ran it five times in quick succession, and each time, it completed successfully.  So the triggered workflow is fine.

The error I get is, "An error has occurred in <workflow name>", and that's from looking at the workflow I had to terminate manually.  Checking the log files gives me, "ex.Message=Cannot complete this action.  Please try again."

My last shot was to grab the source code and run it that way, to make use of the debugger.  Unfortunately, even executing the solution through Visual Studio didn't bring up any exceptions, and I can't get it to hit any of the breakpoints I set.

Edit: I still can't get it to hit any of my breakpoints, but the debug code finally kicked in for the workflow history, so now I get: Exception of type 'System.Workflow.ComponentModel.WorkflowTerminatedException' was thrown.

It insists this is happening in my workflow code, but it won't hit the fault handler I have set up to catch Exceptions in the workflow.

Edit #2: I added in logToHistoryActivity actions before each action of the workflow, just to see if I could figure out exactly where it errors.  When I run the workflow manually, I see all the logged actions appearing fine.  When the timer triggers the workflow, I get none of the actions; it errors before it even activates the workflow!

Anyone have any ideas on what to look for or what to do to resolve this?

Jul 13, 2012 at 3:03 PM

Hi fbueckert,

Thanks for your feedback.  I also got the same issue a few times.  I guess it's caused by resource competition.

Not sure what's the correct way to fix it, but definitely I can find some walk around.

I will try to release a new version during this weekend, and will let you know once it's published.

Jul 13, 2012 at 3:21 PM

Hi, fangdahai

Thanks for the response!  At least I'm not the only one who's encountered this; I seem to have a habit of encountering bugs that only affect myself.

Regardless, I'm still going to try to figure it out on my own; I'll try to keep my original question updated with what I've found.  Maybe that can help you narrow down exactly where the problem might be.

Jul 14, 2012 at 2:42 PM


Just released a new version, could you please try it?


Jul 16, 2012 at 3:16 PM


I have tested this new build, and I now get my workflow to execute!  It's still erroring on me, but at least it's showing bits and pieces I added to determine what was going on.  Thanks!