private void ProcessTaskListItem(IVsTaskItem taskListItem) { IVsErrorItem errorTaskItem = taskListItem as IVsErrorItem; if (errorTaskItem != null) { uint errorCategory = 255; errorTaskItem.GetCategory(out errorCategory); // is this task an error from an Islandwood project if (errorCategory == (uint)TaskErrorCategory.Error || errorCategory == (uint)TaskErrorCategory.Warning) { string sourceFile = string.Empty; taskListItem.Document(out sourceFile); if (string.IsNullOrEmpty(sourceFile) == false && (sourceFile.EndsWith(".m") || sourceFile.EndsWith(".mm") || sourceFile.EndsWith(".h"))) { Dictionary <string, string> errorDetails = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); errorDetails.Add("BuildId", _currentBuildGuid.ToString()); Guid errorProjectGuid = _firstIslandwoodProjectGuid; IVsHierarchy errorTaskItemHierarchy = null; if (errorTaskItem.GetHierarchy(out errorTaskItemHierarchy) == 0 && errorTaskItemHierarchy != null) { _solution.GetGuidOfProject(errorTaskItemHierarchy, out errorProjectGuid); } errorDetails.Add("ProjectId", errorProjectGuid.ToString()); string errorCategoryText = errorCategory == 0 ? TaskErrorCategory.Error.ToString() : TaskErrorCategory.Warning.ToString(); errorDetails.Add("Category", errorCategoryText); string rawErrorText = string.Empty; taskListItem.get_Text(out rawErrorText); errorDetails.Add("Description", ParseAndScrubErrorMessage(rawErrorText)); BuildTelemetryClient.TrackEvent("IslandwoodBuildError", errorDetails, null); } } } }
private async void UpdateAdornment(bool highlight) { int errors = 0; int warnings = 0; int messages = 0; foreach (IVsTaskItem item in GetErrorListItems()) { string file; item.Document(out file); if (string.IsNullOrEmpty(file) || file != _document.FilePath) { continue; } IVsErrorItem errorItem = item as IVsErrorItem; uint errorCategory; errorItem.GetCategory(out errorCategory); if (errorCategory == (uint)__VSERRORCATEGORY.EC_ERROR) { errors++; } if (errorCategory == (uint)__VSERRORCATEGORY.EC_WARNING) { warnings++; } if (errorCategory == (uint)__VSERRORCATEGORY.EC_MESSAGE) { messages++; } } _text.SetValues(errors, warnings, messages); if (highlight) { await _text.Highlight(); } }