Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ BeginCatchBlock()

virtual void System.Reflection.Emit.ILGenerator.BeginCatchBlock ( Type exceptionType)
inlinevirtual

Reimplemented in System.Reflection.Emit.DynamicILGenerator.

Definition at line 821 of file ILGenerator.cs.

822 {
823 if (m_currExcStackCount == 0)
824 {
825 throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
826 }
827 __ExceptionInfo _ExceptionInfo = m_currExcStack[m_currExcStackCount - 1];
828 if (_ExceptionInfo.GetCurrentState() == 1)
829 {
830 if (exceptionType != null)
831 {
832 throw new ArgumentException(SR.Argument_ShouldNotSpecifyExceptionType);
833 }
834 Emit(OpCodes.Endfilter);
835 }
836 else
837 {
838 if (exceptionType == null)
839 {
840 throw new ArgumentNullException("exceptionType");
841 }
842 Emit(OpCodes.Leave, _ExceptionInfo.GetEndLabel());
843 }
844 _ExceptionInfo.MarkCatchAddr(m_length, exceptionType);
845 }

References System.SR.Argument_NotInExceptionBlock, System.SR.Argument_ShouldNotSpecifyExceptionType, System.Reflection.Emit.OpCodes.Endfilter, System.Reflection.Emit.__ExceptionInfo.GetCurrentState(), System.Reflection.Emit.__ExceptionInfo.GetEndLabel(), System.Reflection.Emit.OpCodes.Leave, System.Reflection.Emit.ILGenerator.m_currExcStack, System.Reflection.Emit.ILGenerator.m_currExcStackCount, System.Reflection.Emit.ILGenerator.m_length, and System.Reflection.Emit.__ExceptionInfo.MarkCatchAddr().

Referenced by System.Xml.Serialization.CodeGenerator.BeginCatchBlock(), System.Linq.Expressions.Compiler.LambdaCompiler.EmitCatchStart(), and System.Linq.Expressions.Compiler.LambdaCompiler.EmitTryExpression().