private static void OnCloseOutputSession(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         FramingDuplexSessionChannel.CloseAsyncResult asyncState = (FramingDuplexSessionChannel.CloseAsyncResult)result.AsyncState;
         bool      flag      = false;
         Exception exception = null;
         try
         {
             flag = asyncState.HandleCloseOutputSession(result, false);
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             flag      = true;
             exception = exception2;
         }
         if (flag)
         {
             asyncState.Complete(false, exception);
         }
     }
 }
            private static void OnCompleteCloseScheduled(object state)
            {
                FramingDuplexSessionChannel.CloseAsyncResult result = (FramingDuplexSessionChannel.CloseAsyncResult)state;
                Exception exception = null;

                try
                {
                    result.OnCompleteCloseScheduled();
                }
                catch (Exception exception2)
                {
                    if (Fx.IsFatal(exception2))
                    {
                        throw;
                    }
                    exception = exception2;
                }
                result.Complete(false, exception);
            }