private void UpdateAnalyzers() { if (_analyzerItems == null) { // The set of AnalyzerItems hasn't been realized yet. Just signal that HasItems // may have changed. NotifyPropertyChanged(nameof(HasItems)); return; } var project = _analyzersFolder.Workspace.CurrentSolution.GetProject( _analyzersFolder.ProjectId ); if (project != null && project.AnalyzerReferences != _analyzerReferences) { _analyzerReferences = project.AnalyzerReferences; _analyzerItems.BeginBulkOperation(); var itemsToRemove = _analyzerItems .Where(item => !_analyzerReferences.Contains(item.AnalyzerReference)) .ToArray(); var referencesToAdd = GetFilteredAnalyzers(_analyzerReferences, project) .Where(r => !_analyzerItems.Any(item => item.AnalyzerReference == r)) .ToArray(); foreach (var item in itemsToRemove) { _analyzerItems.Remove(item); } foreach (var reference in referencesToAdd) { _analyzerItems.Add( new AnalyzerItem( _analyzersFolder, reference, _commandHandler.AnalyzerContextMenuController ) ); } var sorted = _analyzerItems .OrderBy(item => item.AnalyzerReference.Display) .ToArray(); for (var i = 0; i < sorted.Length; i++) { _analyzerItems.Move(_analyzerItems.IndexOf(sorted[i]), i); } _analyzerItems.EndBulkOperation(); NotifyPropertyChanged(nameof(HasItems)); } }
private void UpdateStackLines() { foreach (var currentLine in stackLines) { currentLine.IsOnStack = false; } stackLines.Clear(); var stack = debuggerService.Machine.GetStackFrames(); foreach (var currentStackFrame in stack) { var currentAddress = currentStackFrame.ReturnAddress; if (currentAddress > 0) { // We want the line before the return address, but we don't know how long the instruction before was in memory // It might be quicker to try the address map with all possible lengths var nextLine = GetLineByAddress((int)currentAddress); var currentLineIndex = lines.IndexOf(nextLine) - 1; var currentLine = lines[currentLineIndex]; currentLine.IsOnStack = true; stackLines.Add(currentLine); } } }