Class ExceptionHandlerFrame
- Namespace
- Echo.Platforms.AsmResolver.Emulation.Stack
- Assembly
- Echo.Platforms.AsmResolver.dll
Provides a mechanism for implementing exception handling for a single protected range within a single method body.
public class ExceptionHandlerFrame
- Inheritance
-
ExceptionHandlerFrame
- Inherited Members
Constructors
ExceptionHandlerFrame(AddressRange)
Creates a new exception handler frame.
public ExceptionHandlerFrame(AddressRange protectedRange)
Parameters
protectedRangeAddressRangeThe IL offset range the exception handler is protecting.
Properties
CurrentHandler
Gets the current active exception handler (if available).
public CilExceptionHandler? CurrentHandler { get; }
Property Value
ExceptionObject
Gets the current exception object that was thrown within the protected range.
public ObjectHandle ExceptionObject { get; }
Property Value
Handlers
Gets a list of handlers that are associated to the protected range.
public IReadOnlyList<CilExceptionHandler> Handlers { get; }
Property Value
HasFinalizer
Gets a value indicating whether the exception handler has a finalizer block.
public bool HasFinalizer { get; }
Property Value
IsHandlingException
Gets a value indicating whether the exception handler is currently handling the exception referenced by ExceptionObject.
public bool IsHandlingException { get; }
Property Value
IsProtecting
Gets a value indicating whether the frame is currently protecting the current instruction pointer.
public bool IsProtecting { get; }
Property Value
NextOffset
Gets the offset to jump to after a finalizer has exited (if available).
public int? NextOffset { get; }
Property Value
- int?
ProtectedRange
Gets the IL offset range the exception handler is protecting.
public AddressRange ProtectedRange { get; }
Property Value
Methods
ContainsOffset(int)
Determines whether the provided offset falls within the protected offset range or any of the handlers.
public bool ContainsOffset(int offset)
Parameters
offsetintThe offset.
Returns
- bool
trueif the offset is within the frame,falseotherwise.
EndFilter(bool)
Exits a filter clause, and determines the next offset to jump to.
public int? EndFilter(bool result)
Parameters
resultbooltrueif the exception should be handled by the current handler,falseotherwise.
Returns
- int?
The offset to jump to.
EndFinally()
Exits a finally block, and determines the next offset to jump to.
public int? EndFinally()
Returns
- int?
The offset to jump to.
Enter()
Attempts to enter the protected range.
public bool Enter()
Returns
- bool
trueif the frame was entered,falseif the frame was already entered before.
Leave(int)
Leaves either a protected range or an exception handler while marking the exception as handled successfully.
public int Leave(int leaveTargetOffset)
Parameters
leaveTargetOffsetintThe target offset to jump to.
Returns
- int
The offset to jump to.
RegisterException(ObjectHandle)
Registers the occurrence of an exception, and determines the next offset to jump to that will attempt to handle the exception or finalize the code block.
public int? RegisterException(ObjectHandle exceptionObject)
Parameters
exceptionObjectObjectHandleThe exception object.
Returns
- int?
Reset()
Resets the exception handler to its initial state.
public void Reset()