public async Tasks.Task DisplaySourceItemsAsync(IEnumerable <ISourceMappedItem> items, ICollection <CalculatedProject> projects) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); _errorList.Tasks.Clear(); _errorList.Refresh(); _errorList.SuspendRefresh(); var projectWithOutputMappings = new ConcurrentDictionary <string, IVsHierarchy>(); foreach (var calculatedProject in projects) { var project = calculatedProject.Project; var outputs = calculatedProject.OutputFiles; if (outputs == null) { continue; } var hierarchy = calculatedProject.VsHierarchy; foreach (var output in outputs) { projectWithOutputMappings.AddOrUpdate(output, hierarchy, (existingKey, existingValue) => hierarchy); } } try { var defaultHierarchy = projects.First().VsHierarchy; foreach (var item in items) { if (!_fileSystem.FileExists(item.Path)) { continue; } if (!projectWithOutputMappings.TryGetValue(item.Assembly, out var hierarchy)) { hierarchy = defaultHierarchy; } var errorWindowTask = item.GetErrorWindowTask(hierarchy); var result = _errorList.Tasks.Add(errorWindowTask); } } finally { _errorList.ResumeRefresh(); } // Outside the finally because it will obscure errors reported on the output window _errorList.BringToFront(); }
public void ClearErrors() { StaDynErrorList.Instance.clearErrors(); //previousErrors.ForEach(task => errorList.Tasks.Remove(task)); //previousErrors.Clear(); var DTEObj = Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE; if (EnvDTE.vsBuildState.vsBuildStateInProgress != DTEObj.Solution.SolutionBuild.BuildState) { DTEObj.Solution.SolutionBuild.Clean(false); } errorList.Tasks.Clear(); errorList.Refresh(); }