I was wondering what the best way to resolve a metadata token (as retrieved via reflection) in CCI to a source location.
The use case is that I have a file containing information about types/members (and each of those includes a metadata token).
I know that it is possible to use a method metadata token to retrieve the source location as shown in this thread: http://ccimetadata.codeplex.com/discussions/361167 but that doesn't
fulfill my use case 100%.
I would either need a way to retrieve a source location for ANY metadata token (mainly type/property/event additionally to method) or a way to access the method metadata tokens of a type (ie. first method), property (ie. get accessor method), event (ie.
add accessor method).
I think the second approach is more realistic since the metadata tokens for properties/events are not included in a PDB file as far as I know and therefore can't be retrieved just using PdbReader.
So basically the question is: can I directly resolve a metadata token using PeReader or do I have to traverse a whole assembly till I find the member/type with the right token?
Also on a sidenote: is there any specific reason why you don't make the TokenValue property publicly accessible? To get this from CCI I know have to use reflection (which is quite slow) or a modified CCI version with the InternalsVisibleTo attribute set
(which I find imposes quite a burden on my project since I have to maintain my own CCI version just for accessing one member).
Thanks in advance and best regards,
Chris "Calavera" Schuster