/// <summary>
        /// Handles the specified exception.
        /// </summary>
        /// <param name="exception">The exception.</param>
        /// <param name="agentName">Name of the agent.</param>
        /// <param name="methodName">Name of the method.</param>
        public void Handle(CommunicationObjectFaultedException exception, string agentName, string methodName)
        {
            _logger.Warn("Communication Exception caught while executing {0} : {1}",
                         methodName, exception.Message);
            _logger.Debug(string.Format("Communication Exception caught while executing {0} : {1}",
                                        methodName, exception.Message), exception);

            throw new AgentException(agentName, "Could not connect to service while executing "
                                     + methodName, exception);
        }
 private void CancelPendingOperations(bool isFaulted)
 {
     this.CancelPing();
     if (Interlocked.Exchange(ref this.interlockedSync, 1) == 0)
     {
         foreach (DuplexRequestBindingElement.DuplexRequestSessionChannel.DuplexCorrelationAsyncResult value in this.inflightRequests.Values)
         {
             DuplexRequestBindingElement.DuplexRequestSessionChannel.DuplexCorrelationAsyncResult duplexCorrelationAsyncResult = value;
             string    str = SRClient.TrackableExceptionMessageFormat(SRClient.ServerDidNotReply, duplexCorrelationAsyncResult.CreateClientTrackingExceptionInfo());
             Exception communicationObjectAbortedException = new CommunicationObjectAbortedException(str);
             if (isFaulted)
             {
                 communicationObjectAbortedException = new CommunicationObjectFaultedException(str);
             }
             ActionItem.Schedule((object s) => duplexCorrelationAsyncResult.TryComplete(false, communicationObjectAbortedException), null);
         }
         this.inflightRequests.Clear();
     }
 }
 /// <summary>
 /// Handles the specified exception.
 /// </summary>
 /// <param name="exception">The exception.</param>
 /// <param name="agentName">Name of the agent.</param>
 public void Handle(CommunicationObjectFaultedException exception, string agentName)
 {
     _logger.Warn("Communication Object Faulted caught : {0}", exception.Message);
     _logger.Debug(string.Format("Communication Object Faulted caught : {0}", exception.Message), exception);
 }