Table of Contents

Class CilExceptionHandler

Namespace
AsmResolver.DotNet.Code.Cil
Assembly
AsmResolver.DotNet.dll

Represents a region of code in a CIL method body that is protected by a (filtered) exception handler, finally or faulting clause.

public class CilExceptionHandler
Inheritance
CilExceptionHandler
Inherited Members

Fields

FatExceptionHandlerSize

The size in bytes of an exception handler using the fat format.

public const uint FatExceptionHandlerSize = 24

Field Value

uint

TinyExceptionHandlerSize

The size in bytes of an exception handler using the tiny format.

public const uint TinyExceptionHandlerSize = 12

Field Value

uint

Properties

ExceptionType

Gets or sets the type of exceptions that this exception handler catches.

public ITypeDefOrRef? ExceptionType { get; set; }

Property Value

ITypeDefOrRef

Remarks

This property only has meaning if the HandlerType property is set to Exception.

FilterStart

Gets or sets the instruction that marks the start of the filter region.

public ICilLabel? FilterStart { get; set; }

Property Value

ICilLabel

Remarks

This property only has meaning if the HandlerType property is set to Filter.

HandlerEnd

Gets or sets the instruction that marks the end of the handler region.

public ICilLabel? HandlerEnd { get; set; }

Property Value

ICilLabel

Remarks

This instruction marker is exclusive; the referenced instruction does not belong to the handler region anymore.

HandlerStart

Gets or sets the instruction that marks the start of the handler region.

public ICilLabel? HandlerStart { get; set; }

Property Value

ICilLabel

HandlerType

Gets or sets the type of the protected region.

public CilExceptionHandlerType HandlerType { get; set; }

Property Value

CilExceptionHandlerType

Remarks

This property determines whether the FilterStart and/or ExceptionType properties have any meaning and are persisted or not.

IsFat

Gets a value indicating whether the exception handler requires the fat format to be used to encode the boundaries of the protected region.

public bool IsFat { get; }

Property Value

bool

TryEnd

Gets or sets the instruction that marks the end of the protected region.

public ICilLabel? TryEnd { get; set; }

Property Value

ICilLabel

Remarks

This instruction marker is exclusive; the referenced instruction does not belong to the protected region anymore.

TryStart

Gets or sets the instruction that marks the start of the the protected region.

public ICilLabel? TryStart { get; set; }

Property Value

ICilLabel

Methods

FromReader(CilMethodBody, ref BinaryStreamReader, bool)

Reads a single exception handler from the provided input stream.

public static CilExceptionHandler FromReader(CilMethodBody body, ref BinaryStreamReader reader, bool isFat)

Parameters

body CilMethodBody

The method body containing the exception handler.

reader BinaryStreamReader

The input stream.

isFat bool

true if the fat format should be used, false otherwise.

Returns

CilExceptionHandler

The exception handler.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.