[Mono-bugs] [Bug 76083][Nor] Changed - AmbiguousMatchException exception with an overriden method

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Oct 20 09:00:55 EDT 2005


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 vargaz at gmail.com.

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

--- shadow/76083	2005-10-19 17:05:27.000000000 -0400
+++ shadow/76083.tmp.14728	2005-10-20 09:00:55.000000000 -0400
@@ -52,6 +52,46 @@
 
 
 ------- Additional Comments From jackson at ximian.com  2005-10-19 17:05 -------
 I believe this is a reflection bug as GetMethod shouldn't be throwing
 an AmbiguousMatchException here for an overidding method. Sadly my
 attempts at making a small test case have failed.
+
+------- Additional Comments From vargaz at gmail.com  2005-10-20 09:00 -------
+The Add method in TabPageCollection does not override the Add method
+in ControlCollection, since it is not virtual. mcs prints a warning for
+this, but that warning is turned off when compiling MWF.
+
+Still, there is a reflection bug here:
+
+Here is a test case:
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+using System;
+using System.Reflection;
+
+public class Control {
+}
+
+public class Label : Control {
+}
+
+public class ControlCollection {
+	public virtual void Add (Control value) {
+	}
+}
+
+public class TabPageControlCollection : ControlCollection {
+	public void Add (Control value)
+	{
+		base.Add (value);
+	}
+}
+
+public class Tests {
+
+	public static void Main (String[] args) {
+		MethodInfo m1 = typeof (TabPageControlCollection).GetMethod("Add",
+new Type[] { typeof (Label) } );
+		Console.WriteLine (m1.DeclaringType);
+	}
+}
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


More information about the mono-bugs mailing list