[Mono-bugs] [Bug 37596][Nor] New - mono: ldvirtfn loads the wrong method.
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Tue, 4 Feb 2003 13:30: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 miguel@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=37596
--- shadow/37596 Tue Feb 4 13:30:08 2003
+++ shadow/37596.tmp.17005 Tue Feb 4 13:30:09 2003
@@ -0,0 +1,62 @@
+Bug#: 37596
+Product: Mono/Runtime
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: miguel@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: mono: ldvirtfn loads the wrong method.
+
+The following example will create a delegate from an interface method. The
+IL generated is correct, and will contain the right token for the method
+being loaded, but the method loaded will be the first one in the interface
+table, instead of right one.
+
+The program works with mint though.
+
+using System;
+using System.Threading;
+
+class X {
+ static void Main ()
+ {
+ I i = new Y ();
+
+ Thread t = new Thread (new ThreadStart (i.B));
+ t.Start ();
+ t.Join ();
+ }
+}
+
+interface I {
+ void A ();
+ void B ();
+}
+
+class Y : I {
+ public void A ()
+ {
+ throw new Exception ("Should never be called");
+ }
+
+ public void B ()
+ {
+ Console.WriteLine ("Test passes");
+ }
+}
+
+Currently, the program when ran with Mono throws the exception in Y.A
+
+Changing the delegate invocation to use the class instead of the interface
+works.
+
+Miguel.