diff options
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/Reflection/FieldUsedViaReflection.cs')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/Reflection/FieldUsedViaReflection.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/Reflection/FieldUsedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/FieldUsedViaReflection.cs index 7d7fc22d3..94535adb1 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/FieldUsedViaReflection.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/FieldUsedViaReflection.cs @@ -15,6 +15,7 @@ namespace Mono.Linker.Tests.Cases.Reflection TestNameBindingFlags (); TestNameWrongBindingFlags (); TestNameUnknownBindingFlags (BindingFlags.Public); + TestNameUnknownBindingFlagsAndName (BindingFlags.Public, "DoesntMatter"); TestNullName (); TestEmptyName (); TestNonExistingName (); @@ -67,6 +68,13 @@ namespace Mono.Linker.Tests.Cases.Reflection } [Kept] + static void TestNameUnknownBindingFlagsAndName (BindingFlags bindingFlags, string name) + { + // Since the binding flags and name are not known linker should mark all fields on the type + var field = typeof (UnknownBindingFlagsAndName).GetField (name, bindingFlags); + } + + [Kept] static void TestNullName () { var field = typeof (FieldUsedViaReflection).GetField (null); @@ -187,6 +195,17 @@ namespace Mono.Linker.Tests.Cases.Reflection } [Kept] + private class UnknownBindingFlagsAndName + { + [Kept] + public static int field; + [Kept] + public int nonStatic; + [Kept] + private static int privatefield; + } + + [Kept] private class IfClass { [Kept] |