System.Reflection.Emit.__ExceptionInfo.Done C# (CSharp) Method

Done() private method

private Done ( int endAddr ) : void
endAddr int
return void
        internal virtual void Done(int endAddr) {
            BCLDebug.Assert(m_currentCatch > 0,"m_currentCatch > 0");
            BCLDebug.Assert(m_catchAddr[m_currentCatch-1] > 0,"m_catchAddr[m_currentCatch-1] > 0");
            BCLDebug.Assert(m_catchEndAddr[m_currentCatch-1] == -1,"m_catchEndAddr[m_currentCatch-1] == -1");
            m_catchEndAddr[m_currentCatch-1] = endAddr;
            m_currentState = State_Done;
        }

Usage Example

        public virtual void EndExceptionBlock()
        {
            if (this.m_currExcStackCount == 0)
            {
                throw new NotSupportedException(Environment.GetResourceString("Argument_NotInExceptionBlock"));
            }
            __ExceptionInfo info = this.m_currExcStack[this.m_currExcStackCount - 1];

            this.m_currExcStack[this.m_currExcStackCount - 1] = null;
            this.m_currExcStackCount--;
            Label endLabel = info.GetEndLabel();

            switch (info.GetCurrentState())
            {
            case 1:
            case 0:
                throw new InvalidOperationException(Environment.GetResourceString("Argument_BadExceptionCodeGen"));

            case 2:
                this.Emit(OpCodes.Leave, endLabel);
                break;

            case 3:
            case 4:
                this.Emit(OpCodes.Endfinally);
                break;
            }
            if (this.m_labelList[endLabel.GetLabelValue()] == -1)
            {
                this.MarkLabel(endLabel);
            }
            else
            {
                this.MarkLabel(info.GetFinallyEndLabel());
            }
            info.Done(this.m_length);
        }