public async Task Refresh(CancellationToken cancellationToken) { _debuggerSession.BreakOnExceptions = _outputViewer.BreakOnExceptions; StackTrace.Clear(); StackTrace.AddRange(_debuggerSession.StackTrace); DebuggerTabItem debuggerView = null; foreach (var stackItem in _debuggerSession.StackTrace) { if (_viewers.TryGetValue(stackItem.Header, out debuggerView)) { continue; } debuggerView = new DebuggerTabItem(stackItem, _outputViewer); debuggerView.BreakpointChanging += CodeViewerBreakpointChangingHandler; debuggerView.BreakpointChanged += CodeViewerBreakpointChangedHandler; if (_viewers.Count == 0) { debuggerView.Loaded += DebuggerViewLoadedHandler; } await debuggerView.CodeViewer.LoadAsync(stackItem.ProgramText, cancellationToken); _viewers.Add(stackItem.Header, debuggerView); TabSourceViewer.Items.Add(debuggerView); foreach (var breakpointIdentifier in _breakpointIdentifiers.Where(kvp => kvp.Key.ProgramIdentifier.Equals(stackItem.ProgramIdentifier)).ToArray()) { debuggerView.AddBreakpoint(breakpointIdentifier.Key, breakpointIdentifier.Value); } } debuggerView.IsSelected = true; HighlightStackTraceLines(); if (_debuggerSession.CurrentException != null) { Messages.ShowError($"An exception has been raised: {Environment.NewLine}{_debuggerSession.CurrentException.ErrorMessage}", "Database Exception"); } await RefreshWatchItemsAsync(cancellationToken); }