[Mono-devel-list] Beta2 Previewlet.

Michal Moskal malekith at pld-linux.org
Tue May 25 15:10:48 EDT 2004


On Tue, May 25, 2004 at 02:40:15PM -0400, Miguel de Icaza wrote:
> Hello,
>      
> >   b) System.Assembly.GetCustomAttributes() returns now just one copy of
> >      given attribute A if AttributeUsage(AllowMultiple = true) wasn't
> >      specified on A. I'm not sure if it's a bug, though MS behavior is
> >      different here.
> 
> Do you have a test case you could share with us?

Well, now I have :-) I attach an exe file and corresponding IL.
Unfortunately mono ilasm doesn't seem to handle custom attributes on
assemblies (try assembling and dissassembling attached file). I used
pnet ilasm.

The testcase output 1, while with 0.91 it outputs 2.

-- 
: Michal Moskal :: http://www.kernel.pl/~malekith :: GCS !tv h e>+++ b++
: ::: Logic is a nice contrast to the Real World. :: UL++++$ C++ E--- a?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.exe
Type: application/octet-stream
Size: 2560 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040525/2a6ea202/attachment.exe 
-------------- next part --------------
// Input: foo.exe
// Image type: EXE
// Native code present: No
// 32-bit only: No
// Length of IL data: 2560

// VS_VERSION_INFO:
//    dwStrucVersion            : 1.0
//    dwFileVersion             : 0.0.0.0
//    dwProductVersion          : 0.0.0.0
//    dwFileFlagsMask           : 0x0000003F
//    dwFileFlags               : 0x00000000
//    dwFileOS                  : 0x00000004
//    dwFileType                : 0x00000002
//    dwFileSubtype             : 0x00000000
//    dwFileDate                : 0x0000000000000000
//    Translation               : 0x04B0007F
//    ProductVersion            : " "
//    CompanyName               : " "
//    ProductName               : " "
//    LegalCopyright            : " "
//    InternalName              : "foo"
//    FileDescription           : " "
//    Comments                  : " "
//    FileVersion               : " "
//    OriginalFilename          : "foo.exe"
//    LegalTrademarks           : " "

.assembly extern mscorlib
{
	.ver 1:0:5000:0
	.publickeytoken = (B7 7A 5C 56 19 34 E0 89)   // .z\V.4..
}
.assembly foo
{
	.hash algorithm 0x00008004
	.ver 0:0:0:0
	.custom instance void SomeAttribute::.ctor() = (01 00 00 00)   // ....
	.custom instance void SomeAttribute::.ctor() = (01 00 00 00)   // ....
	// Some()
}
.module foo.exe
// MVID: {B11F46A5-A6A0-4289-83CB-6C5CA749C40A}
.class private auto ansi beforefieldinit SomeAttribute extends [mscorlib]System.Attribute
{
	.method public hidebysig specialname rtspecialname instance void .ctor() cil managed 
	{
		// Start of method header: 20ec
		.maxstack  8
	?L20ed:
		ldarg.0
		call       instance void [mscorlib]System.Attribute::.ctor()
		ret
	}
}
.class private auto ansi beforefieldinit X extends [mscorlib]System.Object
{
	.method public hidebysig specialname rtspecialname instance void .ctor() cil managed 
	{
		// Start of method header: 20f4
		.maxstack  8
	?L20f5:
		ldarg.0
		call       instance void [mscorlib]System.Object::.ctor()
		ret
	}
	.method public static hidebysig void Main() cil managed 
	{
		// Start of method header: 20fc
		.entrypoint
		.maxstack  7
		.locals    init (class [mscorlib]System.Reflection.Assembly)
	?L2108:
		ldtoken    class X
		call       class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
		callvirt   instance class [mscorlib]System.Reflection.Assembly [mscorlib]System.Type::get_Assembly()
		stloc.0
		ldloc.0
		ldc.i4.1
		callvirt   instance class System.Object[] [mscorlib]System.Reflection.Assembly::GetCustomAttributes(bool)
		ldlen
		conv.i4
		call       void [mscorlib]System.Console::WriteLine(int32)
		ret
	}
}


More information about the Mono-devel-list mailing list