[Mono-bugs] [Bug 47785][Wis] New - delegates not going through RealProxy/Transparent Proxies correctly

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 21 Aug 2003 04:08:52 -0400 (EDT)


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 vladimir@pobox.com.

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

--- shadow/47785	2003-08-21 04:08:51.000000000 -0400
+++ shadow/47785.tmp.4652	2003-08-21 04:08:51.000000000 -0400
@@ -0,0 +1,70 @@
+Bug#: 47785
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vladimir@pobox.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: delegates not going through RealProxy/Transparent Proxies correctly
+
+Given the following code:
+
+---- t11.cs ----
+using System;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Proxies;
+
+public abstract class TestClass : MarshalByRefObject {
+  public abstract void Foo ();
+}
+
+public class TestProxy : RealProxy {
+  public TestProxy (Type baseType) : base (baseType)
+  {
+  }
+
+  public override IMessage Invoke (IMessage msg) {
+    Console.WriteLine ("Invoke: ");
+    Console.WriteLine (msg.GetType());
+
+    IMethodCallMessage mcall = msg as IMethodCallMessage;
+
+    IMethodReturnMessage ret = new ReturnMessage (null, null, 0,
+						  mcall.LogicalCallContext,
+						  mcall);
+    Console.WriteLine ("Finish");
+    return ret;
+  }
+}
+
+public class Driver {
+  public delegate void FooDelegate();
+
+  public static void Main () {
+    TestProxy tp = new TestProxy (typeof(TestClass));
+    TestClass tc = (TestClass) tp.GetTransparentProxy();
+
+    FooDelegate fd = new FooDelegate (tc.Foo);
+  }
+}
+---- end ----
+
+mono 0.26 (whatever CVS is around aug 20) crashes with a failed assertion:
+
+** ERROR **: file object.c: line 670 (mono_object_get_virtual_method):
+assertion failed: (res)
+
+This is caused because the method in question is declared as abstract; if
+the method were given a concrete implementation in TestClass, then the test
+does not crash, but produces incorrect results: the proxy is entirely
+bypassed with the delegate.