catch (BlockBookingInvalidFloorsException ex)
{
throw new FaultException(ex);
}
Despite the fact that both the custom exception and the contained classes are marked as [Serializable()] it results in a WCF CommunicationException.To resolve this we now add this new constructor:
public BlockBookingInvalidFloorsException(SerializationInfo serializationInfo, StreamingContext streamingContext)
: base(serializationInfo, streamingContext) { }
Martin found this blog with a fuller explanation: WCF and Custom ExceptionsClaus suggests that custom exceptions should derive from either CommunicationException or System.Exception. Our's derive from ApplicationException with no problem, indeed the ApplicationException already includes this constructor (protected).
No comments:
Post a Comment