[Mono-bugs] [Bug 74576][Nor] New - ilasm doesnt support custom attributes for param/property/field/event..

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 12 Apr 2005 07:40:33 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by radical@gmail.com.

http://bugzilla.ximian.com/show_bug.cgi?id=74576

--- shadow/74576	2005-04-12 07:40:33.000000000 -0400
+++ shadow/74576.tmp.18356	2005-04-12 07:40:33.000000000 -0400
@@ -0,0 +1,87 @@
+Bug#: 74576
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: IL assembler
+AssignedTo: jackson@ximian.com                            
+ReportedBy: radical@gmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ilasm doesnt support custom attributes for param/property/field/event.. 
+
+The attached patch adds support for custom attributes for properties and
+method parameters, and changes the handling of custom attributes a little bit.
+
+In class/PEAPI/PEAPI.cs, the SortKey for MethodSemantics md table is
+changed to be "association" column (according to the spec).
+
+Also attached, test case:
+
+b2.il:
+It has attributes on
+
+Field - 1
+Param - 2 (1 explicit, but another defined right outside the class, so that
+also should get assigned to param)
+Property -1 
+Class (TypeDef) -1 
+
+current ilasm gives:
+
+ritvik@linux:~/src> monodis --customattr b2.exe 
+Custom Attributes Table (1..4)
+1: TypeDef: 2: instance void class AuthorAttribute::.ctor(string) ["Duthur
+Haily"]
+2: TypeDef: 2: instance void class AuthorAttribute::.ctor(string) ["Quthur
+Haily"]
+3: MethodDef: 3: instance void class AuthorAttribute::.ctor(string)
+["Cuthur Haily"]
+4: TypeDef: 5: instance void class
+[mscorlib]System.AttributeUsageAttribute::.ctor(valuetype
+[mscorlib]System.AttributeTargets) [16383 2 named args: ( 02 00 54 02 0D 41
+6C 6C 6F 77 4D 75 6C 74 69 70 6C 65 01 54 02 09 49 6E 68 65 72 69 74 65 64 01)]
+
+Same .il compiled on .net shows:
+
+$ monodis --customattr ~/b2w.exe 
+Custom Attributes Table (1..5)
+1: FieldDef: 2: instance void class AuthorAttribute::.ctor(string) ["Quthur
+Haily"]
+2: TypeDef: 2: instance void class
+[mscorlib]System.AttributeUsageAttribute::.ctor(valuetype
+[mscorlib]System.AttributeTargets) [16383 2 named args: ( 02 00 54 02 0D 41
+6C 6C 6F 77 4D 75 6C 74 69 70 6C 65 01 54 02 09 49 6E 68 65 72 69 74 65 64 01)]
+3: Param: 2: instance void class AuthorAttribute::.ctor(string) ["Cuthur
+Haily"]
+4: Param: 2: instance void class AuthorAttribute::.ctor(string) ["Duthur
+Haily"]
+5: Property: 2: instance void class AuthorAttribute::.ctor(string)
+["Property Cook"]
+
+Results match with the .il.. 
+
+After the patch, our ilasm also shows:
+
+$ monodis --customattr ~/b2.exe 
+Custom Attributes Table (1..5)
+1: FieldDef: 1: instance void class AuthorAttribute::.ctor(string) ["Quthur
+Haily"]
+2: Param: 1: instance void class AuthorAttribute::.ctor(string) ["Duthur
+Haily"]
+3: Param: 1: instance void class AuthorAttribute::.ctor(string) ["Cuthur
+Haily"]
+4: Property: 1: instance void class AuthorAttribute::.ctor(string)
+["Property Cook"]
+5: TypeDef: 5: instance void class
+[mscorlib]System.AttributeUsageAttribute::.ctor(valuetype
+[mscorlib]System.AttributeTargets) [16383 2 named args: ( 02 00 54 02 0D 41
+6C 6C 6F 77 4D 75 6C 74 69 70 6C 65 01 54 02 09 49 6E 68 65 72 69 74 65 64 01)]
+
+Which also matches with the .il