Allow FaultContractAttribute to be specified on a ServiceContract interface - by JocularJoe

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 343148 Comments
Status Closed Workarounds
Type Suggestion Repros 1
Opened 5/10/2008 3:11:16 AM
Access Restriction Public


Currently if a client wants to be able to handle a custom FaultException, a FaultContract needs to be declared explicitly on each relevant method (OperationContract).  This is somewhat analagous to checked exceptions in java.

Suggest allowing FaultContract to be declared on a ServiceContract interface.
Sign in to post a comment.
Posted by JocularJoe on 2/25/2012 at 8:10 AM
Doesn't appear to have made it into 4.0 or 4.5 either. So I'm surprised it's closed as "Fixed".
Posted by Twan Jacobs on 3/24/2009 at 4:03 AM
Guess this didn't make it to wcf 3.5. Will this issue be resolved in version 4.0? I would opt for the interface level attributes ;-)
I've read suggestions to create an IContractBehavior that adds the service-wide faultcontracts. Unfortunately one would have to edit the ContractDescription, which would result in undefined execution behavior (according to the MSDN docs). Read all about this here:
Posted by JocularJoe on 5/17/2008 at 10:06 AM
That was of course meant to read as follows (two different FaultContracts):

public interface IServiceBase

... etc ...
Posted by JocularJoe on 5/17/2008 at 10:04 AM
An additional thought I had was that it would be even better to be able to inherit the FaultContract attribute from a base interface. In this way a FaultContract can be added to several ServiceContracts with one line of code.

I.e. in the following example both FaultContracts would apply to all operations of both IMyService1 and IMyService2:

public interface IServiceBase


public interface IMyService1 : IServiceBase
... operations ...

public interface IMyService2 : IServiceBase
... operations ...

Posted by Microsoft on 5/16/2008 at 12:32 PM
Hello JocularJoe,

Thanks for using WCF and submitting your feedback.

We had a brief internal conversation about your suggestion, and I logged a bug to consider adding this in the next release of WCF.

-Yavor Georgiev
Program Manager
Connected Framework Team
Posted by JocularJoe on 5/12/2008 at 1:28 PM
See also the following forum post: