Example #1
0
        static void ReadCallback(object state)
        {
            ConnectionModeReader reader   = (ConnectionModeReader)state;
            bool      completeSelf        = false;
            Exception completionException = null;

            try
            {
                if (reader.GetReadResult())
                {
                    completeSelf = reader.ContinueReading();
                }
            }
#pragma warning suppress 56500 // Microsoft, transferring exception to caller
            catch (Exception e)
            {
                if (Fx.IsFatal(e))
                {
                    throw;
                }

                completeSelf        = true;
                completionException = e;
            }

            if (completeSelf)
            {
                reader.Complete(completionException);
            }
        }
        private static void ReadCallback(object state)
        {
            ConnectionModeReader reader = (ConnectionModeReader)state;
            bool      flag = false;
            Exception e    = null;

            try
            {
                if (reader.GetReadResult())
                {
                    flag = reader.ContinueReading();
                }
            }
            catch (Exception exception2)
            {
                if (Fx.IsFatal(exception2))
                {
                    throw;
                }
                flag = true;
                e    = exception2;
            }
            if (flag)
            {
                reader.Complete(e);
            }
        }