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
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
declare @p11 uniqueidentifier
in Assembly ”Zorch.Alta.EastCastle.Workflows, Version=22.214.171.124,
Culture=neutral, PublicKeyToken=null” is not marked as serializable. Type
Assembly ”Zorch.Alta.EastCastle.Workflows, Version=126.96.36.199,
Culture=neutral, PublicKeyToken=null” is not marked as
23:59:59:997”,@result=@p10 output,@currentOwnerID=@p11 output
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?