ECMA-335: How to decode PackedLen

  • Thread starter Thread starter Alex Sedow
  • Start date Start date
A

Alex Sedow

MetaData specification (ECMA-335) contain PackedLen values.
But PackedLen not described in specification.
How to decode it?

Thanks,
Alex.
 
Alex,
MetaData specification (ECMA-335) contain PackedLen values.
But PackedLen not described in specification.
How to decode it?

It's uses the compression algorithm described in 22.2



Mattias
 
22.2 describe how to decode encoded value. Probably PackedLen is not equal
to encoded value (?). For example in System.dll custom attribute signature
(22.3) contain follow bytes:
0x08 - blob length
0x01, 0x00 - Prolog
0xfc 0x17 0x00 0x00 - PackedLen? (incorrect encoded value)
0x00 0x00 - NumNamed
 
Alex,
22.2 describe how to decode encoded value. Probably PackedLen is not equal
to encoded value (?).

Yes it is.

For example in System.dll custom attribute signature
(22.3) contain follow bytes:
0x08 - blob length
0x01, 0x00 - Prolog
0xfc 0x17 0x00 0x00 - PackedLen? (incorrect encoded value)
0x00 0x00 - NumNamed

I assume that blob is for the AttributeUsage attribute on
System.ComponentModel.EditorBrowsableAttribute, at least that's the
only occurance of that blob I found in System.dll.

If so, there's no PackedLen involved at all here. 0x000017fc is the
System.AttributeTargets value passed to the attributes first and only
positional parameter.



Mattias
 
Thanks for answer Mattias,

1. Yes, this is attribute for
System.ComponentModel.EditorBrowsableAttribute.
Custom attribure parsed with method signature. Method signature is:
0x06 - blob size
0x20 - HASTHIS
0x01 - ParamCount
0x01 - ELEMENT_TYPE_VOID
0x11 - ELEMENT_TYPE_VALUETYPE
0x82, 0x6d - TypeRefOrDefEncoded: System.AttributeTargets

Probably, I something missing in spec. Before I think that Elem for
ELEMENT_VALUETYPE (0x11) must contain SerString (that include PackedLen as
prefix). This is wrong (?).
Spec says (syntax diagram on p. 145) that Elem contain Val for simple and
enum or contain SerString for string or type. Why custom attribute contain
value 0x000017fc?

2. If PackedLen is not equal to encoded value, than how to decode it? (this
is not described in ECMA-335).

Alex.
 
System.AttributeTargets is enum! (I forget verify that).
So one question staying:

2. If PackedLen is not equal to encoded value, than how to decode it? (this
is not described in ECMA-335).
 
Back
Top