I'm not certain where the error is resulting (from silverlight, from wcf, something else...) but, I have a WCF service being called from Silverlight. The method returns a class, with a property that does not have a setter. This throws an error. If I add a setter to the property then it does not give an error.
The error is the usual impenetrable and unhelpful Silverlight error message, but...
[Serializable]
[DataContract]
public SomeClass {
DataMember]
public string PropertyA { get; set; }
public string PropertyB { get { return "Hi There"; } }
}
Throws an error...
But change it to:
[Serializable]
[DataContract]
public SomeClass {
[DataMember]
public string PropertyA { get; set; }
public string PropertyB { get { return "Hi There"; } set {} }
}
No error.
Includes the usual ISomeService.svc & SomeService.svc class, references updated in Silverlight calling the client async, etc., etc.
What is the correct way to configure the property (some attribute other than "DataMember" to allow a get-only, or a private-set property) to pass it over the wire?