Hi all,

I've implemented a custom metadata loader that uses Unmanaged Metadata API
from managed
code. The motivation was to avoid reflection overhead and to get more
control over the treatment of
unresolved references in metadata.

My loader works just fine except for one issue I've recently encountered.
The problem is that I create wrapper classes around
raw metadata tokens (these classes are similar to what is found in
Reflection : Type, MethodInfo, FieldInfo etc), and I need to map
metadata tokens to my wrappers, in particular, I need to map method tokens.
Currently for mapping method tokens I rely on the fact
that the method of the same type form a contiguous range of tokens. Here is
the quote from "Partition II Metadata" docs describing TypeDef metadata
table: "...MethodList (index into Method table; it marks the first of a
continguous run of Methods owned by this Type)..." This enables for very
efficient mapping, as I only need to subtract the first method token of the
type and then use the difference as an index into the array. This fact is
true for all system assemblies and for all assemblies I've ever seen till
today, when
I've got a commercial assembly for which this property of continuity of
method tokens DOES NOT HOLD. The assembly has exactly one type with exactly
one method in it which violate this property.

The question is: can I rely on this property of method tokens, or is it a
bad idea? And what do the 'outstanding' method token
mean (in my example the 'outstanding' token corresponded to normal private
method)?


Thanks in advance for any information.

Regards,
Dmitry Shaporenkov

===================================
This list is hosted by DevelopMentor╝  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to