We are experiencing different behavior on our clients when handling FaultExceptions thrown by our WCF service depending on the version of .NET framework.
The service defines a custom fault:
[DataContract]
public class MyFault
{
[DataMember]
public int MyId { get; set; }
}
The interface of the service:
[ServiceContract]
public interface IMyService
{
[OperationContract]
[FaultContract(typeof(MyFault))]
MyResponse DoSomething(MyRequest request);
}
The client handles the exception:
try
{
client.DoSomething(myrequest);
}
catch (FaultException<MyFault> ex)
{
...
}
On a .NET 4.5 machine he will recognise the fault as FaultException<MyFault>
and handle it as expected.
However, on a .NET 4 machine he will treat the fault as FaultException
(non-generic), so the catch is never reached.
We captured the traffic on the machines to see if there are differences in the communication. Both, request and response are identical. We even updated a .NET 4 machine to .NET 4.5 (without updating any other software or our client software) and the behavior changed.
Is there any logical explanation?