public static bool End(IAsyncResult result, out Message message)
        {
            ReceiveMessageAndVerifySecurityAsyncResultBase securityAsyncResultBase = AsyncResult.End <ReceiveMessageAndVerifySecurityAsyncResultBase>(result);

            message = securityAsyncResultBase.message;
            return(securityAsyncResultBase.receiveCompleted);
        }
 private static void InnerTryReceiveCompletedCallback(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         ReceiveMessageAndVerifySecurityAsyncResultBase asyncState = (ReceiveMessageAndVerifySecurityAsyncResultBase)result.AsyncState;
         Exception exception = null;
         bool      flag      = false;
         try
         {
             if (!asyncState.innerChannel.EndTryReceive(result, out asyncState.message))
             {
                 asyncState.receiveCompleted = false;
                 flag = true;
             }
             else
             {
                 asyncState.receiveCompleted = true;
                 flag = asyncState.OnInnerReceiveDone(ref asyncState.message, asyncState.timeoutHelper.RemainingTime());
             }
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             flag      = true;
             exception = exception2;
         }
         if (flag)
         {
             asyncState.Complete(false, exception);
         }
     }
 }
        static void InnerTryReceiveCompletedCallback(IAsyncResult result)
        {
            if (result.CompletedSynchronously)
            {
                return;
            }
            ReceiveMessageAndVerifySecurityAsyncResultBase thisResult = (ReceiveMessageAndVerifySecurityAsyncResultBase)result.AsyncState;
            Exception completionException = null;
            bool      completeSelf        = false;

            try
            {
                bool innerReceiveCompleted = thisResult.innerChannel.EndTryReceive(result, out thisResult.message);
                if (!innerReceiveCompleted)
                {
                    thisResult.receiveCompleted = false;
                    completeSelf = true;
                }
                else
                {
                    thisResult.receiveCompleted = true;
                    completeSelf = thisResult.OnInnerReceiveDone(ref thisResult.message, thisResult.timeoutHelper.RemainingTime());
                }
            }
#pragma warning suppress 56500 // covered by FxCOP
            catch (Exception e)
            {
                if (Fx.IsFatal(e))
                {
                    throw;
                }

                completeSelf        = true;
                completionException = e;
            }
            if (completeSelf)
            {
                thisResult.Complete(false, completionException);
            }
        }