diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Eval.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Eval.cs index 00250ccb77..ff743569a4 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Eval.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Eval.cs @@ -135,7 +135,7 @@ namespace Debugger } } - process.NotifyEvaluationStarted(newEval); + process.ActiveEvals.Add(newEval); process.AsyncContinue(DebuggeeStateAction.Keep); return newEval; diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process-Evals.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process-Evals.cs index cf3f1df640..46b2195abd 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process-Evals.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process-Evals.cs @@ -13,32 +13,29 @@ namespace Debugger { public partial class Process { - List activeEvals = new List(); + EvalCollection evals; - public bool Evaluating { - get { - return activeEvals.Count > 0; - } + public EvalCollection ActiveEvals { + get { return evals; } + } + + internal bool Evaluating { + get { return evals.Count > 0; } } + } + + public class EvalCollection: CollectionWithEvents + { + public EvalCollection(NDebugger debugger): base(debugger) {} - internal Eval GetEval(ICorDebugEval corEval) + internal Eval Get(ICorDebugEval corEval) { - foreach(Eval eval in activeEvals) { + foreach(Eval eval in this) { if (eval.IsCorEval(corEval)) { return eval; } } throw new DebuggerException("Eval not found for given ICorDebugEval"); } - - internal void NotifyEvaluationStarted(Eval eval) - { - activeEvals.Add(eval); - } - - internal void NotifyEvaluationComplete(Eval eval) - { - activeEvals.Remove(eval); - } } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process.cs index 3e83f5f015..9209f7dc85 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process.cs @@ -71,6 +71,8 @@ namespace Debugger this.corProcess = corProcess; this.callbackInterface = new ManagedCallback(this); + + evals = new EvalCollection(debugger); } internal ICorDebugProcess CorProcess { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallback.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallback.cs index a27729afbc..2819385bd8 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallback.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Internal/ManagedCallback.cs @@ -256,9 +256,9 @@ namespace Debugger void HandleEvalComplete(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugEval corEval, bool exception) { // Let the eval know that the CorEval has finished - Eval eval = process.GetEval(corEval); + Eval eval = process.ActiveEvals.Get(corEval); eval.NotifyEvaluationComplete(!exception); - process.NotifyEvaluationComplete(eval); + process.ActiveEvals.Remove(eval); pauseOnNextExit = true; ExitCallback();