Skip to content

Instantly share code, notes, and snippets.

@rolfbjarne
Last active March 15, 2019 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolfbjarne/1ca6318058ac8507742e7b8f2df5296f to your computer and use it in GitHub Desktop.
Save rolfbjarne/1ca6318058ac8507742e7b8f2df5296f to your computer and use it in GitHub Desktop.
internal RuntimeMethodInfo[] GetMethodsByName (string name, BindingFlags bindingAttr, MemberListType listType, RuntimeType reflectedType)
{
global::Xamarin.WriteLine ("RuntimeType.GetMethodsByName (): 1");
// global::Xamarin.WriteLine ($"RuntimeType.GetMethodsByName ({name}, {bindingAttr}, {listType}, {reflectedType}): 1");
var refh = new RuntimeTypeHandle (reflectedType);
global::Xamarin.WriteLine ("RuntimeType.GetMethodsByName (): 2");
using (var namePtr = new Mono.SafeStringMarshal (name))
using (var h = new Mono.SafeGPtrArrayHandle (GetMethodsByName_native (namePtr.Value, bindingAttr, listType))) {
global::Xamarin.WriteLine ("RuntimeType.GetMethodsByName (): 4");
var n = h.Length;
global::Xamarin.WriteLine ("RuntimeType.GetMethodsByName (): 5");
var a = new RuntimeMethodInfo [n];
global::Xamarin.WriteLine ("RuntimeType.GetMethodsByName (): 6");
for (int i = 0; i < n; i++) {
global::System.Console.WriteLine ("RuntimeType.GetMethodsByName (): 7");
var mh = new RuntimeMethodHandle (h[i]);
global::Xamarin.WriteLine ("RuntimeType.GetMethodsByName (): 8");
a[i] = (RuntimeMethodInfo) MethodBase.GetMethodFromHandleNoGenericCheck (mh, refh);
global::System.Console.WriteLine ("RuntimeType.GetMethodsByName (): 9");
}
global::Xamarin.WriteLine ("RuntimeType.GetMethodsByName (): 10");
return a;
}
}
internal static MethodBase GetMethodFromHandleNoGenericCheck (RuntimeMethodHandle handle, RuntimeTypeHandle reflectedType)
{
global::Xamarin.WriteLine ($"MethodBase.GetMethodFromHandleNoGenericCheck (,) 1");
global::Xamarin.WriteLine ($"MethodBase.GetMethodFromHandleNoGenericCheck ({handle}, {reflectedType})");
var rv = GetMethodFromHandleInternalType_native (handle.Value, reflectedType.Value, false);
global::Xamarin.WriteLine ($"MethodBase.GetMethodFromHandleNoGenericCheck (,) 1 done");
global::Xamarin.Sleep (10000);
return rv;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment