[Mono-bugs] [Bug 51468][Min] New - Can't use Type.GetType() with libraries with an "_" in their name

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 28 Nov 2003 07:04:15 -0500 (EST)


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 jeanmarc.andre@cpe.fr.

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

--- shadow/51468	2003-11-28 07:04:15.000000000 -0500
+++ shadow/51468.tmp.8023	2003-11-28 07:04:15.000000000 -0500
@@ -0,0 +1,74 @@
+Bug#: 51468
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: Fedora Core 1
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jeanmarc.andre@cpe.fr               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Can't use Type.GetType() with libraries with an "_" in their name
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+Type.GetType() returns a null value if the specified type is defined in a
+library with a "_" in its name.
+
+
+Steps to reproduce the problem:
+Build Foo.cs as a library with an "_" (ex: Foo_test.dll)
+Then use this library to build the executable
+
+// Library (Foo.cs)
+
+namespace Foo {
+    public class Bar {
+		private int num;
+    }
+}
+
+---------------------------------------
+// Main class (Main.cs)
+
+using System;
+using System.Reflection;
+using Foo;
+
+public class MainClass {
+	public static void Main() {
+		Bar b = new Bar();
+		string assemblyName = b.GetType().Assembly.FullName;
+		string typeName = b.GetType().FullName;
+
+		Type t = Type.GetType(String.Format("{0}, {1}", typeName, assemblyName));
+		Console.WriteLine(t.ToString());
+
+	}
+}
+
+
+Actual Results:
+A null reference exception because "t" is null.
+
+Unhandled Exception: System.NullReferenceException: A null value was found
+where an object instance was required
+in <0x000b6> .MainClass:Main ()
+
+
+Expected Results:
+Foo.Bar
+
+How often does this happen? 
+every time
+
+Additional Information:
+Will add an archive containing the test