在解析IL bytes array时,在解析以下操作数之后:
OperandType : InlineField
FlowControl : Next
OpCodeType : Objmodel
StackBehaviourPop : Popref_pop1
StackBehaviourPush : Push0
Size : 1
Value : 125
Name : stfld
在大多数情况下,我可以使用Module.ResolveField来解析以下字段名称,方法是传递操作数后的32位值。
但是在某些情况下会引发错误:
使用“ 1”参数调用“ ResolveField”的异常:“ A 解析签名时已引发BadImageFormatException。 这可能是由于缺少通用上下文。确保 提供了genericTypeArguments和genericMethodArguments,并且 包含足够的上下文。”
根据Microsoft文档,我怀疑这是由于我需要按照https://docs.microsoft.com/en-us/dotnet/api/system.reflection.module.resolvefield?view=netframework-4.7.2#System_Reflection_Module_ResolveField_System_Int32_System_Type___System_Type___传递genericTypeArguments和genericMethodArguments
解析ILBytes数组时,确定我需要传递给这些参数的最佳方法是什么?