Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Stedfast <jeff@xamarin.com>2012-05-05 00:16:04 +0400
committerJeffrey Stedfast <jeff@xamarin.com>2012-05-05 00:18:15 +0400
commit4fc8d08b4e2e5b780a3a2a38f533591c8ca68e0d (patch)
treeb5aa9ad2e428a16f7580df53d26a7b3f5b22e8bb
parentf1085beb5095b5ebb0c800820a2955e15c3a8105 (diff)
[Debugger] Cannot directly invoke instance methods from the Immediate window
Fixes bug #4882.
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerAdaptor.cs39
1 files changed, 21 insertions, 18 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerAdaptor.cs b/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerAdaptor.cs
index 7b9a40e151..859b6d2a61 100644
--- a/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerAdaptor.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerAdaptor.cs
@@ -966,11 +966,9 @@ namespace Mono.Debugging.Soft
public override bool HasMethod (EvaluationContext gctx, object targetType, string methodName, object[] argTypes, BindingFlags flags)
{
SoftEvaluationContext ctx = (SoftEvaluationContext) gctx;
-
- TypeMirror[] types;
- if (argTypes == null)
- types = new TypeMirror [0];
- else {
+ TypeMirror[] types = null;
+
+ if (argTypes != null) {
types = new TypeMirror [argTypes.Length];
for (int n=0; n<argTypes.Length; n++) {
if (argTypes [n] is TypeMirror)
@@ -1194,14 +1192,10 @@ namespace Mono.Debugging.Soft
public static MethodMirror OverloadResolve (SoftEvaluationContext ctx, string methodName, TypeMirror type, TypeMirror[] argtypes, bool allowInstance, bool allowStatic, bool throwIfNotFound)
{
List<MethodMirror> candidates = new List<MethodMirror> ();
+ var cache = ctx.Session.OverloadResolveCache;
TypeMirror currentType = type;
while (currentType != null) {
- //
- // Use a simple cached stored in SoftDebuggerSession, since
- // GetMethodsByNameFlags might not do any caching.
- //
- var cache = ctx.Session.OverloadResolveCache;
MethodMirror[] methods = null;
if (ctx.CaseSensitive) {
@@ -1226,10 +1220,13 @@ namespace Mono.Debugging.Soft
foreach (MethodMirror met in methods) {
if (met.Name == methodName || (!ctx.CaseSensitive && met.Name.Equals (methodName, StringComparison.CurrentCultureIgnoreCase))) {
ParameterInfoMirror[] pars = met.GetParameters ();
- if (pars.Length == argtypes.Length && ((met.IsStatic && allowStatic) || (!met.IsStatic && allowInstance)))
+ if (argtypes == null || pars.Length == argtypes.Length && ((met.IsStatic && allowStatic) || (!met.IsStatic && allowInstance)))
candidates.Add (met);
}
}
+
+ if (argtypes == null && candidates.Count > 0)
+ break; // when argtypes is null, we are just looking for *any* match (not a specific match)
if (methodName == ".ctor")
break; // Can't create objects using constructor from base classes
@@ -1272,9 +1269,22 @@ namespace Mono.Debugging.Soft
static MethodMirror OverloadResolve (SoftEvaluationContext ctx, string typeName, string methodName, TypeMirror[] argtypes, List<MethodMirror> candidates, bool throwIfNotFound)
{
+ if (candidates.Count == 0) {
+ if (throwIfNotFound)
+ throw new EvaluatorException ("Method `{0}' not found in type `{1}'.", methodName, typeName);
+ else
+ return null;
+ }
+
+ if (argtypes == null) {
+ // This is just a probe to see if the type contains *any* methods of the given name
+ return candidates[0];
+ }
+
if (candidates.Count == 1) {
string error;
int matchCount;
+
if (IsApplicable (ctx, candidates[0], argtypes, out error, out matchCount))
return candidates [0];
@@ -1283,13 +1293,6 @@ namespace Mono.Debugging.Soft
else
return null;
}
-
- if (candidates.Count == 0) {
- if (throwIfNotFound)
- throw new EvaluatorException ("Method `{0}' not found in type `{1}'.", methodName, typeName);
- else
- return null;
- }
// Ok, now we need to find an exact match.
MethodMirror match = null;