WF Passivation Services Issues

If you’re expecting the WF (Windows Workflow) passivation services to work
out of the box, well, you’re half right. 

From one of my workflows, I’ve been able to trap that an error was being
thrown at some point during execution, but it wasn’t clear what the
actual error was or what was causing it.  I knew it had to do with passivation
services since everything was just fine and dandy once I removed the passivation
services from the equation.

From the runtime level, I received the following not-so-helpful error
message:

System.InvalidOperationException:
Workflow with id “[some-guid]” not found in state persistence store.

Just on a whim, I attached SQL Server Profiler to the database instance where
the persistence store is attached to track the queries and lo-and-behold, the
mystery culprit surfaced:

declare @p10 int
set
@p10=0
declare @p11 uniqueidentifier
set @p11=NULL
exec
InsertInstanceState
@uidInstanceID=’2686AB8F-35A4-49C3-AED8-9F239D00D3AC’,@state=0x,@status=3,@unlocked=1,@blocked=0,@info=N’Type

”Zorch.Alta.EastCastle.Workflows.DataProviders.Implementation.MockStepProvider”
in Assembly ”Zorch.Alta.EastCastle.Workflows, Version=1.0.0.0,

Culture=neutral, PublicKeyToken=null” is not marked as serializable. Type
”Zorch.Alta.EastCastle.Workflows.DataProviders.Implementation.MockStepProvider”
in
Assembly ”Zorch.Alta.EastCastle.Workflows, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null” is not marked as
serializable.’,@ownedUntil=”9999-12-31

23:59:59:997”,@ownerID=default,@nextTimer=”9999-12-31
23:59:59:997”,@result=@p10 output,@currentOwnerID=@p11 output
select @p10,
@p11

Well, yeah, duh!  It seems so obvious after the fact.  So the moral of the
story is to make sure that all of your classes are marked with serializable 😛
I’m just not sure why they decided to place the error message in the procedure
call to insert the instance state.  Why not actually raise an error to the
workflow runtime that a class was not serializable?

You may also like...