- Home
- LLBLGen Pro
- LLBLGen Pro Runtime Framework
Custom Enum breaks WCF Serialization
Joined: 15-Feb-2007
Hi there
EDIT : THIS IS FIXED IN THE MOST CURRENT VERSION.
I just discovered that if I add an enum to my entity, WCF serialization breaks. Strangely enough, XML write/read within a unit tests works just fine.
//this is an entity
public partial class TicketEntity
{
public TicketStatus Status
{
get { return TicketStatus.Pending; }
set { /* ignore */ }
}
}
public enum TicketStatus
{
[EnumMember]
[XmlEnum("0")]
Undefined = 0,
[EnumMember]
[XmlEnum("1")]
Pending = 1
}
As soon as I add the _XmlIgnore _attribute to the property, everything works just fine. I saw an older thread regarding the issue, which ended with the note that this would be fixed with 2.5, but it appears there's still an issue.
Notes:
- Adding the _XMLEnum _attribute seems to be ignored by LLBLGen - the _WriteXml _method serializes the string representation of the enum value (e.g. "[i]Pending[/i]"). Removing the attribute does not help Runtime: LLBLGen 2.5.0.0 (Adapter) / .NET 3.5
...this is currently not an issue for me, as the enum is a convenience property that I don't want to serialize anyway, but it might be worth having a look.
Cheers, Philipp
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
Server stack trace: at SD.LLBLGen.Pro.ORMSupportClasses.XmlHelper.XmlValueToObject(String typeNam e, String xmlValue) at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.Xml2Entity(XmlReader reader, Dictionary
2 processedObjectIDs, List
1 nodeEntityReferences) at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.ReadXml(XmlReader reader, Xml FormatAspect format) at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.System.Xml.Serialization.IXml Serializable.ReadXml(XmlReader reader) at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadIXmlSerial izable(XmlSerializableReader xmlSerializableReader, XmlReaderDelegator xmlReader , XmlDataContract xmlDataContract, Boolean isMemberType) at System.Runtime.Serialization.XmlDataContract.ReadXmlValue(XmlReaderDelegat or xmlReader, XmlObjectSerializerReadContext context) at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContra ctValue(DataContract dataContract, XmlReaderDelegator reader) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeseri alize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContr act) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeseri alize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract , String name, String ns) at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(Xml ReaderDelegator xmlReader, Boolean verifyObjectName) at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleException s(XmlReaderDelegator reader, Boolean verifyObjectName) at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlDictiona ryReader reader, Boolean verifyObjectName) at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.De serializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequ est) at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.De serializeParameter(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.De serializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest) at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents( Message message, Object[] parameters, Boolean isRequest) at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRunt ime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean on eway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan tim eout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean on eway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall Message methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req Msg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa ta, Int32 type) at Dialogik.HelpDesk.Services.ITicketService.GetTicket(Int32 ticketId) at Dialogik.HelpDesk.Clients.ConsoleClient.Program.Main(String[] args) in P:\ My Data\Evolve\Projects\Dialogik\Help Desk\src\trunk\Clients\Console\Program.cs: line 25