Esempio 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);
        }
Esempio n. 2
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)
                {
                    try {
                        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);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Dictionary<string, string> exceptionDetails = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
                        exceptionDetails.Add("BuildId", _currentBuildGuid.ToString());
                        exceptionDetails.Add("ProjectId", _firstIslandwoodProjectGuid.ToString());
                        exceptionDetails.Add("Exception", e.GetType().ToString());
                        exceptionDetails.Add("Message", e.Message);
                        exceptionDetails.Add("InnerException", (e.InnerException == null ? "null" : e.InnerException.GetType().ToString()));
                        exceptionDetails.Add("InnerMessage", (e.InnerException == null ? "null" : e.InnerException.Message));
                        BuildTelemetryClient.TrackEvent("IslandwoodBuildMonitorException", exceptionDetails, null);
                    }
                    finally
                    {
                        // 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>(StringComparer.OrdinalIgnoreCase);
                perfProperties.Add("BuildId", _currentBuildGuid.ToString());
                perfProperties.Add("ProjectId", _firstIslandwoodProjectGuid.ToString());

                Dictionary<string, double> perfMetrics = new Dictionary<string, double>(StringComparer.OrdinalIgnoreCase);
                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;
        }