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

◆ BeginCatchBlock()

override void System.Reflection.Emit.DynamicILGenerator.BeginCatchBlock ( Type exceptionType)
inlinevirtual

Reimplemented from System.Reflection.Emit.ILGenerator.

Definition at line 285 of file DynamicILGenerator.cs.

286 {
287 if (base.CurrExcStackCount == 0)
288 {
289 throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
290 }
291 __ExceptionInfo _ExceptionInfo = base.CurrExcStack[base.CurrExcStackCount - 1];
292 RuntimeType runtimeType = exceptionType as RuntimeType;
293 if (_ExceptionInfo.GetCurrentState() == 1)
294 {
295 if (exceptionType != null)
296 {
297 throw new ArgumentException(SR.Argument_ShouldNotSpecifyExceptionType);
298 }
299 Emit(OpCodes.Endfilter);
300 _ExceptionInfo.MarkCatchAddr(ILOffset, null);
301 return;
302 }
303 if (exceptionType == null)
304 {
305 throw new ArgumentNullException("exceptionType");
306 }
307 if (runtimeType == null)
308 {
309 throw new ArgumentException(SR.Argument_MustBeRuntimeType);
310 }
311 Label endLabel = _ExceptionInfo.GetEndLabel();
312 Emit(OpCodes.Leave, endLabel);
313 UpdateStackSize(OpCodes.Nop, 1);
314 _ExceptionInfo.MarkCatchAddr(ILOffset, exceptionType);
315 _ExceptionInfo.m_filterAddr[_ExceptionInfo.m_currentCatch - 1] = GetTokenFor(runtimeType);
316 }
void UpdateStackSize(OpCode opcode, int stackchange)

References System.SR.Argument_MustBeRuntimeType, 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.DynamicILGenerator.GetTokenFor(), System.Reflection.Emit.ILGenerator.ILOffset, System.Reflection.Emit.OpCodes.Leave, System.Reflection.Emit.__ExceptionInfo.m_filterAddr, System.Reflection.Emit.__ExceptionInfo.MarkCatchAddr(), System.Reflection.Emit.OpCodes.Nop, and System.Reflection.Emit.ILGenerator.UpdateStackSize().