Add GC.KeepAlive to keep collectible ALC alive across usage. (dotnet/coreclr#22133)
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>
Thu, 24 Jan 2019 01:02:09 +0000 (17:02 -0800)
committerGitHub <noreply@github.com>
Thu, 24 Jan 2019 01:02:09 +0000 (17:02 -0800)
Commit migrated from https://github.com/dotnet/coreclr/commit/ad8975dd4b064381e1560536b77e5dcfb3195c84

src/coreclr/tests/src/Interop/ICustomMarshaler/ConflictingNames/RunInALC.cs

index 1d61f2d..fdae979 100644 (file)
@@ -46,6 +46,7 @@ public class RunInALC
         object instance = Activator.CreateInstance(inContextType);
         MethodInfo parseIntMethod = inContextType.GetMethod("ParseInt", BindingFlags.Instance | BindingFlags.Public);
         Assert.AreEqual(1234, (int)parseIntMethod.Invoke(instance, new object[]{"1234"}));
+        GC.KeepAlive(context);
     }
 }