[Mono-bugs] [Bug 36208][Nor] New - Namespace of nested types is incorrect

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
1 Jan 2003 02:07:00 -0000


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 jonpryor@vt.edu.

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

--- shadow/36208	Tue Dec 31 21:07:00 2002
+++ shadow/36208.tmp.14949	Tue Dec 31 21:07:00 2002
@@ -0,0 +1,61 @@
+Bug#: 36208
+Product: Mono/Class Libraries
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: jonpryor@vt.edu               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Namespace of nested types is incorrect
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+The namespace available through System.Type.Namespace is incorrect for
+nested types -- it is the empty string "" instead of the namespace of its
+parent type.
+
+Consider the following program:
+
+        using System;
+
+        namespace Test {
+          public class Outer {
+            public class Inner {
+            }
+          }
+        }
+
+        public class R {
+          public static void Main () {
+            Namespace (typeof (Test.Outer));
+            Namespace (typeof (Test.Outer.Inner));
+          }
+
+          public static void Namespace (Type t) {
+            Console.WriteLine ("Namespace of {0}={1}", t.FullName,
+              t.Namespace);
+          }
+        }
+
+When executed under Mono, I get the output:
+
+        Namespace of Test.Outer=Test
+        Namespace of Test.Outer+Inner=
+
+When executed under .NET, I get:
+
+        Namespace of Test.Outer=Test
+        Namespace of Test.Outer+Inner=Test
+
+Notice that under .NET, the namespace of the inner type is the same as that
+of its containing type.