I have a simple workflow created in the workflow designer that has a Receive activity that can be called after the workflow has started. The Receive correlates on one of the content parameters, which is a GUID that I have generated in the workflow and pass back from the initial SendReply activity.
Correlation query: sm:body()/xgSc:DoSomething/xgSc:workflowId
I can execute the workflow with this test method:
[TestMethod]
public void Test()
{
using (var client = new Test.ServiceClient())
{
var workflowId = client.StartWorkflow();
client.DoSomething(workflowId.Value);
}
}
This works great, but when I add a SendReply activity to the receive it no longer correlates correctly and I get this error when calling DoSomething:
The execution of an InstancePersistenceCommand was interrupted because the instance key 'aee2a4cc-24ec-9e0e-6f76-31ffe345ae27' was not associated to an instance. This can occur because the instance or key has been cleaned up, or because the key is invalid. The key may be invalid if the message it was generated from was sent at the wrong time or contained incorrect correlation data.
Here's the workflow with the SendReply activity:
Take the SendReply activity back out and it works fine, so somehow the SendReply activity breaks the correlation.
How do I implement correlation with a Receive/SendReply pair?




