locked
Generate an XSD for a custom class based on ApplicationSpecific RRS feed

  • Question

  • Hi,

    We get a failure when trying to use xsd.exe to generate an xsd for a class we have created. Generating from a dll containing only a stripped down test class still returns "Microsoft.Health.HealthRecordItemKey cannot be serialized because it does not have a parameterless constructor." so it seems to be fundamental to the inheritance of ApplicationSpecific even though both our class and ApplicationSpecific do have parameterless constructors.

    We have loads of dev experience, just not a lot in building complex HealthVault-based classes so the solution could be a "noob" error in this specific area.

    Have you seen and overcome this problem?

    Any guidance gratefully received.

    Thanks.

    P.S. We have read Eric G's posts on class construction so any responses that only point us there won't be a lot of help.

    Monday, January 12, 2015 10:32 AM

All replies

  • Hi Dramacrat,

    I am not familiar with the xsd.exe tool, so I can't help much with the why, but the what( the error being reported ) pretty much says it all.

    The ApplicationSpecific class derives from HealthRecordItem which has a private member of type HealthRecordItemKey that, in fact does not define a parameterless constructor. If you have the SDK source could create a private build of the SDK, and modify the class in question, allowing the tool to run. I would not think that such a change would impact the output so much as to make it unusable.

    -Sean

    Monday, January 12, 2015 10:12 PM
  • Hi Sean,

    Thanks, that pointed me in the right direction.

    They obviously have good reason for not giving a parameterless constructor because adding one just reveals the next error (Cannot serialize HealthRecordItem.TypeSpecificData because it's an interface... IXPathNavigable) so I'll have to work on through the problems or find a way around them.

    All the best,

    Anthony.

    Tuesday, January 13, 2015 2:27 PM