public void OnLocalFault(Exception e, WsrmFault fault, RequestContext context)
        {
            Message faultMessage = (fault == null) ? null : fault.CreateMessage(this.settings.MessageVersion,
                                                                                this.settings.ReliableMessagingVersion);

            this.OnLocalFault(e, faultMessage, context);
        }
        public virtual void Abort()
        {
            this.guard.Abort();
            this.inactivityTimer.Abort();

            // Try to send a fault.
            bool sendFault;

            lock (this.ThisLock)
            {
                // Faulted thread already cleaned up. No need to to anything more.
                if (this.faulted == SessionFaultState.CleanedUp)
                {
                    return;
                }

                // Can only send a fault if the other side did not send one already.
                sendFault    = this.canSendFault && (this.faulted != SessionFaultState.RemotelyFaulted); // NotFaulted || LocallyFaulted
                this.faulted = SessionFaultState.CleanedUp;
            }

            if (sendFault)
            {
                if ((this.binder.State == CommunicationState.Opened) &&
                    this.binder.Connected &&
                    (this.binder.CanSendAsynchronously || (this.replyFaultContext != null)))
                {
                    if (this.terminatingFault == null)
                    {
                        UniqueId sequenceId = this.InputID ?? this.OutputID;
                        if (sequenceId != null)
                        {
                            WsrmFault fault = SequenceTerminatedFault.CreateCommunicationFault(sequenceId, SR.GetString(SR.SequenceTerminatedOnAbort), null);
                            this.terminatingFault = fault.CreateMessage(this.settings.MessageVersion,
                                                                        this.settings.ReliableMessagingVersion);
                        }
                    }

                    if (this.terminatingFault != null)
                    {
                        this.AddFinalRanges();
                        this.faultHelper.SendFaultAsync(this.binder, this.replyFaultContext, this.terminatingFault);
                        return;
                    }
                }
            }

            // Got here so the session did not actually send a fault, must clean up resources.
            if (this.terminatingFault != null)
            {
                this.terminatingFault.Close();
            }
            if (this.replyFaultContext != null)
            {
                this.replyFaultContext.Abort();
            }
            this.binder.Abort();
        }
 public void OnLocalFault(Exception e, WsrmFault fault, RequestContext context)
 {
     Message faultMessage = (fault == null) ? null : fault.CreateMessage(this.settings.MessageVersion,
         this.settings.ReliableMessagingVersion);
     this.OnLocalFault(e, faultMessage, context);
 }