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);
}
}
}
}