Resolution scope of a nested TypeRef is another TypeRef (encloser). If a TypeRef has 
scope 0 (type defined somewhere in this assembly), 1 (in this module), ModuleRef (in 
another module of this assembly) or AssemblyRef (in another assembly), such TypeRef 
can't possibly refer to a nested type.

Thanks,
Serge


-----Original Message-----
From: Brent E. Rector [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 12, 2002 1:27 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Partition II Metadata Spec question


Oh another question in this nebulous area...

Let's assume I do run into a TYPEREF containing a nil resolution scope.
Say there isn't an EXPORTEDTYPE table in the prime module because this
*is* the prime and only module of the assembly and it doesn't contain
the table. Assume then, I decide to process the TYPEREF as it had
resolution scope of 1.

Is the idea that it references a type in this module mean "Look in this
module for a top-level type (TYPEDEF) whose TypeName and TypeNamespace
entries match the Name and Namespace entries of the TYPEREF record?" And
what about a nested type that matches? It seems like a resolution scope
of 0 and 1 can't specify a nested type (because I can't see how the
binding would work).

Can't we change the spec to disallow 0 and 1 altogether? Can't we fix
the MC++ compiler so it doesn't use them? <grin>

-- Brent Rector, .NET Wise Owl
Demeanor for .NET - an obfuscation utility
http://www.wiseowl.com/Products/Products.aspx



-----Original Message-----
From: Serge Lidin [mailto:[EMAIL PROTECTED]] 
Sent: Friday, April 12, 2002 9:00 AM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Partition II Metadata Spec question


Brent,

I suspect you are correct: strictly speaking, resolution scope of a
TypeRef should be 0 only if this type is listed in ExportedTypes of the
assembly. However, I suspect your assembly is single-module, so in this
case it can't have any ExportedTypes, and the resolution scope 0 must be
equivalent to 1 (this module). It's rather irregular, I agree, but then
this whole business with zero resolution scope ("somewhere around here,
go figure") is rather irregular.

Thanks,
Serge


-----Original Message-----
From: Brent E. Rector [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 12, 2002 8:13 AM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] Partition II Metadata Spec question


This isn't legal according to the Partition II Metadata spec and
according to Serge's most excellent book on IL. The problem isn't that
it is static member of the <Module> type. That is fine and I've been
handling them for months now.

The problem is that the TypeRef has a nil resolution scope and there is
no EXPORTEDTYPE table in the assembly and this is the prime (only)
module. A nil resolution scope implies the reference is to a type
defined in the same module of the assembly in which the reference
appears. (A resolution scope of '1' implies the reference is to a type
defined in a different module in the same assembly.) But the type does
not appear to be defined at all in the module. There is no EXPORTEDTYPES
table in this module so there appears to be no type to which a TYPEREF
could bind anyway, let alone to this type.

BTW I'm having to answer via the web pages again because the listserv
hasn't sent me any mail in two days. Soon I'll get a few hundred
messages if experience is a judge.

> -- Brent Rector, .NET Wise Owl
> Demeanor for .NET - an obfuscation utility 
> http://www.wiseowl.com/Products/Products.aspx

From:         Ted Neward <[EMAIL PROTECTED]>
Subject:      Re: Partition II Metadata Spec question
Content-Type: text/plain; charset="iso-8859-1"

It is perfectly legal (but I can't quote the part of the spec that
states it, although Lidin does) for a static method to be global--in
this case, it is actually scoped by the singleton "<Module>" type that
all modules implicitly have defined on their behalf by the runtime. So,
if I understand your question correctly, this isn't an invalid TypeRef
at all.

Ted Neward
{.NET || Java} Course Author & Instructor, DevelopMentor
(http://www.develop.com)
http://www.javageeks.com/tneward http://www.clrgeeks.com/tneward

----- Original Message -----
From: "Brent E. Rector" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 11, 2002 7:33 PM
Subject: [DOTNET] Partition II Metadata Spec question


> Using VS.NET, I created a MFC Application project. The *only* change I

> made was to switch on the /CLR command line option (which then forces 
> you to turn a few others off). This produces a single module .EXE 
> managed assembly containing with managed code and unmanaged data. 
> PEVerify /MD states that the metadata is valid. The application even 
> runs successfully. However, upon inspection, there appears to be an 
> invalid TypeRef. ILDASM /ADV shows the following:
>
> TypeRef #17 (01000011)
> -------------------------------------------------------
> Token:             0x01000011
> ResolutionScope:   0x00000000
> TypeRefName:       COccManager
>
> Note the nil resolution scope. However, there is no EXPORTEDTYPE table

> in this single-module assembly. The type CoccManager is also never 
> defined in the assembly. In fact, this type seems to only be
referenced
> once in the entire application. Here is the ILDASM for the reference.
It
> is a global function method parameter:
>
>         Method #154
>         -------------------------------------------------------
>                 MethodName: AfxEnableControlContainer (0600009A)
>                 Flags     : [Public] [Static] [ReuseSlot]
[PinvokeImpl]
> [HasSecurity]  (00006016)
>                 RVA       : 0x000075ee
>                 ImplFlags : [Native] [Unmanaged] [PreserveSig]
> (00000085)
>                 CallCnvntn: [DEFAULT]
>                 ReturnType: CMOD_OPT 
> System.Runtime.CompilerServices.CallConvCdecl Void
>                 1 Arguments
>                         Argument #1:  Ptr ValueClass COccManager
>                 CustomAttribute #1 (0c00007e)
>
-------------------------------------------------------
>                         CustomAttribute Type: 0a00000b
>                         CustomAttributeName: 
> System.Security.SuppressUnmanagedCodeSecurityAttribute :: instance
void
> .ctor()
>                         Length: 4
>                         Value : 01 00 00 00
> >                <
>                         ctor args: ()
>
> How the heck I am suppose to resolve this TypeRef? Thanks in advance
for
> any clues?
>
>
>

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to