From a1c035e00509d3a9f1086e5eadbcafc5d0d1503c Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Fri, 14 Jun 2013 12:39:30 +0200 Subject: [PATCH] fix Debugger: Move mouse over instance field (+property?) -> does not show value; expression is missing 'this' --- .../NRefactory/ExpressionEvaluationVisitor.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs b/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs index 15da9f5167..98f30ff88b 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs @@ -115,9 +115,12 @@ namespace Debugger.AddIn throw new GetValueException("Member not found!"); Value target = null; if (!importedMember.IsStatic) { - if (result.TargetResult == null) + if (importedMember.DeclaringType.Equals(context.MethodInfo.DeclaringType) && result.TargetResult == null) + target = context.GetThisValue(true); + else if (result.TargetResult == null) throw new GetValueException("An object reference is required for the non-static field, method, or property '" + importedMember.FullName + "'"); - target = Convert(result.TargetResult); + else + target = Convert(result.TargetResult); } if (!allowMethodInvoke && (importedMember is IMethod)) throw new InvalidOperationException("Method invocation not allowed in the current context!");