diff options
author | Lluis Sanchez <lluis@novell.com> | 2010-03-02 16:42:43 +0300 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2010-03-02 16:42:43 +0300 |
commit | 70e9bed70de158d2af137590248e0a42ec6304b7 (patch) | |
tree | 4d9e250eb0a3c50f4ea36c79b24d1da3d9b96906 /Mono.Debugging.Soft/SoftEvaluationContext.cs | |
parent | 7584506a716275175485816b9e9c0b59734bb4ec (diff) |
* Mono.Debugging.Soft/SoftDebuggerAdaptor.cs: Renamed variable to
improve readability.
* Mono.Debugging.Soft/SoftEvaluationContext.cs: When calling a method,
make sure value type arguments are properly boxed when required.
svn path=/trunk/monodevelop/; revision=152833
Diffstat (limited to 'Mono.Debugging.Soft/SoftEvaluationContext.cs')
-rw-r--r-- | Mono.Debugging.Soft/SoftEvaluationContext.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Mono.Debugging.Soft/SoftEvaluationContext.cs b/Mono.Debugging.Soft/SoftEvaluationContext.cs index 2ddb02a..8690c45 100644 --- a/Mono.Debugging.Soft/SoftEvaluationContext.cs +++ b/Mono.Debugging.Soft/SoftEvaluationContext.cs @@ -86,6 +86,30 @@ namespace Mono.Debugging.Soft public Value RuntimeInvoke (MethodMirror method, object target, Value[] values) { + if (values != null) { + // Some arguments may need to be boxed + ParameterInfoMirror[] mparams = method.GetParameters (); + if (mparams.Length != values.Length) + throw new EvaluatorException ("Invalid number of arguments when calling: " + method.Name); + + for (int n=0; n<mparams.Length; n++) { + TypeMirror tm = mparams [n].ParameterType; + if (tm.IsValueType || tm.IsPrimitive) + continue; + object type = Adapter.GetValueType (this, values [n]); + TypeMirror argTypeMirror = type as TypeMirror; + Type argType = type as Type; + if ((argTypeMirror != null && (argTypeMirror.IsValueType || argTypeMirror.IsPrimitive)) || (argType != null && (argType.IsValueType || argType.IsPrimitive))) { + // A value type being assigned to a parameter which is not a value type. The value has to be boxed. + try { + values [n] = Thread.Domain.CreateBoxedValue (values [n]); + } catch (NotSupportedException) { + // This runtime doesn't support creating boxed values + break; + } + } + } + } MethodCall mc = new MethodCall (this, method, target, values); Adapter.AsyncExecute (mc, Options.EvaluationTimeout); return mc.ReturnValue; |