internal PropertyInfo(DebugType declaringType,string name, MethodInfo getMethod, MethodInfo setMethod): base(declaringType) { if (getMethod == null && setMethod == null) throw new ArgumentNullException("Both getter and setter can not be null."); this.name = name; this.getMethod = getMethod; this.setMethod = setMethod; }
private MethodInfo select_method(MethodInfo[] meths, DebugType[] args) { if (meths.Length > 0) return meths[0]; return null; }
public static Eval AsyncInvokeMethod(MethodInfo method, Value thisValue, Value[] args) { return new Eval( method.Process, "Function call: " + method.DeclaringType.FullName + "." + method.Name, delegate(ICorDebugEval corEval) { StartMethodInvoke(corEval, method, thisValue, args); } ); }
static void StartMethodInvoke(ICorDebugEval corEval, MethodInfo method, Value thisValue, Value[] args) { List<ICorDebugValue> corArgs = new List<ICorDebugValue>(); args = args ?? new Value[0]; try { if (thisValue != null) { if (!(thisValue.IsObject)) { throw new EvalSetupException("Can not evaluate on a value which is not an object"); } if (!method.DeclaringType.IsInstanceOfType(thisValue)) { throw new EvalSetupException("Can not evaluate because the object is not of proper type"); } corArgs.Add(thisValue.SoftReference); } foreach(Value arg in args) { corArgs.Add(arg.SoftReference); } } catch (CannotGetValueException e) { throw new EvalSetupException(e.Message); } ICorDebugType[] genericArgs = method.DeclaringType.GenericArgumentsAsCorDebugType; corEval.CastTo<ICorDebugEval2>().CallParameterizedFunction( method.CorFunction, (uint)genericArgs.Length, genericArgs, (uint)corArgs.Count, corArgs.ToArray() ); //corEval.CallFunction(method.CorFunction, (uint)corArgs.Count, corArgs.ToArray()); }
/// <summary> Synchronously calls a function and returns its return value </summary> public static Value InvokeMethod(MethodInfo method, Value thisValue, Value[] args) { return AsyncInvokeMethod(method, thisValue, args).EvaluateNow(); }