FaultConverter.OnTryCreateException Method (Message, MessageFault, Exception)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Tries to create the exception.

Namespace:   System.ServiceModel.Channels
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

protected abstract bool OnTryCreateException(
	Message message,
	MessageFault fault,
	out Exception exception


Type: System.ServiceModel.Channels.Message

The fault message.

Type: System.ServiceModel.Channels.MessageFault

The fault.

Type: System.Exception

If conversion is successful, the SOAP exception, returned as an out parameter.

Return Value

Type: System.Boolean

true if fault was successfully converted; otherwise, false. The default is false.

For a channel layer to implement GetProperty<FaultConverter> to support converting fault messages to SOAP exceptions, override this method to create an exception by doing the following steps:

  • Inspect the fault message.

  • If recognized, do the appropriate conversion.

  • If not recognized, convert it by a call to GetProperty<FaultConverter> on the inner channel.

Transport channels should delegate to GetDefaultFaultConverter to get the default SOAP/WS-Addressing fault converter.

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Available since 3.0
Windows Phone Silverlight
Available since 7.0
Return to top