Unexpected results using Exception Shielding

Jul 19, 2007 at 8:47 PM
I have been working with the EntLib's Exception Handling block for a bit now, but have encountered something with Exception Shielding that has me perplexed.... Hope I can find some help here.

Experience has shown me that a WCF service/client setup with no ExceptionShielding and debug info turned off that if there is an exception thrown in the service and you catch and look at the message on the client you get a "generic" message to the effect of "Problems consuming service, contact admin".

Here is my setup.....
I have a error structure marked with the DataContract/DataMember attributes.
I have a WCF_Service with the 'ExceptionShielding' attribute set on the Service Contract interface.
My Service declares 'FaultContracts' of my error structure type can be thrown.
I have configured my App.config for my host to shield type="System.Exception" with the error structure fault contract.
I have the 'includeExceptionDetailInFaults' attribute set to false.
My one service method performs an operation that causes a "Attempted to Divide by Zero" exception to be raised.

I can consume and call the service just fine (of course it throws an error, by design).
I can successfully catch exceptions of type FaultException<MyType> just fine and access any properties on it.

The weird part for me:
What I am seeing is with ExceptionShielding in place, if I simply catch the general exception, e.g.
catch (Exception ex)

it contains the SPECIFIC error being thrown at the service ("Attempted to Divide by Zero").
Why is it when I have Exception Shielding turned on do I have the ability to catch the general exception and see the actual service exception? Can someone shed some light for me, any help is appreciated.