Closed GoogleCodeExporter closed 9 years ago
Hi Pingw33n,
What I think your doing is already defined in the framework. You will want to
set the
attribute on your struct like so:
[XmlRpcMissingMapping(MappingAction.Ignore)]
public struct Test
{
[NonSerialized]
public long NonXmlRpcValidButNotSerialized;
public int XmlRpcValidAndSerialized;
}
You can set it on the individual method.
For more information see Question "1.15 Can I specify struct members as
optional?" at
http://www.xml-rpc.net/faq/xmlrpcnetfaq.html
Hope that helps.
Original comment by Aaron.Mo...@gmail.com
on 3 Mar 2009 at 3:37
Hello. Thanks for a reply.
Actually that won't work, because XmlRpcMissingMappingAttribute with
MappingAction.Ignore only directs to not serialize members that have null value:
// XmlRpcSerializer.cs:741
if (pi.GetValue(o, null) == null)
{
MappingAction memberAction = MemberMappingAction(o.GetType(),
pi.Name, structAction);
if (memberAction == MappingAction.Ignore)
continue;
}
And actual XML writing occurs after a call to
XmlRpcServiceInfo.GetXmlRpcType(o.GetType()) that returns XmlRpcType.tInvalid
because
it doesn't respect NonSerializedAttribute of one or more struct members.
Basically XmlRpcServiceInfo.GetXmlRpcType should return XmlRpcType.tStruct for
structs and classes that has non XML-RPC-valid members but which are marked with
NonSerializedAttribute.
Original comment by pingw33n@gmail.com
on 3 Mar 2009 at 10:02
Fixed as for issue 78.
Original comment by ChasC...@gmail.com
on 13 Mar 2011 at 3:21
Original issue reported on code.google.com by
pingw33n@gmail.com
on 2 Mar 2009 at 7:55Attachments: