This project is read-only.

WSCF.Blue and FaultContract generation support

Apr 12, 2010 at 7:32 AM
Hi, I'm exploring WSCf.Blue features for WCF code generation in my project. It has wonderful features for generating Service Contract, Data Contract and Message Contract through .XSD and Wizard. But still missing with Fault Contract mapping for the Operation Contracts. I could not see any option to attach FaultContract objects to Operation Contract (Method). Is there any option available for mapping the FaultContract and generating code for the same?? Yes, we can manually add FaultContract attribute on top of OperationContract declaration. but it will be overwritten next time if regenerated next time. Then, i need to update everytime I generate Service/Operation contract code. Is this the way of doing as of now? Please clarify me this issue. Thanks, Anbu
Apr 14, 2010 at 2:56 PM

Hi Anbu,

Unfortunately there is not currently support for mapping your fault types while building the WSDL. This is certainly an issue we are looking to address.

If you do not regenerate your WSDL often you can manually add your fault information to the WSDL after finishing with the wizard. If you do this the correct code with FaultContract attributes will be generated for you.



Apr 15, 2010 at 6:59 AM

Thanks a lot Alex for your Update. Actually we do regeneration of WSDL methods frequently in our project. As you said, FaultContract mapping is not supported currently by WSCF.Blue, we are looking for this good features in the future relaeses.

Beside, Can we handle WCF exception WITHOUT Fault Contract? Is that advisable solution?

            In that case, we must directly throw FaultException (with reason) from service to client. Is this a right approach? Or any other best practice available to handle WCF excetion without FaultContract?

Please assist me.



Apr 15, 2010 at 12:56 PM

It is recommended that you use declared SOAP faults and ensure that the fault details are present in the WSDL. You should really only use undeclared SOAP faults for debugging purposes. Although it is a pain, this means that you would need to keep merging the fault information back into your WSDL after regenerating (a merge tool should help make this easier for incremental changes). When you throw a non-generic FaultException you miss out on the opportunity to provide additional information to the client.

Apr 15, 2010 at 2:45 PM

Thank you Alex. So using FaultContract (declared SOAP faults) is the best approach according to WCF design.

Anyway FaultException class has properties (like Message, Reason, Source and FaultCode) to send exception details to client. What are the addtional information can be sent to client?  

And can you recommend any mering tool for WSDL changes?






Apr 15, 2010 at 4:36 PM

Hi Anbu,

Yes, declaring a proper fault contract is the recommended approach. When using declared SOAP faults you can send any type you like in your fault message. You should add the fault messages into your WSDL and let generate the code with the FaultContractAttributes for you. Then any automatically generated metadata/WSDL that WCF creates will also expose the fault contract correctly.

WinMerge is a good open source differencing and merging tool.



Apr 15, 2010 at 8:21 PM


I too am interested in and all its great features.  However, I too am in this dilemna.  From your comment earlier about future releases, do you have a gut feeling when fault contracts might be included as part of the toolset (3, 6 months, 1 years, etc)?  I am looking to standardize on a tool and this could help me guage if manually generating fault contracts is worthwhile if a projected solution is in sight. 

Thanks so much for all the great work!!! Really cool stuff !!!


Apr 19, 2010 at 7:01 AM

 Hi Alex,

            Thank you very much for your inputs and recommendations. I will try to implement the same approach. Even I'm intrested in rough date on inclusion of Fault Contract feature in WSCF.Blue toolset.

Thanks once again,



Apr 27, 2010 at 2:28 PM

Hi all,

I have started work on this and will be going back to finish it soon (work is keeping me very busy at the moment).



May 31, 2010 at 2:43 PM

Hi Anbu and Andy,

You will be pleased to hear that I have now added support for fault contracts. It is included in the V1.0.9 Update release.

You can read about the new feature on my blog.

It would be great if you could test this out and report any problems.