1
votes

I've got a strange one. I'm trying to assign a workflow task using the following:

private void createBookingTask_MethodInvoking(object sender, EventArgs e)
        {
            createBookingTask_TaskId = Guid.NewGuid();
            createBookingTask_TaskProperties.Title = "New HFSC Booking";
            createBookingTask_TaskProperties.AssignedTo = @"NET\352488"
            createBookingTask_TaskProperties.DueDate = DateTime.Now.AddDays(7);
            createBookingTask_TaskProperties.TaskType = 1;
        }

The event handler for the OnTaskChanged activity contains no code. Visual Studio debugger is attached and doesn't get an exception. Submitting the InfoPath form for the task before this one takes a long time resulting in this workflow error. The code above is for the second task of a workflow. The first task works a charm. This second one works provided I don't include the OnTaskChanged activity. If this activity is disabled the the workflow will run and complete happily. The OnTaskChanged event handler for both tasks contain no code. If this second tasks OnTaskChanged activity isn't disabled then I receive a Workflow Error and the following entry in 12/LOGS:

System.Workflow.Runtime.Hosting.PersistenceException: Type 'Microsoft.SharePoint.SPUser' in Assembly 'Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' is not marked as serializable. ---> System.Runtime.Serialization.SerializationException: Type 'Microsoft.SharePoint.SPUser' in Assembly 'Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' is not marked as serializable.

The activities for the second task are set up exactly the same as for the first task. CreateTask -> OnTaskChanged -> CompleteTask. It's just the OnTaskChanged seems to break the workflow but only for this second task that's setup in just the same way.

1
Do you have any additional events or similar defined? Events in particular are notorious for bleeding into some kinds of serialization.Marc Gravell♦
Do you have a stacktrace there? Where are you using SPUser class? There is also SPUserInfo, which is not serializable :( So when i had issues serializing SPUserInfo i created SPUserInfoSerializable with my own fields. Eh.Janis Veinbergs

1 Answers

2
votes

Are you storing any variables in the WorkFlow itself that are of type SPUser?