From Exceptions to Faults

A question that I often get asked during workshops on WCF is “Why does WCF use Faults instead of .NET Exceptions?”

Exceptions expose a set of limitations and possible security risks:

- They are platform/technology specific: .NET exceptions may have no meaning on other platforms

- Exceptions can cause tight-coupling between clients and service.

o Clients need to understand exactly what exceptions can be thrown by each operation

- Flowing exceptions to clients may expose service implementation details

- Flowing exceptions to clients may expose private and personal information

- Exceptions and exception hierarchies are not easily represented using metadata

Therefore a map between exceptions on the service and their equivalent on the client is required. This is achieved using SOAP Faults.
It is worth mentioning that exceptions that reach WCF clients are represented as FaultException.