Table of Contents

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

protectedRange AddressRange

The IL offset range the exception handler is protecting.

Properties

CurrentHandler

Gets the current active exception handler (if available).

public CilExceptionHandler? CurrentHandler { get; }

Property Value

CilExceptionHandler

ExceptionObject

Gets the current exception object that was thrown within the protected range.

public ObjectHandle ExceptionObject { get; }

Property Value

ObjectHandle

Handlers

Gets a list of handlers that are associated to the protected range.

public IReadOnlyList<CilExceptionHandler> Handlers { get; }

Property Value

IReadOnlyList<CilExceptionHandler>

HasFinalizer

Gets a value indicating whether the exception handler has a finalizer block.

public bool HasFinalizer { get; }

Property Value

bool

IsHandlingException

Gets a value indicating whether the exception handler is currently handling the exception referenced by ExceptionObject.

public bool IsHandlingException { get; }

Property Value

bool

IsProtecting

Gets a value indicating whether the frame is currently protecting the current instruction pointer.

public bool IsProtecting { get; }

Property Value

bool

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

AddressRange

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

offset int

The offset.

Returns

bool

true if the offset is within the frame, false otherwise.

EndFilter(bool)

Exits a filter clause, and determines the next offset to jump to.

public int? EndFilter(bool result)

Parameters

result bool

true if the exception should be handled by the current handler, false otherwise.

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

true if the frame was entered, false if 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

leaveTargetOffset int

The 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

exceptionObject ObjectHandle

The exception object.

Returns

int?

Reset()

Resets the exception handler to its initial state.

public void Reset()