[Mono-bugs] [Bug 38957][Maj] New - Reflection does not support case-insensitve binding
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Sun, 2 Mar 2003 01:11:46 -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 gert.driesen@pandora.be.
http://bugzilla.ximian.com/show_bug.cgi?id=38957
--- shadow/38957 Sun Mar 2 01:11:46 2003
+++ shadow/38957.tmp.26805 Sun Mar 2 01:11:46 2003
@@ -0,0 +1,86 @@
+Bug#: 38957
+Product: Mono/Runtime
+Version: unspecified
+OS:
+OS Details: Windows 2000
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: gert.driesen@pandora.be
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Reflection does not support case-insensitve binding
+
+Description of Problem:
+
+Type.GetProperty does not support case-insensitive lookup of property.
+
+
+Steps to reproduce the problem:
+1. Create a source file with the following code :
+
+namespace Log4net.Test {
+
+ using System;
+ using System.Reflection;
+
+ public class EntryPoint {
+ public static void Main(string[] args) {
+ Type targetType = typeof(PropertyTest);
+
+ PropertyInfo propInfo = targetType.GetProperty
+("name", BindingFlags.Instance | BindingFlags.Public |
+BindingFlags.IgnoreCase);
+
+ if (propInfo != null) {
+ Console.WriteLine("OK");
+ } else {
+ Console.WriteLine("BUG");
+ }
+
+ return;
+ }
+ }
+
+ public class PropertyTest {
+
+ public string Name {
+ get { return this._name; }
+ set { this._name = value; }
+ }
+
+
+ private string _name;
+ }
+}
+
+2. Compile this source file to an exe
+
+3. Execute the exe
+
+Actual Results:
+
+"BUG" will be written to the console. In the Main method, I'm actually
+looking up a property called "name" in the PropertyTest class with a case-
+insensitive search (using BindingFlags.IgnoreCase), but apparently Mono
+ignores this flag... Because it should have found the "Name" property.
+
+Expected Results:
+
+"OK" should've actually been written to the console, but it should've
+found the "Name" property by looking up a property called "name" wih case-
+insensitive binding.
+
+The BindingFlags.IgnoreCase member has the following meaning :
+
+"Specifies that the case of the member name should not be considered when
+binding."
+
+How often does this happen?
+
+Always