private void ValidateInputParameters() { // todo. currently we don't support sync points located outside of the main RunKernel method // todo. same for thread parameters (various *Idx) located outside of the main RunKernel method var forbiddenInAlgo = new HashSet <MethodBase>(); forbiddenInAlgo.AddElements(typeof(ISyncApi).GetMethods().Cast <MethodBase>()); forbiddenInAlgo.AddElements(typeof(IGridApi).GetProperties().Where(p => p.Name.EndsWith("Idx")).SelectMany(p => p.GetAccessors(true)).Cast <MethodBase>()); foreach (var m in forbiddenInAlgo.ToArray()) { var t_kernel = _m_kernel.DeclaringType; var t_iface = m.DeclaringType; var imap = t_kernel.MapInterfacesToImpls(t_iface); forbiddenInAlgo.Add(imap[m]); } var algoMethods = _m_kernel.DeclaringType.GetMethods(BF.AllInstance | BF.DeclOnly) .Where(m => m.Name != "RunKernel") .Where(m => !forbiddenInAlgo.Contains(m)).ToReadOnly(); algoMethods.ForEach(am => am.Decompile().Body.AssertThat(b => b.Family().None(c => { var app = c as Apply; var lam = app == null ? null : app.Callee as Lambda; var m = lam == null ? null : lam.Method as MethodInfo; var h = m.Hierarchy().Cast <MethodBase>(); return(h != null && Set.Intersect(h, forbiddenInAlgo).IsNotEmpty()); }))); }