Add GC.KeepAlive to keep collectible ALC alive across usage. (#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)
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);
     }
 }