I have one field defined in CIL, like this:
.field public int32 modopt(void*) fld
I will compile this into an assembly. Now I change it to:
.field public int32 modopt(int16) fld
How is it now possible that ILDASM reports (if indicated as hex) both of these fields like this?
Field #1 (04000001) ------------------------------------------------------- Field Name: fld (04000001) Flags : [Public] (00000006) CallCnvntn: [FIELD] Field type: CMOD_OPT 1b000001 I4 Signature : 06 20 06 08
This code looks for both fields exactly the same (in fact, I created a second field to match the registered signature). The signature obviously corresponds to the second field, but the signature of the first field should look like this: 06 20 0f 01 08 ! What am I missing here?
Edit:
C # cannot emit this type of field, throwing an exception regarding pointer types and arrays that are not supported for custom type modifiers, so this seems to solve the signature mismatch. But the question of why ILDASM allows you to create an invalid signature that it cannot decompile remains.
Edit # 2:
It seems that ILASM is actually creating the correct IL, there is a difference in the hexadecimal dump that I skipped last time:
Thus, there is an error in the hexadecimal dump of ILDASM indicating an incorrect signature of the element (although I wonder where 06 came from in the wrong signature).
IllidanS4
source share