diff options
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/Reflection/MightKeepExtraThings.cs')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/Reflection/MightKeepExtraThings.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/Reflection/MightKeepExtraThings.cs b/test/Mono.Linker.Tests.Cases/Reflection/MightKeepExtraThings.cs new file mode 100644 index 000000000..b5b6a1c52 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Reflection/MightKeepExtraThings.cs @@ -0,0 +1,34 @@ +using System; +using System.Reflection; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.Reflection { + public class MightKeepExtraThings { + public static void Main () + { + var typeA = typeof (A); + var typeB = typeof (B); + Console.WriteLine (typeB); // Use typeB so the C# compiler keeps it in the IL code. + var method = typeA.GetMethod ("Foo", BindingFlags.Public); + method.Invoke (null, new object[] { }); + } + + [Kept] + public class A { + [Kept] + public int Foo () + { + return 42; + } + } + + [Kept] + public class B { + [Kept] + public int Foo () + { + return 43; + } + } + } +} |