lessCode.net
Links
AFFILIATES
« 64-bit Numerical Stability with Visual C++ 2013 on FMA3-capable Haswell Chips (_set_FMA3_enable) | Main | Did Verisign revoke their own certificate? »
Thursday
Aug222013

Bug? Content-Based Correlation in Windows Workflow Foundation

This one caused me quite a bit of grief this week – maybe I can save someone else some pain. When configuring content-based correlation in the Workflow (4.0/4.5) designer, I think there’s a subtle bug in the dialog that allows you to choose the correlation key and XPath expression used to establish correlation on a Receive or SendReply activity.

image

It manifests itself when the workflow engine attempts to apply the correlation query at runtime:

A correlation query yielded an empty result set. Please ensure correlation queries for the endpoint are correctly configured.

 

It only occurs under the following conditions:

  • The message or parameter that contains the correlation is a complex DataContract (i.e. not a primitive value type).
  • That DataContract type is derived from another base class DataContract.
  • The correlation property comes from the base class.
  • The base class DataContract and the derived class DataContract are in different namespaces.

 

Under these conditions, the Add Correlation Initializers dialog sets the namespace of the property as being defined in the namespace of the derived class, not the base class.

Fortunately the fix is easy – you can manually edit the XAML to refer to the namespace of the base class instead, e.g:

<XPathMessageQuery x:Key="key1">
<XPathMessageQuery.Namespaces>
 <ssx:XPathMessageContextMarkup>
    <x:String x:Key="xg0">http://schemas.datacontract.org/2004/07/ClassLibrary2</x:String>
    <x:String x:Key="xgSc">http://tempuri.org/</x:String>
 </ssx:XPathMessageContextMarkup>
</XPathMessageQuery.Namespaces>sm:body()/xgSc:StartResponse/xgSc:StartResult/xg0:Id</XPathMessageQuery>

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (1)

Could you post your entire solution, including the 'bad' formed xaml and then what you changed to fix it? This is the same problem I am having, but not sure what path to put in.

public class IncomingRequest
{
public guid persistenceGuid {get;set;}
}

..it cannot find my xpath

December 20, 2013 | Unregistered Commenterryan

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>