2 using System.Threading;
3 using System.Runtime.InteropServices;
4 using System.Runtime.Remoting;
5 using System.Runtime.Remoting.Messaging;
6 using System.Runtime.Remoting.Proxies;
8 class MyProxy : RealProxy {
9 readonly MarshalByRefObject target;
11 public MyProxy (MarshalByRefObject target) : base (target.GetType())
16 public override IMessage Invoke (IMessage request) {
17 IMethodCallMessage call = (IMethodCallMessage)request;
18 Console.WriteLine ("Invoke " + call.MethodName);
20 Console.Write ("ARGS(");
21 for (int i = 0; i < call.ArgCount; i++) {
24 Console.Write (call.GetArgName (i) + " " +
27 Console.WriteLine (")");
28 Console.Write ("INARGS(");
29 for (int i = 0; i < call.InArgCount; i++) {
32 Console.Write (call.GetInArgName (i) + " " +
35 Console.WriteLine (")");
37 ((R1)target).test_field = 1;
39 IMethodReturnMessage res = RemotingServices.ExecuteMessage (target, call);
41 Console.Write ("RESARGS(");
42 for (int i = 0; i < res.ArgCount; i++) {
45 Console.Write (res.GetArgName (i) + " " +
48 Console.WriteLine (")");
50 Console.Write ("RESOUTARGS(");
51 for (int i = 0; i < res.OutArgCount; i++) {
54 Console.Write (res.GetOutArgName (i) + " " +
57 Console.WriteLine (")");
64 class R1 : MarshalByRefObject {
66 public int test_field = 5;
68 public virtual int ldfield_test () {
70 MyProxy real_proxy = new MyProxy (this);
71 R1 o = (R1)real_proxy.GetTransparentProxy ();
73 if (o.test_field != 1)
88 return myobj.ldfield_test ();