A
Alex Sedow
Continue discuss. (Previous post was: ECMA-335: How to decode PackedLen)
For parsing custom attributes signatures parser needs data from MethodDef
signature. For example (from System.dll):
Custom attribute signature:
0x08 - blob length
0x01 0x00 - Prolog
0xfc 0x17 0x00 0x00 - Val (enum)
0x00 0x00 - NumNamed
Method signature:
0x06 - blob length
0x20 - HASTHIS
0x01 - ParamCount
0x01 - ELEMENT_TYPE_VOID
0x11 - ELEMENT_TYPE_VALUETYPE
0x82, 0x6d - TypeRefOrDefEncoded: System.AttributeTargets
For correct parsing ValueType parser must know what is it: value type or
enum. Signature for value type contain SerString, signature for enum contain
binary value of underlying integer type. I.e. parser must determine on which
type TypeRefOrDefEncoded refers. But if TypeRefOrDefEncoded is reference to
type defined in another assembly, than this reference contain only namespace
and name. And parser must before parse all assemblies on which refers
valuetype typerefs in custom attributes signatures?
So the question is: Is it possible parse custom attributes signature without
additional data from referenced assemblies? Or something missing?
Alex.
For parsing custom attributes signatures parser needs data from MethodDef
signature. For example (from System.dll):
Custom attribute signature:
0x08 - blob length
0x01 0x00 - Prolog
0xfc 0x17 0x00 0x00 - Val (enum)
0x00 0x00 - NumNamed
Method signature:
0x06 - blob length
0x20 - HASTHIS
0x01 - ParamCount
0x01 - ELEMENT_TYPE_VOID
0x11 - ELEMENT_TYPE_VALUETYPE
0x82, 0x6d - TypeRefOrDefEncoded: System.AttributeTargets
For correct parsing ValueType parser must know what is it: value type or
enum. Signature for value type contain SerString, signature for enum contain
binary value of underlying integer type. I.e. parser must determine on which
type TypeRefOrDefEncoded refers. But if TypeRefOrDefEncoded is reference to
type defined in another assembly, than this reference contain only namespace
and name. And parser must before parse all assemblies on which refers
valuetype typerefs in custom attributes signatures?
So the question is: Is it possible parse custom attributes signature without
additional data from referenced assemblies? Or something missing?
Alex.