
Xero.NetStandard.OAuth2 - Can't either serialize or deserialize an invoice
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
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
1
Replies

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.
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.