Skip to content

Commit

Permalink
Add a sample test for dotnet/linker#1617 - unknown binding flags (dot…
Browse files Browse the repository at this point in the history
  • Loading branch information
vitek-karas authored Nov 11, 2020
1 parent 8060c78 commit 7ca2419
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public static void Main ()
TestName ();
TestNamePrivate ();
TestNameAndExplicitBindingFlags ();
// TestNameAndUnknownBindingFlags (BindingFlags.Public);
TestNameAndType ();
TestNameBindingFlagsAndParameterModifier ();
TestNameBindingFlagsCallingConventionParameterModifier ();
Expand Down Expand Up @@ -61,6 +62,16 @@ static void TestNameAndExplicitBindingFlags ()
method.Invoke (null, new object[] { });
}

// https://github.com/mono/linker/issues/1617
//[Kept]
//[RecognizedReflectionAccessPattern]
//static void TestNameAndUnknownBindingFlags (BindingFlags bindingFlags)
//{
// // Since the binding flags are not known linker should mark all methods on the type
// var method = typeof (TestNameAndUnknownBindingClass).GetMethod ("OnlyCalledViaReflection", bindingFlags);
// method.Invoke (null, new object[] { });
//}

[Kept]
[RecognizedReflectionAccessPattern (
typeof (Type), nameof (Type.GetMethod), new Type[] { typeof (string), typeof (Type[]) },
Expand Down Expand Up @@ -283,6 +294,34 @@ public static int OnlyCalledViaReflection (int foo, int bar, int baz)
}
}

//[Kept]
//private class TestNameAndUnknownBindingClass
//{
// [Kept]
// private static int OnlyCalledViaReflection ()
// {
// return 42;
// }

// [Kept]
// private int OnlyCalledViaReflection (int foo)
// {
// return 43;
// }

// [Kept]
// public int OnlyCalledViaReflection (int foo, int bar)
// {
// return 44;
// }

// [Kept]
// public static int OnlyCalledViaReflection (int foo, int bar, int baz)
// {
// return 45;
// }
//}

[Kept]
private class TestNameAndTypeClass
{
Expand Down

0 comments on commit 7ca2419

Please sign in to comment.