From 4a2640af1afcfeadf8e41f4b70e9e9ae5d4aa496 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Fri, 14 Jun 2013 13:43:07 +0200 Subject: [PATCH] allow method execution in Console Pad, Conditional Breakpoints, Watch Pad and sub-tree nodes --- .../NRefactory/ExpressionEvaluationVisitor.cs | 2 ++ .../Debugger.AddIn/Service/WindowsDebugger.cs | 2 +- src/AddIns/Debugger/Debugger.Core/Value.cs | 12 ++++++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs b/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs index 98f30ff88b..37083cacf1 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs @@ -326,6 +326,8 @@ namespace Debugger.AddIn Value Visit(ConversionResolveResult result) { + if (result.IsError) + throw new GetValueException("Cannot convert from '{0}' to '{1}'.", new CSharpAmbience().ConvertType(result.Input.Type), new CSharpAmbience().ConvertType(result.Type)); var val = Convert(result.Input); if (result.Conversion.IsBoxingConversion) return val; diff --git a/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs b/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs index 6364a902e6..8433a12fec 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs @@ -584,7 +584,7 @@ namespace ICSharpCode.SharpDevelop.Services var location = CurrentStackFrame.NextStatement; var fileName = new FileName(location.Filename); var rr = SD.ParserService.ResolveSnippet(fileName, new TextLocation(location.StartLine, location.StartColumn), new ParseableFileContentFinder().Create(fileName), code, null, System.Threading.CancellationToken.None); - return new ExpressionEvaluationVisitor(CurrentStackFrame, EvalThread, CurrentStackFrame.AppDomain.Compilation).Convert(rr); + return new ExpressionEvaluationVisitor(CurrentStackFrame, EvalThread, CurrentStackFrame.AppDomain.Compilation, true).Convert(rr); } public void JumpToCurrentLine() diff --git a/src/AddIns/Debugger/Debugger.Core/Value.cs b/src/AddIns/Debugger/Debugger.Core/Value.cs index 875cf40b91..4517c5c9c2 100644 --- a/src/AddIns/Debugger/Debugger.Core/Value.cs +++ b/src/AddIns/Debugger/Debugger.Core/Value.cs @@ -61,7 +61,8 @@ namespace Debugger [Debugger.Tests.Ignore] public ICorDebugReferenceValue CorReferenceValue { get { - if (IsNull) throw new GetValueException("Value is null"); + if (IsNull) + throw new GetValueException("Value is null"); if (!(this.CorValue is ICorDebugReferenceValue)) throw new DebuggerException("Reference value expected"); @@ -73,7 +74,8 @@ namespace Debugger [Debugger.Tests.Ignore] public ICorDebugGenericValue CorGenericValue { get { - if (IsNull) throw new GetValueException("Value is null"); + if (IsNull) + throw new GetValueException("Value is null"); ICorDebugValue corValue = this.CorValue; // Dereference and unbox if necessary @@ -90,7 +92,8 @@ namespace Debugger [Debugger.Tests.Ignore] public ICorDebugArrayValue CorArrayValue { get { - if (IsNull) throw new GetValueException("Value is null"); + if (IsNull) + throw new GetValueException("Value is null"); if (this.Type.Kind != TypeKind.Array) throw new DebuggerException("Value is not an array"); @@ -101,7 +104,8 @@ namespace Debugger [Debugger.Tests.Ignore] public ICorDebugObjectValue CorObjectValue { get { - if (IsNull) throw new GetValueException("Value is null"); + if (IsNull) + throw new GetValueException("Value is null"); ICorDebugValue corValue = this.CorValue; // Dereference and unbox if necessary