Resolution: MOSS: Cannot execute multiple tasks in workflow

Behavior/Symptoms:

MOSS: Cannot execute multiple tasks in workflow when user tried to modify the second task, the page will be freeze for 2 min and after that nothing it will modify, status will be same. second time when user tries to modify, he gets an error.

Error Message:

"This task is currently locked by a running workflow and cannot be edited"

Cause:

Some objects like SPWeb,SPUser should be NonSerializable and in SPWorkflowTask.AlterTask, last parameter is for synchronization, we set it to false.

Resolution/Workaround:

In workflow, please set the NonSerialized attributes for the m_l2User, m_l3User
variables as mentioned below.
[NonSerialized()]
private SPUser m_l2User = null;
[NonSerialized()]
private SPUser m_l3User = null;

In ApproveNewTo.aspx.cs
replace
SPWorkflowTask.AlterTask(m_taskListItem, taskHash, true);
With
SPWorkflowTask.AlterTask(m_taskListItem, taskHash, false);