diff --git a/src/AddIns/Debugger/Debugger.AddIn/Pads/LocalVarPad.cs b/src/AddIns/Debugger/Debugger.AddIn/Pads/LocalVarPad.cs index 77ed8ad58d..3b870d7418 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Pads/LocalVarPad.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Pads/LocalVarPad.cs @@ -66,9 +66,9 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads LoggingService.Info("Local Variables refresh"); try { StackFrame frame = debuggedProcess.GetCurrentExecutingFrame(); + localVarList.WatchItems.Clear(); if (frame == null) return; - localVarList.WatchItems.Clear(); debuggedProcess.EnqueueForEach( Dispatcher.CurrentDispatcher, new StackFrameNode(frame).ChildNodes.ToList(), diff --git a/src/AddIns/Debugger/Debugger.Core/Process.cs b/src/AddIns/Debugger/Debugger.Core/Process.cs index d322a3e566..3ca68f7a06 100644 --- a/src/AddIns/Debugger/Debugger.Core/Process.cs +++ b/src/AddIns/Debugger/Debugger.Core/Process.cs @@ -711,6 +711,9 @@ namespace Debugger public StackFrame GetCurrentExecutingFrame() { + if (IsRunning || SelectedThread == null) + return null; + if (IsSelectedFrameForced()) { return SelectedStackFrame; // selected from callstack or threads pads }