[Mono-bugs] [Bug 60439][Nor] New - mcs does not emit assembly qualified type name for types used in attributes

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 18 Jun 2004 16:00:10 -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 gert.driesen@pandora.be.

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

--- shadow/60439	2004-06-18 16:00:10.000000000 -0400
+++ shadow/60439.tmp.27261	2004-06-18 16:00:10.000000000 -0400
@@ -0,0 +1,67 @@
+Bug#: 60439
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gert.driesen@pandora.be               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs does not emit assembly qualified type name for types used in attributes
+
+mcs does not seem to emit the right assembly qualifed name of a type 
+that's used in an assembly.  Apparently the publickeytoken is always null.
+
+compile the following code (with /r:System.Drawing.dll) :
+
+using System;
+using System.ComponentModel;
+using System.Drawing.Design;
+
+public class EntryPoint
+{
+        public static void Main ()
+        {
+                Type type = typeof(TestClass);
+                object[] attributes = type.GetCustomAttributes (false);
+                Console.WriteLine (attributes.Length);
+        }
+}
+
+[Editor ("Doesn't Matter", typeof(UITypeEditor))]
+public class TestClass {
+}
+
+when you run the built exe, you'll get the following exception :
+
+** (test.exe:3972): WARNING **: Cannot load 
+type 'System.Drawing.Design.UITypeEd
+itor, System.Drawing, Version=1.0.5000.0, Culture=neutral, 
+PublicKeyToken=null'
+
+Unhandled Exception: System.NullReferenceException: Object reference not 
+set to
+an instance of an object
+in <0x00016> System.ComponentModel.EditorAttribute:.ctor 
+(string,System.Type)
+in (unmanaged) (wrapper managed-to-native) 
+System.MonoCustomAttrs:GetCustomAttri
+butes (System.Reflection.ICustomAttributeProvider)
+in <0x00004> (wrapper managed-to-native) 
+System.MonoCustomAttrs:GetCustomAttribu
+tes (System.Reflection.ICustomAttributeProvider)
+in <0x0004a> System.MonoCustomAttrs:GetCustomAttributes 
+(System.Reflection.ICust
+omAttributeProvider,bool)
+in <0x00010> System.MonoType:GetCustomAttributes (bool)
+in <0x00023> EntryPoint:Main ()
+
+As you can see, Mono is trying to load the type with a null 
+publickeytoken, as this is what's emitted by mcs.