How to resolve the DelayActivity bug in SharePoint 2010 Workflows

I recently came across a problem using DelayActivity objects in custom SharePoint 2010 workflows that I'd like to discuss here, in the hopes of saving others the hours of investigation that I went through to resolve the problem (and to remind myself of the solution if I encounter this problem on a future project).

Using DelayActivity objects is pretty cool, as it allows your custom workflows to delay for a specified period of time before continuing execution. Unfortunately, the problem I was experiencing was that the workflow would never wake up after the DelayActivity.TimeoutDuration value expired.

Searching on the Internet gives a number of posts, with varying suggestions for both SharePoint 2007 and 2010. Since I'm working with SharePoint 2010, I ignored the posts on 2007, and focused on the suggestions for 2010. One of the best ones is here:

http://www.dev4side.com/community/blog/2010/12/1/bug-using-delay-activity-on-sharepoint-2010-workflow.aspx

I followed the instructions to this, and initially it worked just fine. However, as I continued my development I noticed that the problem would reappear, so this made me think that the suggested resolution was not the root cause, and that some other resolution needed to happen to definitively fix this problem.

It turns out that one final step is missing: if you are in the midst of a development cycle (as I was), you must run IISReset and restart the SharePoint Timer Service each time after you redeploy your workflow. Once I realized (and tested) this, my workflow functioned properly.

I hope this helps others when they are using DelayActivity objects in custom workflows.