[Mono-bugs] [Bug 26204][Nor] Changed - ILGenerator.Emit (OpCodes.Call) must check ReflectedType

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 4 Jan 2004 14:00:25 -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 bmaurer@users.sf.net.

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

--- shadow/26204	2002-08-20 18:05:21.000000000 -0400
+++ shadow/26204.tmp.29711	2004-01-04 14:00:25.000000000 -0500
@@ -168,6 +168,52 @@
 
 
 
 
 ------- Additional Comments From martin@gnome.org  2002-08-20 18:05 -------
 Ok, so what's left to do is to make ILGenerator(OpCodes.Call, method) check the MemberInfo's ReflectedType.
+
+------- Additional Comments From bmaurer@users.sf.net  2004-01-04 14:00 -------
+I don't think MCS is ready for this yet. Take the example:
+
+server.cs:
+using System;
+
+public class BaseThingy {
+	public virtual void DoIt () {
+		Console.WriteLine ("BaseThingy.DoIt");
+	}
+}
+
+public class Thingy : BaseThingy {
+	private new void DoIt () {
+		Console.Write ("Thingy.DoIt");
+	}
+}
+
+client.cs:
+
+using System;
+
+class Foo : Thingy {
+	static void Main ()
+	{
+		new Foo ().DoIt ();
+	}
+	
+	public override void DoIt () {
+		System.Console.WriteLine ("Foo is about to do it");
+		base.DoIt ();
+	}
+}
+
+If we make this change, base.DoIt will try to call Thingy.DoIt, which
+is a private method.
+
+On MS this would throw an exception.
+
+I am guessing the rule CSC uses is something more like:
+
+Use the first base type that does not hide the method.
+
+Interestingly, if in a second version that private method is added,
+the client will break if it is not recompiled.