/// <summary> /// Method to end the monitoring of a runspace for debugging events. /// </summary> /// <param name="args">PSEntityCreatedRunspaceEventArgs</param> internal virtual void EndMonitoringRunspace(PSMonitorRunspaceInfo args) { throw new PSNotImplementedException(); }
/// <summary> /// End monitoring a runspace on the target degbugger. /// </summary> /// <param name="debugger">Target debugger</param> /// <param name="runspaceInfo">PSMonitorRunspaceInfo</param> public static void EndMonitoringRunspace(Debugger debugger, PSMonitorRunspaceInfo runspaceInfo) { if (debugger == null) { throw new PSArgumentNullException("debugger"); } if (runspaceInfo == null) { throw new PSArgumentNullException("runspaceInfo"); } debugger.EndMonitoringRunspace(runspaceInfo); }
private void ClearRunningRunspaceList() { PSMonitorRunspaceInfo[] runningRunspaces = null; lock (_syncObject) { if (_runningRunspaces.Count > 0) { runningRunspaces = new PSMonitorRunspaceInfo[_runningRunspaces.Count]; _runningRunspaces.Values.CopyTo(runningRunspaces, 0); } } if (runningRunspaces != null) { foreach (var item in runningRunspaces) { RemoveFromRunningRunspaceList(item.Runspace); } } }
private void AddToRunningRunspaceList(PSMonitorRunspaceInfo args) { Runspace runspace = args.Runspace; runspace.StateChanged += HandleRunspaceStateChanged; RunspaceState rsState = runspace.RunspaceStateInfo.State; if (rsState == RunspaceState.Broken || rsState == RunspaceState.Closed || rsState == RunspaceState.Disconnected) { runspace.StateChanged -= HandleRunspaceStateChanged; return; } lock (_syncObject) { if (!_runningRunspaces.ContainsKey(runspace.InstanceId)) { _runningRunspaces.Add(runspace.InstanceId, args); } } // It is possible for the debugger to be non-null at this point if a runspace // is being reused. SetUpDebuggerOnRunspace(runspace); }
internal override void EndMonitoringRunspace(PSMonitorRunspaceInfo runspaceInfo) { if (runspaceInfo == null || runspaceInfo.Runspace == null) { return; } RemoveFromRunningRunspaceList(runspaceInfo.Runspace); }
internal override void StartMonitoringRunspace(PSMonitorRunspaceInfo runspaceInfo) { if (runspaceInfo == null || runspaceInfo.Runspace == null) { return; } if ((runspaceInfo.Runspace.Debugger != null) && runspaceInfo.Runspace.Debugger.Equals(this)) { Debug.Assert(false, "Nested debugger cannot be the root debugger."); return; } DebuggerResumeAction startAction = (_currentDebuggerAction == DebuggerResumeAction.StepInto) ? DebuggerResumeAction.StepInto : DebuggerResumeAction.Continue; AddToRunningRunspaceList(runspaceInfo.Copy()); }