Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Wrapper libraries >

Xero.NetStandard.OAuth2 - Can't either serialize or deserialize an invoice

Started by Marco Pessina -   in Wrapper libraries

Hi,
when I try to serialize an invoice got from Demo Company I get this error:
InvalidOperationException: Types 'Xero.NetStandard.OAuth2.Model.ContactGroup.StatusEnum' and 'Xero.NetStandard.OAuth2.Model.Invoice.StatusEnum' both use the XML type name, 'StatusEnum', from namespace ''. Use XML attributes to specify a unique XML name and/or namespace for the type.

This is the method I'm using to serialize:

public static string SerializeObject<T>(this T toSerialize)
{
XmlSerializer xmlSerializer = new XmlSerializer(toSerialize.GetType());
StringWriter textWriter = new StringWriter();

xmlSerializer.Serialize(textWriter, toSerialize);
return textWriter.ToString();
}

Any idea how to solve it?
Thanks,
Marco
Hi Marco - thanks for reporting.

This is likely an issue best reported in the SDK: https://github.com/XeroAPI/Xero-NetStandard/issues

I am surprised it is happening with Demo company as that org is used for a lot of testing. Also are you sure you are using the most recent release? OAuth2.0 and our sdks are only supporting JSON to my knowledge, so that might have something to do with your issue.
 

Christopher Knight (Xero Staff)