Ejemplo n.º 1
0
        public Threading.Task SendErrorDetails(IVsTaskList errorList)
        {
            Threading.Task processTaskListTask = new System.Threading.Tasks.Task(() =>
            {
                _processorStopwatch.Start();

                IVsEnumTaskItems taskEnum = null;
                IVsTaskItem[] oneItem     = new IVsTaskItem[1];

                if (errorList != null)
                {
                    errorList.EnumTaskItems(out taskEnum);

                    if (taskEnum != null)
                    {
                        int maxItems = 10000;
                        Int32.TryParse(Properties.Resources.MaxErrorsToProcess, out maxItems);

                        taskEnum.Next(1, oneItem, null);
                        for (int i = 0; (i < maxItems) && (oneItem[0] != null); ++i)
                        {
                            ProcessTaskListItem(oneItem[0]);
                            taskEnum.Next(1, oneItem, null);
                        }

                        // send all events in case the Visual Studio instance is closed or solution unloaded
                        BuildTelemetryClient.FlushEvents();
                    }
                }

                _processorStopwatch.Stop();

                Dictionary <string, string> perfProperties = new Dictionary <string, string>();
                perfProperties.Add("BuildId", _currentBuildGuid.ToString());
                perfProperties.Add("ProjectId", _firstIslandwoodProjectGuid.ToString());

                Dictionary <string, double> perfMetrics = new Dictionary <string, double>();
                perfMetrics.Add("ProcessTasks", _processorStopwatch.ElapsedMilliseconds);

                BuildTelemetryClient.TrackEvent("IslandwoodBuildMonitorPerformance", perfProperties, perfMetrics);

                // reset state in case projects/solutions are unloaded before next build
                _firstIslandwoodProjectGuid = Guid.Empty;
            });

            processTaskListTask.Start();

            return(processTaskListTask);
        }
Ejemplo n.º 2
0
        public void BeginIslandWoodBuild()
        {
            Dictionary <string, string> beginBuildProperties = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);

            _currentBuildGuid = Guid.NewGuid();
            beginBuildProperties.Add("BuildId", _currentBuildGuid.ToString());
            beginBuildProperties.Add("ProjectId", _firstIslandwoodProjectGuid.ToString());
            beginBuildProperties.Add("IsMsftInternal", _microsoftInternalUser.ToString());
            beginBuildProperties.Add("UICulture", CultureInfo.CurrentUICulture.Name);
            beginBuildProperties.Add("WindowsLanguage", CultureInfo.CurrentUICulture.ThreeLetterWindowsLanguageName);
            beginBuildProperties.Add("IsoLanguage", CultureInfo.CurrentUICulture.ThreeLetterISOLanguageName);
            beginBuildProperties.Add("SolutionConfigRaw", _solutionConfigRaw);
            beginBuildProperties.Add("SolutionConfig", _solutionConfig);
            beginBuildProperties.Add("SolutionPlatform", _solutionPlatform);

            BuildTelemetryClient.TrackEvent("BeginIslandwoodBuild", beginBuildProperties, null);
        }
Ejemplo n.º 3
0
        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);
                    }
                }
            }
        }