From c4d38b54ad6116f0e410805f3d064878834d33ca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 16 Jul 2017 01:49:00 +0200 Subject: [PATCH] [corlib] Preserve List.ConvertAll in TypeTest (#5215) TypeTest.GetGenericMethodDefinitionOverInflatedMethodOnGTD accesses List.ConvertAll() via reflection but doesn't use the method elsewhere so the linker can remove it. Added some usage to avoid that. Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=56242 --- mcs/class/corlib/Test/System/TypeTest.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mcs/class/corlib/Test/System/TypeTest.cs b/mcs/class/corlib/Test/System/TypeTest.cs index 9cc8ca79a41..d03e4c21f2a 100644 --- a/mcs/class/corlib/Test/System/TypeTest.cs +++ b/mcs/class/corlib/Test/System/TypeTest.cs @@ -2261,11 +2261,14 @@ namespace MonoTests.System [Test] public void GetGenericMethodDefinitionOverInflatedMethodOnGTD () { + var s = new List () { 1, 2, 3 }.ConvertAll ( i => i.ToString () ); + Assert.AreEqual (3, s.Count); var l = typeof (List<>); var m = l.GetMethod ("ConvertAll"); var infl = m.MakeGenericMethod (typeof (int)); var res = m.GetGenericMethodDefinition (); Assert.AreEqual (m, res, "#1"); + Assert.AreEqual (1, infl.GetGenericArguments().Length, "#2"); } [Test] -- 2.11.4.GIT