We have a WCF service that exposes a "Customer" type, i.e.:
[DataContract(Name = "CustomerData", Namespace = "http://www.testing.com")] public partial class Customer { [DataMember] public CustomerLevel Level { get; set; } }
You can see the above type has a property that is an enumeration type. The definition for this enum is:
[IgnoreCoverage] [DataContract(Namespace = "http://www.testing.com"")] public enum CustomerLevel : int { [EnumMember(Value = "Platinum")] Platinum = 1, [EnumMember(Value = "Gold")] Gold = 2, [EnumMember(Value = "Silver")] Silver = 3, [EnumMember(Value = "Bronze")] Bronze = 4, }
The service works fine as long as the server sends a valid enumeration for each customer that it returns. However, if the service returns a CustomerLevel that is not defined in the enumeration the service call times out.
An example of a bad CustomerLevel value might be:
customer.Level = (CustomerLevel)0;
The service also times out if the client attempts to send a non-defined value.
Is there any way to allow the non-defined value to flow through to both the client and server and let each of them handle the bad value on their own?