Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Kumpera <kumpera@gmail.com>2013-06-15 03:04:55 +0400
committerRodrigo Kumpera <kumpera@gmail.com>2013-06-15 03:04:55 +0400
commitd6c5db881b26fd0f8ef64a65eba00e72fda552a2 (patch)
treec50ab4d7c7cb85dcdfa3d4cf21ac1aeb159b269b
parenteff2914eaf20737b6043b26d6e30c8eeeb37adad (diff)
Mark MonoCMethod (runtime subclass of ConstructorInfo) as serializable. Fixes #12611mono-3.0.12
-rw-r--r--mcs/class/corlib/System.Reflection/MonoMethod.cs1
-rw-r--r--mcs/class/corlib/Test/System/AppDomainTest.cs73
2 files changed, 74 insertions, 0 deletions
diff --git a/mcs/class/corlib/System.Reflection/MonoMethod.cs b/mcs/class/corlib/System.Reflection/MonoMethod.cs
index f46c01a226d..b6a119e3208 100644
--- a/mcs/class/corlib/System.Reflection/MonoMethod.cs
+++ b/mcs/class/corlib/System.Reflection/MonoMethod.cs
@@ -464,6 +464,7 @@ namespace System.Reflection {
#endif
}
+ [Serializable()]
[StructLayout (LayoutKind.Sequential)]
internal class MonoCMethod : ConstructorInfo, ISerializable
{
diff --git a/mcs/class/corlib/Test/System/AppDomainTest.cs b/mcs/class/corlib/Test/System/AppDomainTest.cs
index 54ba7cef2a8..1d88666538f 100644
--- a/mcs/class/corlib/Test/System/AppDomainTest.cs
+++ b/mcs/class/corlib/Test/System/AppDomainTest.cs
@@ -3261,6 +3261,74 @@ namespace MonoTests.System
}
#endif
+ public class StuffToPick
+ {
+ public StuffToPick () {}
+ public void Method () {}
+ public int Property { get; set; }
+ public event Action Event;
+ public int Field;
+ public void GenericMethod<T> () {}
+ }
+
+ public class StuffToPick<T>
+ {
+ public StuffToPick () {}
+ public void Method () {}
+ public int Property { get; set; }
+ public event Action Event;
+ public int Field;
+ public void GenericMethod<T> () {}
+ }
+
+ static void TestSerialization (CrossDomainTester tester, object o)
+ {
+ Assert.AreSame (o, tester.ReturnArg0 (o), "serializing_type_" + o.GetType ());
+ }
+
+ [Test] //BXC #12611
+ public void ReflectionObjectsAreSerializableTest ()
+ {
+ ad = CreateTestDomain (tempDir, true);
+ CrossDomainTester tester = CreateCrossDomainTester (ad);
+
+ TestSerialization (tester, typeof (StuffToPick));
+ TestSerialization (tester, typeof (StuffToPick).GetConstructor(new Type [0]));
+ TestSerialization (tester, typeof (StuffToPick).GetMethod ("Method"));
+ TestSerialization (tester, typeof (StuffToPick).GetProperty ("Property"));
+ TestSerialization (tester, typeof (StuffToPick).GetEvent ("Event"));
+ TestSerialization (tester, typeof (StuffToPick).GetField ("Field"));
+ TestSerialization (tester, typeof (StuffToPick).GetMethod ("GenericMethod"));
+
+ TestSerialization (tester, typeof (StuffToPick<>));
+ TestSerialization (tester, typeof (StuffToPick<>).GetConstructor(new Type [0]));
+ TestSerialization (tester, typeof (StuffToPick<>).GetMethod ("Method"));
+ TestSerialization (tester, typeof (StuffToPick<>).GetProperty ("Property"));
+ TestSerialization (tester, typeof (StuffToPick<>).GetEvent ("Event"));
+ TestSerialization (tester, typeof (StuffToPick<>).GetField ("Field"));
+ TestSerialization (tester, typeof (StuffToPick<>).GetMethod ("GenericMethod"));
+
+ TestSerialization (tester, typeof (StuffToPick<int>));
+ TestSerialization (tester, typeof (StuffToPick<int>).GetConstructor(new Type [0]));
+ TestSerialization (tester, typeof (StuffToPick<int>).GetMethod ("Method"));
+ TestSerialization (tester, typeof (StuffToPick<int>).GetProperty ("Property"));
+ TestSerialization (tester, typeof (StuffToPick<int>).GetEvent ("Event"));
+ TestSerialization (tester, typeof (StuffToPick<int>).GetField ("Field"));
+ TestSerialization (tester, typeof (StuffToPick<int>).GetMethod ("GenericMethod"));
+ }
+
+ [Test] //BXC #12611
+ [Category ("NotWorking")] // Serialization can't handle generic methods
+ public void GenericReflectionObjectsAreSerializableTest ()
+ {
+ ad = CreateTestDomain (tempDir, true);
+ CrossDomainTester tester = CreateCrossDomainTester (ad);
+
+ TestSerialization (tester, typeof (StuffToPick).GetMethod ("GenericMethod").MakeGenericMethod (typeof (int)));
+ TestSerialization (tester, typeof (StuffToPick<>).GetMethod ("GenericMethod").MakeGenericMethod (typeof (int)));
+ TestSerialization (tester, typeof (StuffToPick<int>).GetMethod ("GenericMethod").MakeGenericMethod (typeof (int)));
+ }
+
private static AppDomain CreateTestDomain (string baseDirectory, bool assemblyResolver)
{
AppDomainSetup setup = new AppDomainSetup ();
@@ -3395,6 +3463,11 @@ namespace MonoTests.System
return true;
}
}
+
+ public object ReturnArg0 (object obj)
+ {
+ return obj;
+ }
}
[Serializable ()]