private static Func <IDisposable> GetPsesAlcReflectionContextEntryFunc() { MethodInfo enterReflectionContextMethod = AsmLoadContextType.GetMethod("EnterContextualReflection", BindingFlags.Public | BindingFlags.Instance); return(Expression.Lambda <Func <IDisposable> >( Expression.Convert( Expression.Call(Expression.Constant(PsesAssemblyLoadContext), enterReflectionContextMethod), typeof(IDisposable))).Compile()); }
private static Func <string, Assembly> GetPsesAlcLoadAsmFunc() { MethodInfo loadFromAssemblyPathMethod = AsmLoadContextType.GetMethod("LoadFromAssemblyPath", BindingFlags.Public | BindingFlags.Instance); return((Func <string, Assembly>)loadFromAssemblyPathMethod.CreateDelegate(typeof(Func <string, Assembly>), PsesAssemblyLoadContext)); }