[Mono-bugs] [Bug 40322][Wis] New - BindingFlags.IgnoreCase does not work in Type.GetMethod

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Wed, 26 Mar 2003 11:38:20 -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 joergr@voelcker.com.

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

--- shadow/40322	Wed Mar 26 11:38:19 2003
+++ shadow/40322.tmp.24980	Wed Mar 26 11:38:20 2003
@@ -0,0 +1,90 @@
+Bug#: 40322
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Debian Woody
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: JoergR@voelcker.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: BindingFlags.IgnoreCase does not work in Type.GetMethod
+
+Description of Problem:
+If Type.GetMethod is called with flag BindingFlags.IgnoreCase the method
+name is still compared case sensitive.
+
+Steps to reproduce the problem:
+Run the following test case under Mono and MS.NET:
+
+using System;
+using System.Reflection;
+
+
+namespace MonoTest
+{
+    public class TestClass
+    {
+        public TestClass()
+        {}
+            
+        public void TestFunction()
+        {}
+    }
+    
+    public class MainClass
+    {
+        public static void Main()
+        {
+            try
+            {
+                Type        tpClass = typeof(TestClass);
+                MethodInfo  m;
+                
+                string   [] functions =
+                    {"TestFunction", "testfunction"};
+                
+                foreach ( string function in functions )
+                {
+                    m = tpClass.GetMethod(function, 
+                                            BindingFlags.IgnoreCase | 
+                                            BindingFlags.Instance	|
+                                            BindingFlags.InvokeMethod	|
+                                            BindingFlags.Public
+                                            );
+                    
+                    if ( m == null )
+                        Console.WriteLine("Function {0} not found.", function);
+                    else
+                        Console.WriteLine("Function {0} found.", function);
+                }
+            }
+            catch( Exception ex)
+            {
+                Console.WriteLine(ex.Message);
+                Console.WriteLine(ex.StackTrace);
+            }    
+        }
+    }
+}
+
+Actual Results:
+Function TestFunction found.
+Function testfunction not found.
+
+
+Expected Results:
+Function TestFunction found.
+Function testfunction found.
+
+How often does this happen? 
+Always.
+
+Additional Information:
+Found in Mono 0.23