-using System;\r
+using System;
using System.Threading;
using System.Runtime.InteropServices;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Proxies;
using System.Runtime.Remoting.Channels;
using System.Runtime.Serialization;
-\r
-namespace RemotingTest\r
-{\r
- class MyProxy : RealProxy \r
+
+namespace RemotingTest
+{
+ class MyProxy : RealProxy
{
readonly MarshalByRefObject target;
- public MyProxy (MarshalByRefObject target) : base (target.GetType()) \r
+ public MyProxy (MarshalByRefObject target) : base (target.GetType())
{
this.target = target;
}
- public override IMessage Invoke (IMessage request) \r
+ public override IMessage Invoke (IMessage request)
{
IMethodCallMessage call = (IMethodCallMessage)request;
Console.WriteLine ("Invoke " + call.MethodName);
Console.Write ("ARGS(");
- for (int i = 0; i < call.ArgCount; i++) \r
+ for (int i = 0; i < call.ArgCount; i++)
{
if (i != 0)
Console.Write (", ");
}
Console.WriteLine (")");
Console.Write ("INARGS(");
- for (int i = 0; i < call.InArgCount; i++) \r
+ for (int i = 0; i < call.InArgCount; i++)
{
if (i != 0)
Console.Write (", ");
IMethodReturnMessage res = RemotingServices.ExecuteMessage (target, call);
Console.Write ("RESARGS(");
- for (int i = 0; i < res.ArgCount; i++) \r
+ for (int i = 0; i < res.ArgCount; i++)
{
if (i != 0)
Console.Write (", ");
Console.WriteLine (")");
Console.Write ("RESOUTARGS(");
- for (int i = 0; i < res.OutArgCount; i++) \r
+ for (int i = 0; i < res.OutArgCount; i++)
{
if (i != 0)
Console.Write (", ");
}
}
- class R2 \r
+ class R2
{
string sTest;
- public R2() \r
+ public R2()
{
sTest = "R2";
}
- public void Print() \r
+ public void Print()
{
Console.WriteLine(sTest);
}
}
[Serializable]
- class R2_MBV\r
+ class R2_MBV
{
string sTest;
- public R2_MBV() \r
+ public R2_MBV()
{
sTest = "R2";
}
- public string Data\r
- {\r
- get \r
+ public string Data
+ {
+ get
{
return sTest;
- }\r
+ }
}
}
-\r
- class R1 : MarshalByRefObject \r
+
+ interface GenericIFace {
+ T Foo <T> ();
+ }
+
+ class R1 : MarshalByRefObject, GenericIFace
{
- public R2 TestMBV() {\r
- return new R2();\r
- }\r
- }\r
-\r
- class Class1\r
- {\r
- static int Main(string[] args)\r
- {\r
- Console.WriteLine("test " + AppDomain.CurrentDomain.FriendlyName);\r
- AppDomain app2 = AppDomain.CreateDomain("2");\r
-\r
+ public R2 TestMBV() {
+ return new R2();
+ }
+
+ public T Foo <T> () {
+ return default (T);
+ }
+ }
+
+ class Class1
+ {
+ static int Main(string[] args)
+ {
+ Console.WriteLine("test " + AppDomain.CurrentDomain.FriendlyName);
+ AppDomain app2 = AppDomain.CreateDomain("2");
+
if (!RemotingServices.IsTransparentProxy(app2))
return 1;
- ObjectHandle o = AppDomain.CurrentDomain.CreateInstance(typeof(R1).Assembly.FullName, typeof(R1).FullName);\r
- R1 myobj = (R1) o.Unwrap();\r
+ ObjectHandle o = AppDomain.CurrentDomain.CreateInstance(typeof(R1).Assembly.FullName, typeof(R1).FullName);
+ R1 myobj = (R1) o.Unwrap();
// should not be a proxy in our domain..
if (RemotingServices.IsTransparentProxy(myobj))
return 2;
}
- o = app2.CreateInstance(typeof(R1).Assembly.FullName, typeof(R1).FullName);\r
-\r
- Console.WriteLine("type: " + o.GetType().ToString());\r
+ o = app2.CreateInstance(typeof(R1).Assembly.FullName, typeof(R1).FullName);
- myobj = (R1) o.Unwrap();\r
+ Console.WriteLine("type: " + o.GetType().ToString());
+
+ myobj = (R1) o.Unwrap();
if (!RemotingServices.IsTransparentProxy(myobj))
return 3;
-\r
- Console.WriteLine("unwrapped type: " + myobj.GetType().ToString());\r
+
+ Console.WriteLine("unwrapped type: " + myobj.GetType().ToString());
R2 r2 = null;
bool bSerExc = false;
if (!bSerExc)
return 4;
- \r
+
+ // Test generic virtual interface methods on proxies
+
+ o = app2.CreateInstance(typeof(R1).Assembly.FullName, typeof(R1).FullName);
+ myobj = (R1) o.Unwrap();
+
+ GenericIFace iface = (GenericIFace)myobj;
+ if (iface.Foo <int> () != 0)
+ return 5;
+ if (iface.Foo <string> () != null)
+ return 6;
+
Console.WriteLine("test-ok");
return 0;
- }\r
- }\r
-}\r
+ }
+ }
+}