From 060d976f4c872e0dc97c9ba9928da9ea05beefe9 Mon Sep 17 00:00:00 2001 From: Mark Probst Date: Wed, 21 Jan 2009 10:47:36 +0000 Subject: [PATCH] 2009-01-21 Mark Probst * metadata.c (mono_metadata_generic_param_equal): Owner as well as image must match. 2009-01-21 Mark Probst * generic-unloading.2.cs, generic-unloading-sub.2.cs: Test case for unloading images whose MonoGenericInst's are still in use. * Makefile.am: Test added. svn path=/trunk/mono/; revision=124022 --- mono/metadata/ChangeLog | 5 +++++ mono/metadata/metadata.c | 2 +- mono/tests/ChangeLog | 7 +++++++ mono/tests/Makefile.am | 4 +++- mono/tests/generic-unloading-sub.2.cs | 18 ++++++++++++++++++ mono/tests/generic-unloading.2.cs | 35 +++++++++++++++++++++++++++++++++++ 6 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 mono/tests/generic-unloading-sub.2.cs create mode 100644 mono/tests/generic-unloading.2.cs diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog index c0705c2a29b..c8ee85d7d31 100644 --- a/mono/metadata/ChangeLog +++ b/mono/metadata/ChangeLog @@ -1,5 +1,10 @@ 2009-01-21 Mark Probst + * metadata.c (mono_metadata_generic_param_equal): Owner as well as + image must match. + +2009-01-21 Mark Probst + * reflection.c (resolve_object): For fields, inflate the class and then get the field in the inflated class. diff --git a/mono/metadata/metadata.c b/mono/metadata/metadata.c index 16dd45a1d5e..d48d11f2044 100644 --- a/mono/metadata/metadata.c +++ b/mono/metadata/metadata.c @@ -3988,7 +3988,7 @@ mono_metadata_generic_param_equal (MonoGenericParam *p1, MonoGenericParam *p2, g if (p1->num != p2->num) return FALSE; - if (p1->owner == p2->owner) + if (p1->owner == p2->owner && p1->image == p2->image) return TRUE; /* diff --git a/mono/tests/ChangeLog b/mono/tests/ChangeLog index 0558c418b58..37965d8249f 100644 --- a/mono/tests/ChangeLog +++ b/mono/tests/ChangeLog @@ -1,3 +1,10 @@ +2009-01-21 Mark Probst + + * generic-unloading.2.cs, generic-unloading-sub.2.cs: Test case + for unloading images whose MonoGenericInst's are still in use. + + * Makefile.am: Test added. + 2009-01-20 Mark Probst * generic-stack-traces.2.cs: Generic sharing test for stack diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am index a3a92732059..be08d7177f4 100644 --- a/mono/tests/Makefile.am +++ b/mono/tests/Makefile.am @@ -336,7 +336,9 @@ BASE_TEST_CS_SRC= \ bug-461261.cs \ bug-400716.cs \ bug-462592.cs \ - bug-459094.cs + bug-459094.cs \ + generic-unloading.2.cs \ + generic-unloading-sub.2.cs if AMD64 TEST_CS_SRC = $(BASE_TEST_CS_SRC) async-exc-compilation.cs diff --git a/mono/tests/generic-unloading-sub.2.cs b/mono/tests/generic-unloading-sub.2.cs new file mode 100644 index 00000000000..453fd2b3a12 --- /dev/null +++ b/mono/tests/generic-unloading-sub.2.cs @@ -0,0 +1,18 @@ +using System; + +public class Gen {} + +public class main { + static object GenericFunc () { + return new Gen (); + } + + static void DoGenericStuff () { + GenericFunc (); + } + + public static int Main () { + DoGenericStuff (); + return 0; + } +} diff --git a/mono/tests/generic-unloading.2.cs b/mono/tests/generic-unloading.2.cs new file mode 100644 index 00000000000..a965b5d379c --- /dev/null +++ b/mono/tests/generic-unloading.2.cs @@ -0,0 +1,35 @@ +using System; + +public class Gen {} + +public class main { + static object GenericFunc () { + return new Gen (); + } + + static void DoGenericStuff () { + Console.WriteLine ("doing generic stuff"); + GenericFunc (); + } + + static void DoOtherGenericStuff () { + Console.WriteLine ("doing other generic stuff"); + GenericFunc (); + } + + public static void Main () + { + // Create an Application Domain: + System.AppDomain newDomain = System.AppDomain.CreateDomain("NewApplicationDomain"); + + // Load and execute an assembly: + newDomain.ExecuteAssembly(@"generic-unloading-sub.2.exe"); + + DoGenericStuff (); + + // Unload the application domain: + System.AppDomain.Unload(newDomain); + + DoOtherGenericStuff (); + } +} -- 2.11.4.GIT