Exemplo n.º 1
0
		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;
		}
Exemplo n.º 2
0
 private MethodInfo select_method(MethodInfo[] meths, DebugType[] args)
 {
     if (meths.Length > 0)
         return meths[0];
     return null;
 }
Exemplo n.º 3
0
		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); }
			);
		}
Exemplo n.º 4
0
		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());
		}
Exemplo n.º 5
0
		/// <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();
		}