public IEnumerable <MethodBase> GetMethods() { Dictionary <string, Type> types = _assembly.GetTypes().ToDictionary(t => t.FullName); foreach (var methodItem in _methodList.Methods) { if (!types.TryGetValue(methodItem.FullTypeName, out Type type)) { continue; } var candidates = EtwSignatureMapper.GetMethodCandidates(type, methodItem.MethodName); if (candidates.Length == 0) { Console.WriteLine($"Method {type.FullName}.{methodItem.MethodName} could not be found."); continue; } var method = SelectOverload(candidates, methodItem.Signature); if (method == null) { Console.WriteLine($"Method {type.FullName}.{methodItem.MethodName}({methodItem.Signature}) could not be found."); continue; } if (UnorderedMethodProvider.IsIgnored(method)) { continue; } yield return(method); } }
public static JitCompilerHost Create(string[] args) { if (args.Length == 0) { throw new ArgumentOutOfRangeException("Expected arg contents: assemblyFile and optional method name or method list"); } string assemblyFile = args[0]; string assemblyPath = Path.GetDirectoryName(assemblyFile); var assembly = Assembly.LoadFile(assemblyFile); IMethodProvider methodProvider; if (args.Length == 2) { if (args[1].StartsWith("/m:")) { methodProvider = new SingleMethodProvider(assembly, args[1].Substring(3).Trim('"')); } else if (args[1].StartsWith("/c:")) { methodProvider = new TypeMethodProvider(assembly, args[1].Substring(3).Trim('"')); } else if (args[1].StartsWith("/l:")) { methodProvider = new OrderedMethodProvider(assembly, args[1].Substring(3).Trim('"')); } else { throw new ArgumentOutOfRangeException("Expected method name or method list"); } } else { methodProvider = new UnorderedMethodProvider(assembly); } return(new JitCompilerHost(assemblyPath, methodProvider)); }