[Mono-bugs] [Bug 41278][Wis] New - Reflection (or custom attributes) problem

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Sat, 12 Apr 2003 12:47:49 -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 ric@users.sourceforge.net.

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

--- shadow/41278	Sat Apr 12 12:47:49 2003
+++ shadow/41278.tmp.28768	Sat Apr 12 12:47:49 2003
@@ -0,0 +1,70 @@
+Bug#: 41278
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ric@users.sourceforge.net               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Reflection (or custom attributes) problem
+
+The following program fails with this warning:
+
+** (./b1.exe:20878): WARNING **: Cannot load type 'Del'
+
+-----
+namespace bug
+{
+	using System;
+	using System.Reflection;
+	
+	public class A
+	{
+		delegate int Del (int a, int b);
+
+		[D (typeof (Del))]
+		static public int m (int j)
+		{
+			return j + 1;
+		}
+
+		public static int Main (string[] args)
+		{
+			Console.WriteLine ("{0}", m (22));
+
+			MethodInfo mi = typeof (A).GetMethod ("m");
+			Console.WriteLine ("{0}", mi);
+			foreach (DAttribute da in mi.GetCustomAttributes (false))
+			{
+				Console.WriteLine ("{0}", da);
+			}
+
+			return 0;
+		}
+	}
+	
+
+	[Serializable]
+	public class DAttribute : Attribute 
+	{
+		Type t;
+
+		public DAttribute (Type t)
+		{
+			this.t = t;
+		}
+	}
+
+}
+-----
+
+I think it should work. The file produced by mcs seems correct (with
+monodis), but the runtime can't find the delegate type.