[Mono-dev] Why is UnmanagedType_80 required?

Raja R Harinath rharinath at novell.com
Wed Aug 31 05:47:21 EDT 2005


Kornél Pál <kornelpal at hotmail.com> writes:

>>> According to my experiences using no ArraySubType has the same result as
>>> ArraySubType = (UnmanagedType)80 on mcs and csc.exe as well.
>>> Could someone tell me please why UnmanagedType_80 is required?
>>There was a bug in ancient versions of mcs wrt. constant folding in
>>attribute arguments.  We needed to declare an explicit enumeration
>>constant, and use that instead.
> I think in this case we could simply eliminate UnmanagedType_80 in favour of
> using no ArraySubType as I think we support those ancient versions no more.
>>The actual reason for using '(UnmanagetType) 80': probably corcompare.
> Using no ArraySubType and using ArraySubType = (UnmanagedType)80 results in
> the same binary file.

I don't think so.  It will be emitted in the MarshalAsAttribute metadata.

> And we have no enumeration member (except BOOTSTRAP_WITH_OLDLIB) but I
> think corcompare uses the full version of assembly. So it cannot map
> value 80 to any enumeration member.
> So the question is that do we need (UnmanagedType)80 in our standard build
> procedure or in any tricky situations? Because if we only need it in
> ancient, non-supported situations I think we should remove it.

We use it so as to match the custom attribute metadata in Microsoft's

- Hari

More information about the Mono-devel-list mailing list