XML Deserialization Issue

XML Deserialization Issue

Comments

  • I have an object “reward” with single property “rewardItemId” Int32 Allow Nulls.

    When deserializing XML into the object, even though the property allows nulls, it fails if there is no value in the XML with the following exception.

    System.InvalidOperationException: There is an error in XML document (3, 3). ---> System.FormatException: Input string was not in a correct format.
    at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
    at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
    at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderreward.Read3_NullableOfInt32(Boolean checkType)
    at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderreward.Read4_reward(Boolean isNullable, Boolean checkType)
    at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderreward.Read5_reward()
    --- End of inner exception stack trace ---
    at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
    at System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream)
    at DecisionsFramework.Design.Flow.CoreSteps.XML.XMLDeserializeStep.Run(StepStartData data)

  • If youre using XML that is being built manually with string steps, it is encouraged that you use the Xml Serialize step from an object first. Then, use the output String from that in the following steps. This will ensure that required attributes are output correctly in the XML string.

Sign In or Register to comment.