The essence is as follows. There are 2 services. The structure is similar. In the first service type is used

[DataContract] public class SurveyItem : BindableBase 

In the second, there is also a type that inherits from BindableBase .

I checked everything, the whole structure is identical. But in the second service the error takes off:

"System.Runtime.Serialization.InvalidDataContractException: Type" AccessPanel.SurveyInvitor.Infrastructure.Models.GeneralQuotaPropertiesSurvey "cannot be derived from a type that is not marked using the DataContractAttribute attribute or SerializableAttribute attribute. BindableBase "using the DataContractAttribute attribute or SerializableAttribute, or remove them from the derived type."

Why in one case swears, but not in the other? Is it possible to somehow mark the base class with this attribute?

    1 answer 1

    You can try using an alternative serializer by setting the [XmlType] attribute instead of [DataContract] .

    But generally speaking, you're doing something weird. Messages transmitted via WCF are DTO (Data Transfer Objects), they cannot be view models.

    From the view model (VM, View Model), the immutability of the object reference is expected and the property is variable. In your case, each time the method is called, a new object will be created.