Metadata Validity Rules

Metadata Validity Rules

The event-related and property-related metadata tables are Event, EventMap, Property, PropertyMap, Method, MethodSemantics, TypeDef, TypeRef, and Constant. Earlier chapters have discussed the validity rules for Method, TypeDef, TypeRef, and Constant tables. The records of the remaining tables have the following entries:

  • The Event table: EventFlags, Name, and EventType.

  • The EventMap table: Parent and EventList.

  • The Property table: PropFlags, Name, and Type.

  • The PropertyMap table: Parent and PropertyList.

  • The MethodSemantics table: Semantic, Method, and Association.

Event Table Validity Rules

  • The EventFlags entry must contain 0, or must have the specialname flag set (0x0200), or must have both the specialname and rtspecialname flags set (0x0600).

  • The Name entry must contain a valid offset in the #Strings stream, indexing a string no longer than 1023 bytes in UTF-8 encoding.

  • If the specialname and rtspecialname flags are set, the event name must be _Deleted*.

  • No duplicate records—those with the same name belonging to the same class—can exist unless the event name is _Deleted*.

  • The EventType entry must contain a valid reference to the TypeDef or TypeRef table.

EventMap Table Validity Rules

  • The Parent entry must hold a valid reference to the TypeDef table.

  • The EventList entry must hold a valid reference to the Event table.

Property Table Validity Rules

  • The PropFlags entry must contain 0 or a combination of the binary flags specialname (0x0200), rtspecialname (0x0400), and 0x1000.

  • If the rtspecialname flag is set, the specialname flag must also be set.

  • If the 0x1000 flag is set, the Constant table must contain a valid record whose Parent entry holds the reference to this Property record, and vice versa.

  • The Name entry must contain a valid offset in the #Strings stream, indexing a string no longer than 1023 bytes in UTF-8 encoding.

  • If the specialname and rtspecialname flags are set, the property name must be _Deleted*.

  • No duplicate records—those with the same name and signature belonging to the same class—can exist unless the property name is _Deleted*.

  • The Type entry must contain a valid offset in the #Blob stream, indexing a valid property signature. The validity rules for property signatures were discussed in Chapter 7, “Primitive Types and Signatures.”

PropertyMap Table Validity Rules

  • The Parent entry must hold a valid reference to the TypeDef table.

    The PropertyList entry must hold a valid reference to the Property table.

MethodSemantics Table Validity Rules

  • The Semantic entry must contain one of the following values: msSetter (0x0001), msGetter (0x0002), msOther (0x0004), msAddOn (0x0008), msRemoveOn (0x0010), msFire (0x0020).

  • The Method entry must contain a valid index to the Method table.

  • The Association entry must contain a valid reference to the Event or Property table.

  • If the Semantic entry contains msSetter or msGetter, the Association entry must reference the Property table.

  • If the Semantic entry contains msAddOn, msRemoveOn, or msFire, the Association entry must reference the Event table.

  • No duplicate records that have the same Method and Association entries can exist.

  • No duplicate records that have the same Association and Semantic entries can exist unless the Semantic entry contains msOther.

  • For each Event record referenced in the Association entry, the table can contain one and only one MethodSemantics record with a Semantic entry equal to msAddOn.

  • For each Event record referenced in the Association entry, the table can contain one and only one MethodSemantics record with a Semantic entry equal to msRemoveOn.

  • For each Event record referenced in the Association entry, the table can contain no more than one MethodSemantics record with a Semantic entry equal to msFire.



Inside Microsoft. NET IL Assembler
Inside Microsoft .NET IL Assembler
ISBN: 0735615470
EAN: 2147483647
Year: 2005
Pages: 147
Authors: SERGE LIDIN

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net