While testing the Duplex Channel with Callback implementation, I found out how the fault or various exceptions on the callback would affect the Duplex channel state. 

1)      Callback implementation received a message with an invalid or an unexpected action.    In this case, Duplex Channel will be closed and can no longer be used for communication.

 

2)      Callback implementation received a message with an invalid or an unexpected soap body.  Duplex Channel will try to return the fault back to the caller.  The Duplex Channel state is not affected by this and continues to function.

 

3)      Callback implementation explicitly throws an Exception of FaultException type. 

class EchoCallback : IEchoCallback

{

    public void OnEcho(string msg)

    {

        throw new FaultException("fault reason");

    }

}

 

Duplex Channel will try to return the fault back to the caller.  The Duplex Channel state is not affected by this and continues to function.

 

4)      Callback implementation explicitly throws an Exception which is not of FaultException type. 

class EchoCallback : IEchoCallback

{

    public void OnEcho(string msg)

    {

        throw new Exception("exception message");

    }

}

 

By default, the exception is considered unhandled and the Duplex Channel state will aborted and can no longer be used for communication.