Hey There,
We are unable to deserialize an Entity which has an Enum property on it.
The error:There is an error in XML document (73, 13).
Inner Exception: "Object reference not set to an instance of an object." at "SD.LLBLGen.Pro.ORMSupportClasses.XmlHelper.XmlValueToObject(String typeName, String xmlValue]"
We've created an sample solution to reproduce the problem.
using System;
using System.Xml.Serialization;
using System.IO;
using SD.LLBLGen.Pro.ORMSupportClasses;
namespace RepEntSer
{
[Serializable]
public enum TestEnum
{
First,
Second
}
public class GeneratedEntityBase2 : EntityBase2
{
// Generated code here
}
[XmlInclude(typeof(TestEnum))]
public class TestClass : GeneratedEntityBase2
{
public TestEnum Status
{
get { return m_Status; }
set { m_Status = value; }
}
private TestEnum m_Status = TestEnum.First;
}
class Program
{
static void Main(string[] args)
{
TestClass testClass = new TestClass();
StringWriter writer = new StringWriter();
XmlSerializer serializer = new XmlSerializer(typeof (TestClass));
serializer.Serialize(writer, testClass);
string serializedXml = writer.ToString();
StringReader reader = new StringReader(serializedXml);
TestClass deserializedTestClass = (TestClass) serializer.Deserialize(reader);
}
}
}
Could anybody explain to me what is going wrong? Is this an LLBLgen issue or is it an wrong implementation?
Thanks