Inconsistent sequencing error when Deserializing

Sep 27, 2011 at 11:40 AM

Hello, I have just started to try out xsd2code.
I have a simple xml and use VS 2010 to generated an xsd
And then use xsd2code to generate the VB classes
All OK and compiles.
When I try to Deserialize the original xml is gives an error thus:
Inconsistent sequencing: if used on one of the class's members, the 'Order' property 
is required on all particle-like members, please explicitly set 'Order' using XmlElement,
XmlAnyElement or XmlArray custom attribute on class member
The code below is where it throws the error.



serializer = New XmlSerializer(GetType(Hotel))


<System.Xml.Serialization.XmlArrayAttribute(Order:=1), _ 
System.Xml.Serialization.XmlArrayItemAttribute("Room", IsNullable:=False)> _
Public Property Rooms() As ObservableCollection(Of HotelRoom)
It seems that if I remove the "Order" line above things work OK ?
Note: I have tried GenerateXmlAttributes True/False but still the same.
Any ideas ?
Thanks Jim
Sep 28, 2011 at 10:07 PM
Edited Sep 28, 2011 at 10:08 PM

I am having the exact same issue but I cannot understand why it is not generating the Order attribute.


It should add the Order atribute to all properties.

Mar 8, 2012 at 2:53 PM
Edited Mar 8, 2012 at 2:54 PM

I had the same problem today.

But I had a large XSD file, so adding the attributes would take a long time.

The solutions to this problem is to set the property "GenerateXmlAttributes" = true (in "Serialization") in the "XSD2Code class generator" dialog.

Have fun