Class CilMethodBodySerializer
- Namespace
- AsmResolver.DotNet.Code.Cil
- Assembly
- AsmResolver.DotNet.dll
Provides a default implementation of the IMethodBodySerializer interface, that serializes all managed CIL method bodies of type CilMethodBody to raw method bodies of type CilRawMethodBody.
public class CilMethodBodySerializer : IMethodBodySerializer
- Inheritance
-
CilMethodBodySerializer
- Implements
- Inherited Members
Constructors
CilMethodBodySerializer()
public CilMethodBodySerializer()
Properties
ComputeMaxStackOnBuildOverride
Gets or sets the value of an override switch indicating whether the max stack should always be recalculated or should always be preserved.
public bool? ComputeMaxStackOnBuildOverride { get; set; }
Property Value
- bool?
Remarks
When this property is set to true, the maximum stack depth of all method bodies will be recalculated.
When this property is set to false, the maximum stack depth of all method bodies will be preserved.
When this property is set to null, the maximum stack depth will only be recalculated if
ComputeMaxStackOnBuild is set to true.
ForceFullReassemble
Gets or sets a value indicating whether all method bodies should be fully verified and reassembled, including previously serialized method bodies that have not been modified.
public bool ForceFullReassemble { get; set; }
Property Value
SortExceptionHandlersOnBuildOverride
Gets or sets the value of an override switch indicating whether exception handlers should always be sorted or not.
public bool? SortExceptionHandlersOnBuildOverride { get; set; }
Property Value
- bool?
Remarks
When this property is set to true, all method bodies will have their exception handlers sorted.
When this property is set to false, no method body will have their exception handlers sorted.
When this property is set to null, a method body will have its exception handlers sorted if
SortExceptionHandlersOnBuild is set to true.
VerifyLabelsOnBuildOverride
Gets or sets the value of an override switch indicating whether labels should always be verified for validity or not.
public bool? VerifyLabelsOnBuildOverride { get; set; }
Property Value
- bool?
Remarks
When this property is set to true, all method bodies will be verified for branch validity.
When this property is set to false, no method body will be verified for branch validity.
When this property is set to null, a method body will only be verified if
VerifyLabelsOnBuild is set to true.
Methods
SerializeMethodBody(MethodBodySerializationContext, MethodDefinition)
Serializes the body of the provided method definition into a segment that can be added to a PE image.
public ISegmentReference SerializeMethodBody(MethodBodySerializationContext context, MethodDefinition method)
Parameters
contextMethodBodySerializationContextThe context in which the serializer is situated in.
methodMethodDefinitionThe method to serialize the method body for.
Returns
- ISegmentReference
A reference to a segment that encodes the method body.