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
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
.
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
context
MethodBodySerializationContextThe context in which the serializer is situated in.
method
MethodDefinitionThe method to serialize the method body for.
Returns
- ISegmentReference
A reference to a segment that encodes the method body.