FaultConverter.OnTryCreateException Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

When implemented in a derived class, tries to create the exception.

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

Syntax

'Declaration
Protected MustOverride Function OnTryCreateException ( _
    message As Message, _
    fault As MessageFault, _
    <OutAttribute> ByRef exception As Exception _
) As Boolean
protected abstract bool OnTryCreateException(
    Message message,
    MessageFault fault,
    out Exception exception
)

Parameters

Return Value

Type: System.Boolean
true if fault was successfully converted; otherwise, false. The default is false.

Remarks

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

  • 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.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.