[Mono-bugs] [Bug 52182][Wis] New - GetFields returns inherited static fields

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 15 Dec 2003 09:31:09 -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 malekith@pld-linux.org.

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

--- shadow/52182	2003-12-15 09:31:08.000000000 -0500
+++ shadow/52182.tmp.24868	2003-12-15 09:31:09.000000000 -0500
@@ -0,0 +1,50 @@
+Bug#: 52182
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: PLD Linux
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: malekith@pld-linux.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: GetFields returns inherited static fields
+
+Description of Problem:
+The GetFields() method of System.Type returns static members of both
+current type and its super types. For example it returns Null twice for
+StreamReader.
+
+Steps to reproduce the problem:
+1. compile and run the following program:
+using System;
+using System.IO;
+using System.Reflection;
+ 
+class T {
+  public static void Main () {
+    FieldInfo[] fs = typeof(StreamReader).GetFields();
+        foreach (FieldInfo f in fs) {
+          Console.WriteLine("{0} : {1}", f.Name, f.FieldType.FullName);
+        }
+  }
+}
+
+Actual Results:
+Null : System.IO.StreamReader
+Null : System.IO.TextReader
+
+Expected Results:
+Null : System.IO.StreamReader
+
+Additional Information:
+http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemTypeClassGetFieldsTopic1.asp
+See the table after "The following table shows what members of a base class
+are returned by the Get methods when reflecting on a type."
+
+I filled bug against runtime, since it's implemented in C (icall.c).