From 423002bc95ccb592b5a0ba5aeee9a96b1cb4bf53 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 13 Jul 2022 10:59:54 +0200 Subject: [PATCH] [tests] Be explicit about parameters when looking for the Class.FindType method. (#15431) This makes sure that adding FindType overloads won't break the tests. --- tests/api-shared/ObjCRuntime/Registrar.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/api-shared/ObjCRuntime/Registrar.cs b/tests/api-shared/ObjCRuntime/Registrar.cs index 370a574f30..3e8834baf6 100644 --- a/tests/api-shared/ObjCRuntime/Registrar.cs +++ b/tests/api-shared/ObjCRuntime/Registrar.cs @@ -29,7 +29,12 @@ namespace XamarinTests.ObjCRuntime { public static Registrars CurrentRegistrar { get { - var find_type = typeof (Class).GetMethod ("FindType", BindingFlags.Static | BindingFlags.NonPublic); +#if NET + var types = new Type [] { typeof (NativeHandle), typeof (bool).MakeByRefType () }; +#else + var types = new Type [] { typeof (IntPtr), typeof (bool).MakeByRefType () }; +#endif + var find_type = typeof (Class).GetMethod ("FindType", BindingFlags.Static | BindingFlags.NonPublic, null, types, null); var type_to_find = typeof (RegistrationTestClass); var type = (Type) find_type.Invoke (null, new object [] { Class.GetHandle (type_to_find), false }); var is_static = type_to_find == type;