Esempio n. 1
0
        public override int EndRead(IAsyncResult asyncResult)
        {
            if (Interlocked.Decrement(ref m_ReadNesting) != 0)
            {
                Interlocked.Increment(ref m_ReadNesting);
                throw new InvalidOperationException(SR.GetString(SR.net_io_invalidendcall, "EndRead"));
            }

            if (asyncResult == null)
            {
                throw new ArgumentNullException("asyncResult");
            }

            InnerAsyncResult myResult = asyncResult as InnerAsyncResult;

            if (myResult == null)
            {
                // We are just passing IO down, although m_HeadEOF should be always true here.
                GlobalLog.Assert(m_HeadEOF, "CombinedReadStream::EndRead|m_HeadEOF is false and asyncResult is not of InnerAsyncResult type {0).", asyncResult.GetType().FullName);
                return(m_HeadEOF? WrappedStream.EndRead(asyncResult): m_HeadStream.EndRead(asyncResult));
            }

            // this is our wrapped AsyncResult
            myResult.InternalWaitForCompletion();

            // Exception?
            if (myResult.Result is Exception)
            {
                throw (Exception)(myResult.Result);
            }

            // Report the count read
            return((int)myResult.Result);
        }
Esempio n. 2
0
        public override int EndRead(IAsyncResult asyncResult)
        {
            if (Interlocked.Decrement(ref this.m_ReadNesting) != 0)
            {
                Interlocked.Increment(ref this.m_ReadNesting);
                throw new InvalidOperationException(SR.GetString("net_io_invalidendcall", new object[] { "EndRead" }));
            }
            if (asyncResult == null)
            {
                throw new ArgumentNullException("asyncResult");
            }
            InnerAsyncResult result = asyncResult as InnerAsyncResult;

            if (result == null)
            {
                if (!this.m_HeadEOF)
                {
                    return(this.m_HeadStream.EndRead(asyncResult));
                }
                return(base.WrappedStream.EndRead(asyncResult));
            }
            result.InternalWaitForCompletion();
            if (result.Result is Exception)
            {
                throw ((Exception)result.Result);
            }
            return((int)result.Result);
        }
Esempio n. 3
0
        public override int EndRead(IAsyncResult asyncResult)
        {
            if (Interlocked.Decrement(ref m_ReadNesting) != 0)
            {
                Interlocked.Increment(ref m_ReadNesting);
                throw new InvalidOperationException(SR.GetString(SR.net_io_invalidendcall, "EndRead"));
            }

            if (asyncResult == null)
            {
                throw new ArgumentNullException("asyncResult");
            }

            InnerAsyncResult myResult = asyncResult as InnerAsyncResult;

            if (myResult == null)
            {
                // We are just passing IO down, although the shadow stream should be dead for now.
                GlobalLog.Assert(m_ShadowStreamIsDead, "ForwardingReadStream::EndRead|m_ShadowStreamIsDead is false and asyncResult is not of InnerAsyncResult type {0}.", asyncResult.GetType().FullName);
                int bytes = WrappedStream.EndRead(asyncResult);
                if (bytes == 0)
                {
                    m_SeenReadEOF = true;
                }
            }

            // this is our wrapped AsyncResult
            bool suceess = false;

            try {
                myResult.InternalWaitForCompletion();
                // Exception?
                if (myResult.Result is Exception)
                {
                    throw (Exception)(myResult.Result);
                }
                suceess = true;
            }
            finally {
                if (!suceess && !m_ShadowStreamIsDead)
                {
                    m_ShadowStreamIsDead = true;
                    if (m_ShadowStream is ICloseEx)
                    {
                        ((ICloseEx)m_ShadowStream).CloseEx(CloseExState.Abort | CloseExState.Silent);
                    }
                    else
                    {
                        m_ShadowStream.Close();
                    }
                }
            }

            // Report the read count
            return((int)myResult.Result);
        }
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (disposing && InnerAsyncResult != null)
            {
                InnerAsyncResult.Dispose();
                InnerAsyncResult = null;
            }
        }
Esempio n. 5
0
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, Object state)
        {
            try {
                if (Interlocked.Increment(ref m_ReadNesting) != 1)
                {
                    throw new NotSupportedException(SR.GetString(SR.net_io_invalidnestedcall, "BeginRead", "read"));
                }

                if (m_ReadCallback == null)
                {
                    m_ReadCallback = new AsyncCallback(ReadCallback);
                }

                if (m_HeadEOF)
                {
                    return(WrappedStream.BeginRead(buffer, offset, count, callback, state));
                }
                else
                {
                    InnerAsyncResult userResult = new InnerAsyncResult(state, callback, buffer, offset, count);
                    IAsyncResult     ar         = m_HeadStream.BeginRead(buffer, offset, count, m_ReadCallback, userResult);

                    if (!ar.CompletedSynchronously)
                    {
                        return(userResult);
                    }

                    int bytes = m_HeadStream.EndRead(ar);
                    m_HeadLength += bytes;

                    //check on EOF condition
                    if (bytes == 0 && userResult.Count != 0)
                    {
                        //Got a first stream EOF
                        m_HeadEOF = true;
                        m_HeadStream.Close();
                        return(WrappedStream.BeginRead(buffer, offset, count, callback, state));
                    }
                    else
                    {
                        // just complete user IO
                        userResult.Buffer = null;
                        userResult.InvokeCallback(count);
                        return(userResult);
                    }
                }
            }
            catch {
                Interlocked.Decrement(ref m_ReadNesting);
                throw;
            }
        }
Esempio n. 6
0
        private void ReadCallback(IAsyncResult transportResult)
        {
            GlobalLog.Assert(transportResult.AsyncState is InnerAsyncResult, "InnerAsyncResult::ReadCallback|The state expected to be of type InnerAsyncResult, received {0}.", transportResult.GetType().FullName);
            if (transportResult.CompletedSynchronously)
            {
                return;
            }

            // Recover our asyncResult
            InnerAsyncResult userResult = transportResult.AsyncState as InnerAsyncResult;

            ReadComplete(transportResult);
        }
Esempio n. 7
0
        private void ReadCallback(IAsyncResult transportResult)
        {
            GlobalLog.Assert(transportResult.AsyncState is InnerAsyncResult, "InnerAsyncResult::ReadCallback|The state expected to be of type InnerAsyncResult, received {0}.", transportResult.GetType().FullName);
            if (transportResult.CompletedSynchronously)
            {
                return;
            }

            InnerAsyncResult userResult = transportResult.AsyncState as InnerAsyncResult;

            try {
                // Complete transport IO, in this callback that is always the head stream
                int count;
                if (!m_HeadEOF)
                {
                    count         = m_HeadStream.EndRead(transportResult);
                    m_HeadLength += count;
                }
                else
                {
                    count = WrappedStream.EndRead(transportResult);
                }


                //check on EOF condition
                if (!m_HeadEOF && count == 0 && userResult.Count != 0)
                {
                    //Got a first stream EOF
                    m_HeadEOF = true;
                    m_HeadStream.Close();
                    IAsyncResult ar = WrappedStream.BeginRead(userResult.Buffer, userResult.Offset, userResult.Count, m_ReadCallback, userResult);
                    if (!ar.CompletedSynchronously)
                    {
                        return;
                    }
                    count = WrappedStream.EndRead(ar);
                }
                // just complete user IO
                userResult.Buffer = null;
                userResult.InvokeCallback(count);
            }
            catch (Exception e) {
                //ASYNC: try to ignore even serious exceptions (nothing to loose?)
                if (userResult.InternalPeekCompleted)
                {
                    throw;
                }

                userResult.InvokeCallback(e);
            }
        }
        public override int EndRead(IAsyncResult asyncResult)
        {
            if (Interlocked.Decrement(ref this.m_ReadNesting) != 0)
            {
                Interlocked.Increment(ref this.m_ReadNesting);
                throw new InvalidOperationException(SR.GetString("net_io_invalidendcall", new object[] { "EndRead" }));
            }
            if (asyncResult == null)
            {
                throw new ArgumentNullException("asyncResult");
            }
            InnerAsyncResult result = asyncResult as InnerAsyncResult;

            if ((result == null) && (base.WrappedStream.EndRead(asyncResult) == 0))
            {
                this.m_SeenReadEOF = true;
            }
            bool flag = false;

            try
            {
                result.InternalWaitForCompletion();
                if (result.Result is Exception)
                {
                    throw ((Exception)result.Result);
                }
                flag = true;
            }
            finally
            {
                if (!flag && !this.m_ShadowStreamIsDead)
                {
                    this.m_ShadowStreamIsDead = true;
                    if (this.m_ShadowStream is ICloseEx)
                    {
                        ((ICloseEx)this.m_ShadowStream).CloseEx(CloseExState.Silent | CloseExState.Abort);
                    }
                    else
                    {
                        this.m_ShadowStream.Close();
                    }
                }
            }
            return((int)result.Result);
        }
Esempio n. 9
0
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
        {
            IAsyncResult result3;

            try
            {
                if (Interlocked.Increment(ref this.m_ReadNesting) != 1)
                {
                    throw new NotSupportedException(SR.GetString("net_io_invalidnestedcall", new object[] { "BeginRead", "read" }));
                }
                if (this.m_ReadCallback == null)
                {
                    this.m_ReadCallback = new AsyncCallback(this.ReadCallback);
                }
                if (this.m_HeadEOF)
                {
                    return(base.WrappedStream.BeginRead(buffer, offset, count, callback, state));
                }
                InnerAsyncResult result      = new InnerAsyncResult(state, callback, buffer, offset, count);
                IAsyncResult     asyncResult = this.m_HeadStream.BeginRead(buffer, offset, count, this.m_ReadCallback, result);
                if (!asyncResult.CompletedSynchronously)
                {
                    return(result);
                }
                int num = this.m_HeadStream.EndRead(asyncResult);
                this.m_HeadLength += num;
                if ((num == 0) && (result.Count != 0))
                {
                    this.m_HeadEOF = true;
                    this.m_HeadStream.Close();
                    return(base.WrappedStream.BeginRead(buffer, offset, count, callback, state));
                }
                result.Buffer = null;
                result.InvokeCallback(count);
                result3 = result;
            }
            catch
            {
                Interlocked.Decrement(ref this.m_ReadNesting);
                throw;
            }
            return(result3);
        }
 public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
 {
     IAsyncResult result3;
     try
     {
         if (Interlocked.Increment(ref this.m_ReadNesting) != 1)
         {
             throw new NotSupportedException(SR.GetString("net_io_invalidnestedcall", new object[] { "BeginRead", "read" }));
         }
         if (this.m_ReadCallback == null)
         {
             this.m_ReadCallback = new AsyncCallback(this.ReadCallback);
         }
         if (this.m_HeadEOF)
         {
             return base.WrappedStream.BeginRead(buffer, offset, count, callback, state);
         }
         InnerAsyncResult result = new InnerAsyncResult(state, callback, buffer, offset, count);
         IAsyncResult asyncResult = this.m_HeadStream.BeginRead(buffer, offset, count, this.m_ReadCallback, result);
         if (!asyncResult.CompletedSynchronously)
         {
             return result;
         }
         int num = this.m_HeadStream.EndRead(asyncResult);
         this.m_HeadLength += num;
         if ((num == 0) && (result.Count != 0))
         {
             this.m_HeadEOF = true;
             this.m_HeadStream.Close();
             return base.WrappedStream.BeginRead(buffer, offset, count, callback, state);
         }
         result.Buffer = null;
         result.InvokeCallback(count);
         result3 = result;
     }
     catch
     {
         Interlocked.Decrement(ref this.m_ReadNesting);
         throw;
     }
     return result3;
 }
Esempio n. 11
0
 private void ReadCallback(IAsyncResult transportResult)
 {
     if (!transportResult.CompletedSynchronously)
     {
         InnerAsyncResult asyncState = transportResult.AsyncState as InnerAsyncResult;
         try
         {
             int num;
             if (!this.m_HeadEOF)
             {
                 num = this.m_HeadStream.EndRead(transportResult);
                 this.m_HeadLength += num;
             }
             else
             {
                 num = base.WrappedStream.EndRead(transportResult);
             }
             if ((!this.m_HeadEOF && (num == 0)) && (asyncState.Count != 0))
             {
                 this.m_HeadEOF = true;
                 this.m_HeadStream.Close();
                 IAsyncResult asyncResult = base.WrappedStream.BeginRead(asyncState.Buffer, asyncState.Offset, asyncState.Count, this.m_ReadCallback, asyncState);
                 if (!asyncResult.CompletedSynchronously)
                 {
                     return;
                 }
                 num = base.WrappedStream.EndRead(asyncResult);
             }
             asyncState.Buffer = null;
             asyncState.InvokeCallback(num);
         }
         catch (Exception exception)
         {
             if (asyncState.InternalPeekCompleted)
             {
                 throw;
             }
             asyncState.InvokeCallback(exception);
         }
     }
 }
Esempio n. 12
0
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, Object state)
        {
            if (Interlocked.Increment(ref m_ReadNesting) != 1)
            {
                throw new NotSupportedException(SR.GetString(SR.net_io_invalidnestedcall, "BeginRead", "read"));
            }

            try {
                if (m_ReadCallback == null)
                {
                    m_ReadCallback = new AsyncCallback(ReadCallback);
                }

                if (m_ShadowStreamIsDead && m_BytesToSkip == 0L)
                {
                    return(WrappedStream.BeginRead(buffer, offset, count, callback, state));
                }
                else
                {
                    InnerAsyncResult userResult = new InnerAsyncResult(state, callback, buffer, offset, count);
                    if (m_BytesToSkip != 0L)
                    {
                        InnerAsyncResult temp = userResult;
                        userResult = new InnerAsyncResult(temp, null, new byte[4096],
                                                          0, m_BytesToSkip < (long)buffer.Length? (int)m_BytesToSkip: buffer.Length);
                    }
                    IAsyncResult result = WrappedStream.BeginRead(userResult.Buffer, userResult.Offset, userResult.Count, m_ReadCallback, userResult);
                    if (result.CompletedSynchronously)
                    {
                        ReadComplete(result);
                    }
                    return(userResult);
                }
            }
            catch {
                Interlocked.Decrement(ref m_ReadNesting);
                throw;
            }
        }
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
        {
            IAsyncResult result4;

            if (Interlocked.Increment(ref this.m_ReadNesting) != 1)
            {
                throw new NotSupportedException(SR.GetString("net_io_invalidnestedcall", new object[] { "BeginRead", "read" }));
            }
            try
            {
                if (this.m_ReadCallback == null)
                {
                    this.m_ReadCallback = new AsyncCallback(this.ReadCallback);
                }
                if (this.m_ShadowStreamIsDead && (this.m_BytesToSkip == 0L))
                {
                    return(base.WrappedStream.BeginRead(buffer, offset, count, callback, state));
                }
                InnerAsyncResult result = new InnerAsyncResult(state, callback, buffer, offset, count);
                if (this.m_BytesToSkip != 0L)
                {
                    InnerAsyncResult userState = result;
                    result = new InnerAsyncResult(userState, null, new byte[0x1000], 0, (this.m_BytesToSkip < buffer.Length) ? ((int)this.m_BytesToSkip) : buffer.Length);
                }
                IAsyncResult transportResult = base.WrappedStream.BeginRead(result.Buffer, result.Offset, result.Count, this.m_ReadCallback, result);
                if (transportResult.CompletedSynchronously)
                {
                    this.ReadComplete(transportResult);
                }
                result4 = result;
            }
            catch
            {
                Interlocked.Decrement(ref this.m_ReadNesting);
                throw;
            }
            return(result4);
        }
 public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
 {
     IAsyncResult result4;
     if (Interlocked.Increment(ref this.m_ReadNesting) != 1)
     {
         throw new NotSupportedException(SR.GetString("net_io_invalidnestedcall", new object[] { "BeginRead", "read" }));
     }
     try
     {
         if (this.m_ReadCallback == null)
         {
             this.m_ReadCallback = new AsyncCallback(this.ReadCallback);
         }
         if (this.m_ShadowStreamIsDead && (this.m_BytesToSkip == 0L))
         {
             return base.WrappedStream.BeginRead(buffer, offset, count, callback, state);
         }
         InnerAsyncResult result = new InnerAsyncResult(state, callback, buffer, offset, count);
         if (this.m_BytesToSkip != 0L)
         {
             InnerAsyncResult userState = result;
             result = new InnerAsyncResult(userState, null, new byte[0x1000], 0, (this.m_BytesToSkip < buffer.Length) ? ((int) this.m_BytesToSkip) : buffer.Length);
         }
         IAsyncResult transportResult = base.WrappedStream.BeginRead(result.Buffer, result.Offset, result.Count, this.m_ReadCallback, result);
         if (transportResult.CompletedSynchronously)
         {
             this.ReadComplete(transportResult);
         }
         result4 = result;
     }
     catch
     {
         Interlocked.Decrement(ref this.m_ReadNesting);
         throw;
     }
     return result4;
 }
Esempio n. 15
0
        private void ReadComplete(IAsyncResult transportResult)
        {
            while (true)
            {
                // Recover our asyncResult
                InnerAsyncResult userResult = transportResult.AsyncState as InnerAsyncResult;

                try
                {
                    if (!userResult.IsWriteCompletion)
                    {
                        userResult.Count = WrappedStream.EndRead(transportResult);
                        if (userResult.Count == 0)
                        {
                            m_SeenReadEOF = true;
                        }


                        if (!m_ShadowStreamIsDead)
                        {
                            userResult.IsWriteCompletion = true;
                            //Optionally charge notification write IO
                            transportResult = m_ShadowStream.BeginWrite(userResult.Buffer, userResult.Offset, userResult.Count, m_ReadCallback, userResult);
                            if (transportResult.CompletedSynchronously)
                            {
                                continue;
                            }
                            return;
                        }
                    }
                    else
                    {
                        GlobalLog.Assert(!m_ShadowStreamIsDead, "ForwardingReadStream::ReadComplete|ERROR: IsWriteCompletion && m_ShadowStreamIsDead");

                        m_ShadowStream.EndWrite(transportResult);
                        userResult.IsWriteCompletion = false;
                    }
                }
                catch (Exception e)
                {
                    //ASYNC: try to ignore even serious exceptions (nothing to loose?)
                    if (userResult.InternalPeekCompleted)
                    {
                        GlobalLog.Print("ShadowReadStream::ReadComplete() Rethrowing Exception (end), userResult.IsCompleted, stack trace = " + e.ToString());
                        throw;
                    }

                    try
                    {
                        m_ShadowStreamIsDead = true;
                        if (m_ShadowStream is ICloseEx)
                        {
                            ((ICloseEx)m_ShadowStream).CloseEx(CloseExState.Abort | CloseExState.Silent);
                        }
                        else
                        {
                            m_ShadowStream.Close();
                        }
                    }
                    catch (Exception ee)
                    {
                        //ASYNC: Again try to ignore even serious exceptions
                        GlobalLog.Print("ShadowReadStream::ReadComplete() Got (ignoring) Exception, on shadow stream.Close, stack trace = " + ee.ToString());
                    }

                    if (!userResult.IsWriteCompletion || m_ThrowOnWriteError)
                    {
                        if (transportResult.CompletedSynchronously)
                        {
                            throw;
                        }

                        userResult.InvokeCallback(e);
                        return;
                    }
                }

                // Need to process, re-issue the read.
                try
                {
                    if (m_BytesToSkip != 0L)
                    {
                        m_BytesToSkip   -= userResult.Count;
                        userResult.Count = m_BytesToSkip < (long)userResult.Buffer.Length? (int)m_BytesToSkip: userResult.Buffer.Length;
                        if (m_BytesToSkip == 0L)
                        {
                            // we did hide the original IO request in the outer iaresult state.
                            // charge the real user operation now
                            transportResult = userResult;
                            userResult      = userResult.AsyncState as InnerAsyncResult;
                            GlobalLog.Assert(userResult != null, "ForwardingReadStream::ReadComplete|ERROR: Inner IAResult is null after stream FastForwarding.");
                        }
                        transportResult = WrappedStream.BeginRead(userResult.Buffer, userResult.Offset, userResult.Count, m_ReadCallback, userResult);
                        if (transportResult.CompletedSynchronously)
                        {
                            continue;
                        }
                        return;
                    }
                    //if came to here, complete original user IO
                    userResult.InvokeCallback(userResult.Count);
                    return;
                }
                catch (Exception e)
                {
                    //ASYNC: try to ignore even serious exceptions (nothing to loose?)
                    if (userResult.InternalPeekCompleted)
                    {
                        GlobalLog.Print("ShadowReadStream::ReadComplete() Rethrowing Exception (begin), userResult.IsCompleted, stack trace = " + e.ToString());
                        throw;
                    }

                    try
                    {
                        m_ShadowStreamIsDead = true;
                        if (m_ShadowStream is ICloseEx)
                        {
                            ((ICloseEx)m_ShadowStream).CloseEx(CloseExState.Abort | CloseExState.Silent);
                        }
                        else
                        {
                            m_ShadowStream.Close();
                        }
                    }
                    catch (Exception ee)
                    {
                        //ASYNC: Again try to ignore even serious exceptions
                        GlobalLog.Print("ShadowReadStream::ReadComplete() Got (ignoring) Exception, on shadow stream.Close (after begin), stack trace = " + ee.ToString());
                    }

                    if (transportResult.CompletedSynchronously)
                    {
                        throw;
                    }

                    // This will set the exception result first then try to execute a user callback
                    userResult.InvokeCallback(e);
                    return;
                }
            }
        }
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, Object state) {
            if (Interlocked.Increment(ref m_ReadNesting) != 1) {
                throw new NotSupportedException(SR.GetString(SR.net_io_invalidnestedcall, "BeginRead", "read"));
            }

            try {

                if (m_ReadCallback == null) {
                    m_ReadCallback = new AsyncCallback(ReadCallback);
                }

                if (m_ShadowStreamIsDead && m_BytesToSkip == 0L) {
                    return m_OriginalStream.BeginRead(buffer, offset, count, callback, state);
                }
                else {
                    InnerAsyncResult userResult = new InnerAsyncResult(state, callback, buffer, offset, count);
                    if (m_BytesToSkip != 0L) {
                        InnerAsyncResult temp = userResult;
                        userResult = new InnerAsyncResult(temp, null, new byte[4096],
                                                          0, m_BytesToSkip < (long) buffer.Length? (int)m_BytesToSkip: buffer.Length);
                    }
                    IAsyncResult result = m_OriginalStream.BeginRead(userResult.Buffer, userResult.Offset, userResult.Count, m_ReadCallback, userResult);
                    if (result.CompletedSynchronously)
                    {
                        ReadComplete(result);
                    }
                    return userResult;
                }
            }
            catch {
                Interlocked.Decrement(ref m_ReadNesting);
                throw;
            }
        }
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, Object state) {
            try {
                if (Interlocked.Increment(ref m_ReadNesting) != 1) {
                    throw new NotSupportedException(SR.GetString(SR.net_io_invalidnestedcall, "BeginRead", "read"));
                }

                if (m_ReadCallback == null) {
                    m_ReadCallback = new AsyncCallback(ReadCallback);
                }

                if (m_HeadEOF) {
                    return m_TailStream.BeginRead(buffer, offset, count, callback, state);
                }
                else {
                    InnerAsyncResult userResult = new InnerAsyncResult(state, callback, buffer, offset, count);
                    IAsyncResult ar = m_HeadStream.BeginRead(buffer, offset, count, m_ReadCallback, userResult);

                    if (!ar.CompletedSynchronously)
                    {
                        return userResult;
                    }

                    int bytes = m_HeadStream.EndRead(ar);
                    m_HeadLength += bytes;

                    //check on EOF condition
                    if (bytes == 0 && userResult.Count != 0) {
                        //Got a first stream EOF
                        m_HeadEOF = true;
                        m_HeadStream.Close();
                        return m_TailStream.BeginRead(buffer, offset, count, callback, state);
                    }
                    else {
                        // just complete user IO
                        userResult.Buffer = null;
                        userResult.InvokeCallback(count);
                        return userResult;
                    }

                }
            }
            catch {
                Interlocked.Decrement(ref m_ReadNesting);
                throw;
            }
        }