private void OnEndSession() { lock (_sessionLock) { if (_session != null) { _session.TargetUnhandledException -= _session_TargetStopped; _session.TargetStopped -= _session_TargetStopped; _session.TargetHitBreakpoint -= _session_TargetStopped; _session.TargetSignaled -= _session_TargetStopped; _session.TargetInterrupted -= _session_TargetStopped; _session.TargetExited -= _session_TargetExited; _session.TargetStarted -= _session_TargetStarted; _session.TargetReady -= _session_TargetReady; _session?.Dispose(); _session = null; } } Dispatcher.UIThread.InvokeAsync(() => { DebugSessionEnded?.Invoke(this, EventArgs.Empty); _studio.CurrentPerspective = Perspective.Normal; _lastDocument?.ClearDebugHighlight(); _lastDocument = null; // This will save breakpoints that were moved to be closer to actual sequence points. Breakpoints.Save(); }); }
private void _session_TargetStarted(object sender, EventArgs e) { if (_lastDocument != null) { Dispatcher.UIThread.InvokeAsync(() => { _lastDocument.ClearDebugHighlight(); _lastDocument = null; }); } TargetStarted?.Invoke(this, e); }