I have a simple class, let's say "Team" and I expose a WCF service (basicHttpBinding, hosted in IIS) with a GetTeams operation which returns an array of Team.
The Team class looks like
[DataContract]
public class Team
{
[DataMember]
public int Id { get; set; }
[DataMember]
public Point Position { get; set; }
[DataMember]
public string Code { get; set; }
[DataMember]
public bool Available { get; set; }
[DataMember]
public string Extra { get; set; }
[DataMember]
public double X { get; set; }
[DataMember]
public double Y { get; set; }
}
On the client (Silverlight 3.0 app) I get all the data but the Position property holds a default Point instance. The Point struct is System.Windows.Media.Point which is serializable. I also added the X and Y properties to duplicate the Position data to see if it gets right on the other end of the wire.
The XML intercepted (thanks, Firebug!) looks like so:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<GetTeamsResponse xmlns="http://tempuri.org/">
<GetTeamsResult xmlns:a="http://schemas.datacontract.org/2004/07/MyProject.Data" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:Team>
<a:Code>A23HJGF23</a:Code>
<a:Available>true</a:Available>
<a:Extra i:nil="true"/>
<a:Id>1</a:Id>
<a:Position xmlns:b="http://schemas.datacontract.org/2004/07/System.Windows">
<b:_x>572194.59937858</b:_x>
<b:_y>322518.3889979</b:_y>
</a:Position>
<a:X>572194.59937858</a:X>
<a:Y>322518.3889979</a:Y>
</a:Team>
<!-- other <a:Team> elements -->
</GetTeamsResult>
</GetTeamsResponse>
</s:Body>
</s:Envelope>
Therefore it seems there is a deserialization issue. No exception is thrown!
Why?