1

I have a peculiar issue with a variable in my workflow service. It is an array of a datacontract from a REST service, ContactContract[]. When this array is empty everything is great and the workflow continues on correctly. However, if there are any items in the array a stack overflow occurs outside of my activities, I can't pinpoint the specific spot unfortunately.

So, having seen something like this before with the DataContractSerializer when cycles exist in the object graph I wrote a unit test to try it out. The test fails with the following exception:

System.Xaml.XamlObjectReaderException: Unable to serialize type 'System.Runtime.Serialization.ExtensionDataObject'. Verify that the type is public and either has a default constructor or an instance descriptor.

And the test:

[TestMethod]
public void ContactArraySerialize()
{
    var ser = new DataContractSerializer(typeof(ContactContract[]));
    var reader = new StringReader(Strings.SERIALIZED_CONTACT_LIST);
    var xmlReader = XmlReader.Create(reader);
    var list = ser.ReadObject(xmlReader) as ContactContract[];

    var str = XamlServices.Save(list);
}

(I would add the xml for the contact list but it's huge)

I gather this is because the contract implements IExtensibleDataObject to support versioning a bit better.

This is not the stack overflow I had anticipated, but I bet it is related.

Has anyone encountered either of these issues or have any advice?

scmccart
  • 1,169
  • 7
  • 10

1 Answers1

0

Ok I feel like an idiot now. Turns out it wasn’t the workflow crashing but the WcfTestClient b/c it couldn’t figure out how to display the contact contract.

scmccart
  • 1,169
  • 7
  • 10