In your WCF service, never let an exception propagate outside the service boundary without managing it. 2 Alternatives then :
Most of the developers know how to handle exception in .Net code and good strategy can consist in letting an exception bubble up if it cannot be handled correctly, ultimately this exception will be managed by one of the .Net framework default handler which can depending of the situation close the application.
WCF manages things slightly differently, indeed if the developer let an exception bubbles up to the WCF default handler, it will convert this .Net typed exception (which has no representation in the SOA world) as a Fault Exception (which is represented in the SOA world as a SOAP fault http://www.w3.org/TR/soap12-part1/ ) and then propagate this exception to the client. Up to this point, you think everything is OK, and you are right indeed it’s legitimate the client application receives the exception and manages it. However there are 2 problems here :
For those of you who wants more information this blog is very good : http://weblogs.asp.net/pglavich/archive/2008/10/16/wcf-ierrorhandler-and-propagating-faults.aspx from a general point of view, the implementation of IErrorHandler is a popular approach to handle this issue so from your favorite search engine (www.live.com) just search for IErrorhandler.
Contributed by Fabrice Aubert
I have long thought that one of the coolest features of the Windows OS for developers is the Windows Error Reporting infrastructure (with roots in Dr. Watson). You can have your application upload dumps to the WinQual portal – http://winqual.microsoft.com.
One of the problems though has always been getting those dumps off of the WER site. Before it was a manual process of going to the WinQual website and download CAB files. Well I found out today that the WER team recently released a Web Service that allows you to pull them down automatically. They have also released some sample applications to get you started:
Windows Error Reporting on CodePlex - http://www.codeplex.com/wer
This opens up all sorts of possibilities such as automatically creating bugs in your bug DB (TFS hopefully!) in response to a new dump file getting uploaded so that someone on your team can take a look.
Finally the WER team has a blog up and running (http://blogs.msdn.com/wer) and their first entry discusses this and has some demo videos from PDC:
http://blogs.msdn.com/wer/archive/2008/11/25/windows-error-reporting-wer-blog.aspx
Enjoy!
Zach