private static void OnReceive(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         FramingDuplexSessionChannel.TryReceiveAsyncResult asyncState = (FramingDuplexSessionChannel.TryReceiveAsyncResult)result.AsyncState;
         Exception exception = null;
         try
         {
             asyncState.CompleteReceive(result);
         }
         catch (TimeoutException exception2)
         {
             if (DiagnosticUtility.ShouldTraceInformation)
             {
                 DiagnosticUtility.ExceptionUtility.TraceHandledException(exception2, TraceEventType.Information);
             }
         }
         catch (Exception exception3)
         {
             if (Fx.IsFatal(exception3))
             {
                 throw;
             }
             exception = exception3;
         }
         asyncState.Complete(false, exception);
     }
 }
 public static bool End(IAsyncResult result, out Message message)
 {
     FramingDuplexSessionChannel.TryReceiveAsyncResult result2 = AsyncResult.End <FramingDuplexSessionChannel.TryReceiveAsyncResult>(result);
     message = result2.message;
     return(result2.receiveSuccess);
 }