[Mono-bugs] [Bug 67108][Blo] New - Enum values not properly encoded in custom attributes

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 29 Sep 2004 11:07:58 -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 lluis@ximian.com.

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

--- shadow/67108	2004-09-29 11:07:58.000000000 -0400
+++ shadow/67108.tmp.9774	2004-09-29 11:07:58.000000000 -0400
@@ -0,0 +1,65 @@
+Bug#: 67108
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: lluis@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Enum values not properly encoded in custom attributes
+
+Looks like enum values not properly encoded in custom attributes.
+
+Steps to reproduce the problem:
+Run this test case:
+
+using System;
+
+public class ConverterService
+{	
+	public static void Main ()
+	{
+		object[] ats =
+typeof(ConverterService).GetMethod("Login").GetCustomAttributes
+(typeof(MyAttribute), true);
+		MyAttribute at = (MyAttribute) ats[0];
+		Console.WriteLine ("Val: " + at.Val);
+	}
+
+	[MyAttribute(Val=AnEnum.a)]
+	public void Login(string a)	{}
+}
+
+public class MyAttribute: Attribute
+{
+	public AnEnum Val; 
+}
+
+public enum AnEnum
+{
+	a,b,c
+}
+
+Actual Results:
+Val: 142126704
+
+Expected Results:
+Val: a
+
+Additional Information:
+
+This is with cvs HEAD.
+It works with gmcs. Martin merged last time on Sep 23rd.
+
+If I change the type of the Val field to object, mcs crashes with the
+following message:
+** ERROR **: unhandled type in custom attr
+aborting...