The MemberRef table combines two sorts of references, to Methods and to Fields of a class, known as 'MethodRef' and ‘FieldRef’, respectively.
The MemberRef table has the following columns:
-
Class (an index into the MethodDef, ModuleRef, TypeDef, TypeRef, or TypeSpec tables; more precisely, a MemberRefParent (§II.24.2.6) coded index)
-
Name (an index into the String heap)
-
Signature (an index into the Blob heap)
An entry is made into the MemberRef table whenever a reference is made in the CIL code to a method or field which is defined in another module or assembly. (Also, an entry is made for a call to a method with a VARARG
signature, even when it is defined in the same module as the call site.)
This contains informative text only.
-
Class shall be one of the following: [ERROR]
-
a TypeRef token, if the class that defines the member is defined in another module. (Note that it is unusual, but valid, to use a TypeRef token when the member is defined in this same module, in which case, its TypeDef token can be used instead.)
-
a ModuleRef token, if the member is defined, in another module of the same assembly, as a global function or variable.
-
a MethodDef token, when used to supply a call-site signature for a vararg method that is defined in this module. The Name shall match the Name in the corresponding MethodDef row. The Signature shall match the Signature in the target method definition [ERROR]
-
a TypeSpec token, if the member is a member of a generic type
-
-
Class shall not be null (as this would indicate an unresolved reference to a global function or variable) [ERROR]
-
Name shall index a non-empty string in the String heap [ERROR]
-
The Name string shall be a valid CLS identifier [CLS]
-
Signature shall index a valid field or method signature in the Blob heap. In particular, it shall embed exactly one of the following 'calling conventions': [ERROR]
DEFAULT
(0x0)VARARG
(0x5)FIELD
(0x6)GENERIC
(0x10)
-
The MemberRef table shall contain no duplicates, where duplicate rows have the same Class, Name, and Signature [WARNING]
-
Signature shall not have the
VARARG
(0x5) calling convention [CLS] -
There shall be no duplicate rows, where Name fields are compared using CLS conflicting-identifier-rules. (In particular, note that the return type and whether parameters are marked
ELEMENT_TYPE_BYREF
(§II.23.1.16) are ignored in the CLS. For example,.method int32 M()
and.method float64 M()
result in duplicate rows by CLS rules. Similarly,.method void N(int32 i)
and.method void N(int32& i)
also result in duplicate rows by CLS rules.) [CLS] -
If Class and Name resolve to a field, then that field shall not have a value of
CompilerControlled
(§II.23.1.5) in its Flags.FieldAccessMask
subfield [ERROR] -
If Class and Name resolve to a method, then that method shall not have a value of
CompilerControlled
in its Flags.MemberAccessMask
(§II.23.1.10) subfield [ERROR] -
The type containing the definition of a MemberRef shall be a TypeSpec representing an instantiated type.
End informative text.