[Mono-bugs] [Bug 56820][Nor] New - RealProxy with IRemotingTypeInfo causes mono crash

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 11 Apr 2004 21:08:28 -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=56820

--- shadow/56820	2004-04-11 21:08:28.000000000 -0400
+++ shadow/56820.tmp.8352	2004-04-11 21:08:28.000000000 -0400
@@ -0,0 +1,88 @@
+Bug#: 56820
+Product: Mono: Runtime
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vladimir@pobox.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: RealProxy with IRemotingTypeInfo causes mono crash
+
+The following program:
+
+--- bug31.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 abstract class Derived : TestClass {
+}
+
+public class TestProxy : RealProxy, IRemotingTypeInfo {
+  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;
+  }
+
+  string tn;
+  string IRemotingTypeInfo.TypeName {
+    get { return tn; }
+    set { tn = value; }
+  }
+
+  bool IRemotingTypeInfo.CanCastTo (System.Type target, object o) {
+    Console.WriteLine ("CanCastTo " + target);
+    return true;
+  }
+}
+
+public class Driver {
+  public delegate void FooDelegate();
+
+  public static void Main () {
+    TestProxy tp = new TestProxy (typeof(TestClass));
+    TestClass tc = (TestClass) tp.GetTransparentProxy();
+
+    Derived d = (Derived) tc;
+  }
+}
+--- end ---
+
+Causes:
+
+Unhandled Exception: System.NullReferenceException: A null value was found
+where an object instance was required.
+in (unmanaged) /usr/local/lib/libmono.so.0 [0x3ba048]
+in (unmanaged) /usr/local/lib/libmono.so.0(mono_g_hash_table_lookup+0x25)
+[0x3dca5d]
+in (unmanaged) /usr/local/lib/libmono.so.0(mono_remote_class+0x31) [0x38bbd5]
+in (unmanaged) /usr/local/lib/libmono.so.0 [0x396635]
+in <0x0015e> System.Runtime.Remoting.Proxies.RealProxy:GetTransparentProxy ()
+in <0x00042> Driver:Main ()
+
+Works as expected under .NET 1.1 (prints "CanCastTo Derived").