I've found a way to get the FaultExceptions to deserialize properly. It's very hackish though and I feel a bit uncomfortable using it, but I thought I'd share in case anyone else is looking to solve this issue. If a better answer is available I'd be happy to hear.
In order to replace the serializer with my own custom serializer what I done is replace the XmlSerializerOperationBehavior
with my own MyOperationBehavior
(the way it's done everywhere I saw on the web). I found though that if instead of replacing the behavior I just add my new behavior to the list of behaviors, the faults will be deserialized as expected. One thing to note though is that MyOperationBehavior
should be placed in the list of behaviors before XmlSerializerOperationBehavior
- otherwise the custom serializer won't be used.
description.Behaviors.Insert(0, new MyOperationBehavior());
As I said, having these two behaviors together sounds like it can cause problems I'm not aware of, so I'd be happy to get input on that as well if you know of any conflicts that this solution may raise.