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

MarkCatchAddr() private method

private MarkCatchAddr ( int catchAddr, Type catchException ) : void
catchAddr int
catchException System.Type
return void
        internal virtual void MarkCatchAddr(int catchAddr, Type catchException) {
            m_currentState = State_Catch;
            MarkHelper(catchAddr, catchAddr, catchException, None);
        }

Usage Example

        public override void BeginCatchBlock(Type exceptionType)
        {
            if (CurrExcStackCount == 0)
            {
                throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
            }
            Contract.EndContractBlock();

            __ExceptionInfo current = CurrExcStack[CurrExcStackCount - 1];

            RuntimeType rtType = exceptionType as RuntimeType;

            if (current.GetCurrentState() == __ExceptionInfo.State_Filter)
            {
                if (exceptionType != null)
                {
                    throw new ArgumentException(SR.Argument_ShouldNotSpecifyExceptionType);
                }

                this.Emit(OpCodes.Endfilter);

                current.MarkCatchAddr(ILOffset, null);
            }
            else
            {
                // execute this branch if previous clause is Catch or Fault
                if (exceptionType == null)
                {
                    throw new ArgumentNullException(nameof(exceptionType));
                }

                if (rtType == null)
                {
                    throw new ArgumentException(SR.Argument_MustBeRuntimeType);
                }

                Label endLabel = current.GetEndLabel();
                this.Emit(OpCodes.Leave, endLabel);

                // if this is a catch block the exception will be pushed on the stack and we need to update the stack info
                UpdateStackSize(OpCodes.Nop, 1);

                current.MarkCatchAddr(ILOffset, exceptionType);


                // this is relying on too much implementation details of the base and so it's highly breaking
                // Need to have a more integrated story for exceptions
                current.m_filterAddr[current.m_currentCatch - 1] = GetTokenFor(rtType);
            }
        }
All Usage Examples Of System.Reflection.Emit.__ExceptionInfo::MarkCatchAddr