Merge pull request #5382 from kumpera/pedump_fix
[mono.git] / mono / tests / generic-marshalbyref.2.cs
index c9db8d046c4c96ed20262b8dd4e92c09618c8a06..cba58400b0106571866ef25daf4aa37c2e92fe90 100644 (file)
@@ -7,6 +7,13 @@ static class Program
            DocumentForm<object> browseForm = new DocumentForm<object> ();
            if (browseForm.DoInit () != 248)
                    return 1;
+
+        var domain = AppDomain.CreateDomain ("foo");
+        var engine = Engine.CreateRemote (domain);
+
+        if (engine.GetDomainName<object> () != "foo")
+                       return 2;
+
            return 0;
     }
 }
@@ -48,3 +55,27 @@ public class Grid2<TEntity> : MarshalByRefObject where TEntity : EntityBase, new
                num = i + 1;
        }
 }
+
+public class Engine : MarshalByRefObject
+{
+    public Engine ()
+    {
+    }
+
+    public string GetDomainName<T> ()
+    {
+        return AppDomain.CurrentDomain.FriendlyName;
+    }
+
+    public string GetDomainName ()
+    {
+        return AppDomain.CurrentDomain.FriendlyName;
+    }
+
+    public static Engine CreateRemote (AppDomain domain)
+    {
+        return (Engine) domain.CreateInstanceAndUnwrap (
+            typeof (Engine).Assembly.FullName,
+            typeof (Engine).FullName);
+    }
+}