On May 12, 1:12 pm, "Jb Evain" <
j...@nurv.fr> wrote:
> Thanks for the example, I'll investigate.
I think the problem may stem from how TypeSpecification objects are
cached in the class ReflectionReader.
Consider the following code:
public TypeReference GetTypeSpecAt (uint rid, GenericContext context)
{
if (rid > m_typeSpecs.Length)
return null;
int index = (int) rid - 1;
TypeReference tspec = m_typeSpecs [index];
if (tspec != null)
return tspec;
...
}
If a TypeSpecification object of the appropriate index has been cached
in the m_typeSpecs array, it is returned unchanged.
As I understand the metadata model, the TypeSpecification object
returned by this method depends on the GenericContext, but this is
circumvented using this caching scheme and in effect a
TypeSpecification potentially based on a different GenericContext
object is returned instead.
So maybe it does not make sense to cache the TypeSpecification objects
by index alone in the way it is done here? Maybe it should either not
be cached or cached by context and index?