Type parameters in methods of instantiated types

Topics: Metadata Model
Aug 5, 2011 at 4:44 AM
Edited Aug 5, 2011 at 4:45 AM

I am using CCI for an analysis task. I recently updated to the latest SVN from a version that was a few months old and am now finding that some type parameters seem to not get instantiated when they should. Specifically, my program finds that the type System.Collections.Generic.IList<System.Byte> exists in the PE file being analyzed and reads the Methods property to get its methods. It finds values of type ISpecializedMethod but here's an example .ToString():

System.Int32 System.Collections.Generic.IList<System.Byte>.IndexOf(T)

The generic parameters in the method return types and parameter types are not instantiated, despite the T of the parameter type being the same T as in the type IList<T> which is filled in with System.Byte in this case. I expect to see

System.Int32 System.Collections.Generic.IList<System.Byte>.IndexOf(System.Byte)

I have not drilled down too much on this yet, but it appears to only happen on instance methods with no type parameters of types with type parameters. My current work on tracing what is going on has gotten me to MetadataHelper/Members.cs:3206 which is the start of the method CopyAndSpecialize in the class SpecializedParameterDefinition. I suspect that method is returning T when it should be returning System.Byte in this instance, but I have not worked through exactly what it is doing. Then again, I am not very familiar with the CCI source code, so I may be looking in the wrong place or misunderstanding what is supposed to be happening.

Aug 5, 2011 at 6:05 AM

If this is a change in behavior and counter to your reasonable expectations, it is probably a bug. Could you create an issue for it, along with some more detail on how to observe this behavior?


Aug 8, 2011 at 9:35 PM
Edited Aug 8, 2011 at 9:35 PM

I apologize for the delay; it was somewhat more difficult to reproduce simply than I expected. I have posted an issue https://ccimetadata.codeplex.com/workitem/6364 .

Aug 8, 2011 at 11:57 PM

This appears to have been a very subtle issue related to the default host's probing logic. Revision 64611 hopefully fixes the problem.