Browse Source

fix SD-1888 - NullReferenceException in ExpressionNode.EvaluateExpression

pull/18/head
Siegfried Pammer 14 years ago
parent
commit
860a1432ae
  1. 4
      src/AddIns/Debugger/Debugger.AddIn/Pads/Commands/WatchPadCommands.cs
  2. 13
      src/AddIns/Debugger/Debugger.AddIn/Pads/Controls/TreeNodeWrapper.cs
  3. 3
      src/AddIns/Debugger/Debugger.AddIn/TreeModel/ExpressionNode.cs

4
src/AddIns/Debugger/Debugger.AddIn/Pads/Commands/WatchPadCommands.cs

@ -3,9 +3,11 @@ @@ -3,9 +3,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Debugger.AddIn.Pads;
using Debugger.AddIn.Pads.Controls;
using Debugger.AddIn.TreeModel;
using ICSharpCode.Core;
using ICSharpCode.Core.Presentation;
@ -43,7 +45,7 @@ namespace Debugger.AddIn @@ -43,7 +45,7 @@ namespace Debugger.AddIn
language == "VB" || language == "VBNet" ? SupportedLanguage.VBNet : SupportedLanguage.CSharp).ToSharpTreeNode();
var list = pad.WatchList;
if(!list.WatchItems.Contains(text))
if(!list.WatchItems.Any(n => text.Node.FullName == ((TreeNodeWrapper)n).Node.FullName))
list.WatchItems.Add(text);
}

13
src/AddIns/Debugger/Debugger.AddIn/Pads/Controls/TreeNodeWrapper.cs

@ -25,17 +25,6 @@ namespace Debugger.AddIn.Pads.Controls @@ -25,17 +25,6 @@ namespace Debugger.AddIn.Pads.Controls
public TreeNode Node { get; private set; }
public override bool Equals(object obj)
{
var w = obj as TreeNodeWrapper;
return w != null && Node.Equals(w.Node);
}
public override int GetHashCode()
{
return Node.GetHashCode();
}
public override object Text {
get { return Node.Name; }
}
@ -82,7 +71,7 @@ namespace Debugger.AddIn.Pads.Controls @@ -82,7 +71,7 @@ namespace Debugger.AddIn.Pads.Controls
language == "VB" || language == "VBNet" ? SupportedLanguage.VBNet : SupportedLanguage.CSharp);
var node = text.ToSharpTreeNode();
if (!WatchPad.Instance.WatchList.WatchItems.Contains(node))
if (!WatchPad.Instance.WatchList.WatchItems.Any(n => text.FullName == ((TreeNodeWrapper)n).Node.FullName))
WatchPad.Instance.WatchList.WatchItems.Add(node);
WatchPad.Instance.RefreshPad();

3
src/AddIns/Debugger/Debugger.AddIn/TreeModel/ExpressionNode.cs

@ -77,8 +77,6 @@ namespace Debugger.AddIn.TreeModel @@ -77,8 +77,6 @@ namespace Debugger.AddIn.TreeModel
public override string FullName {
get {
if (!evaluated) EvaluateExpression();
return this.expression.PrettyPrint() ?? Name.Trim();
}
}
@ -158,6 +156,7 @@ namespace Debugger.AddIn.TreeModel @@ -158,6 +156,7 @@ namespace Debugger.AddIn.TreeModel
Value val;
try {
var process = WindowsDebugger.DebuggedProcess;
if (process == null) return;
StackFrame frame = process.GetCurrentExecutingFrame();
if (frame == null) return;
var debugger = (WindowsDebugger)DebuggerService.CurrentDebugger;

Loading…
Cancel
Save