I have added some additional properties to the generated entities that I set once at load from various sources. If any of the properties are nullable types, the deserialization throws an error if the value is null.
I have traced it down to the XmlHelper.XmlValueToObject method. Using Lutz , I think the problem is that if the type is Nullable, it does not check for xmlValue.Length <= 0 before the converstion of the type, it does that after the case. So the Convert routines are getting called with an empty string, thowing the error.
In my case, I have a nullable Decimal, which ends up calling Convert.ToDecimal("").
using .NET 2.0 runtime - 2.0.7.416
Stack Trace:
System.InvalidOperationException: There is an error in XML document (1, 90897). ---> 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.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.Decimal.Parse(String s, IFormatProvider provider)
at System.Convert.ToDecimal(String value)
at SD.LLBLGen.Pro.ORMSupportClasses.XmlHelper.XmlValueToObject(String typeName, String xmlValue)
at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.Xml2Entity(XmlNode node, Dictionary2 processedObjectIDs, List
1 nodeEntityReferences)
at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.ReadXml(XmlNode node)
at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.ReadXml(XmlReader reader)
at System.Xml.Serialization.XmlSerializationReader.ReadSerializable(IXmlSerializable serializable)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderServices.Read5_GetLeLoanResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer9.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)