private static void OpenTicketIfNeeded(string dump, DumpData res,
                                        Configuration configuration)
 {
     if (configuration.OpenTickets)
     {
         OpenTicket(dump, res, configuration);
     }
 }
        private static void OpenTicket(string dump, DumpData res,
                                       Configuration configuration)
        {
            OwnershipData ownershipData = configuration.Owners.FirstOrDefault(o => o.Filter == res.FilterOfInterest);
            Owner         assignee      = configuration.DefaultOwner;

            if (ownershipData != null)
            {
                assignee = ownershipData.Owner;
            }

            var author = new IdentifiableName {
                Id = _redmineManager.GetCurrentUser().Id
            };
            IdentifiableName assignedTo =
                _projectMembers.SingleOrDefault(pm => pm != null && pm.Name == assignee.Name) ??
                _projectMembers.SingleOrDefault(pm => pm != null && pm.Name == configuration.DefaultOwner.Name);

            if (assignedTo == null)
            {
                // TODO: do something about this?
            }

            string subject     = "Unexpected exception occurred";
            string description =
                string.Format("Please investigate a dump located at {0}.{1}{2}Here's the beginning of the call stack for the last event:{3}{4}",
                              dump,
                              Environment.NewLine, Environment.NewLine, Environment.NewLine,
                              string.Join(Environment.NewLine, res.CallStack.Take(Math.Min(res.CallStack.Count, 30))));

            if (res.FrameOfInterest != null)
            {
                subject = string.Format("A problem occurred in {0}.{1}: {2}",
                                        res.FrameOfInterest.ModuleName, res.FrameOfInterest.MethodName, res.LastEvent.Description);

                description = string.Format("There was a problem in {0}: {1}.{2}Please investigate a dump located at {3}.{4}{5}Here's the call stack for the last event:{6}{7}",
                                            res.FrameOfInterest.ModuleName, res.LastEvent, Environment.NewLine,
                                            dump,
                                            Environment.NewLine, Environment.NewLine, Environment.NewLine,
                                            string.Join(Environment.NewLine, res.CallStack.Take(Math.Min(res.CallStack.Count, 30))));
            }

            var issue = new Issue
            {
                Subject     = subject.Substring(0, Math.Min(subject.Length, 255)),
                Description = description,
                AssignedTo  = assignedTo,
                Author      = author,
                Project     = new IdentifiableName {
                    Id = _project.Id
                },
            };

            _redmineManager.CreateObject(issue);
        }
 private static void Report(DumpData res)
 {
     foreach (StackFrame stackFrame in res.CallStack)
     {
         if (stackFrame == res.FrameOfInterest)
         {
             Console.ForegroundColor = ConsoleColor.Yellow;
         }
         Console.WriteLine(stackFrame);
         Console.ResetColor();
     }
 }
Exemple #4
0
 private static void Report(DumpData res)
 {
     foreach (StackFrame stackFrame in res.CallStack)
     {
         if (stackFrame == res.FrameOfInterest)
         {
             Console.ForegroundColor = ConsoleColor.Yellow;
         }
         Console.WriteLine(stackFrame);
         Console.ResetColor();
     }
 }
Exemple #5
0
 private static void OpenTicketIfNeeded(string dump, DumpData res,
                                        Configuration configuration)
 {
     if (configuration.OpenTickets)
     {
         OpenTicket(dump, res, configuration);
     }
 }
Exemple #6
0
        private static void OpenTicket(string dump, DumpData res,
                                       Configuration configuration)
        {
            OwnershipData ownershipData = configuration.Owners.FirstOrDefault(o => o.Filter == res.FilterOfInterest);
            Owner assignee = configuration.DefaultOwner;
            if (ownershipData != null)
            {
                assignee = ownershipData.Owner;
            }

            var author = new IdentifiableName { Id = _redmineManager.GetCurrentUser().Id };
            IdentifiableName assignedTo =
                _projectMembers.SingleOrDefault(pm => pm != null && pm.Name == assignee.Name) ??
                _projectMembers.SingleOrDefault(pm => pm != null && pm.Name == configuration.DefaultOwner.Name);
            if (assignedTo == null)
            {
                // TODO: do something about this?
            }

            string subject = "Unexpected exception occurred";
            string description =
                string.Format("Please investigate a dump located at {0}.{1}{2}Here's the beginning of the call stack for the last event:{3}{4}",
                    dump,
                    Environment.NewLine, Environment.NewLine, Environment.NewLine,
                    string.Join(Environment.NewLine, res.CallStack.Take(Math.Min(res.CallStack.Count, 30))));

            if (res.FrameOfInterest != null)
            {
                subject = string.Format("A problem occurred in {0}.{1}: {2}",
                res.FrameOfInterest.ModuleName, res.FrameOfInterest.MethodName, res.LastEvent.Description);

                description = string.Format("There was a problem in {0}: {1}.{2}Please investigate a dump located at {3}.{4}{5}Here's the call stack for the last event:{6}{7}",
                    res.FrameOfInterest.ModuleName, res.LastEvent, Environment.NewLine,
                    dump,
                    Environment.NewLine, Environment.NewLine, Environment.NewLine,
                    string.Join(Environment.NewLine, res.CallStack.Take(Math.Min(res.CallStack.Count, 30))));
            }

            var issue = new Issue
                {
                    Subject = subject.Substring(0, Math.Min(subject.Length, 255)),
                    Description = description,
                    AssignedTo = assignedTo,
                    Author = author,
                    Project = new IdentifiableName { Id = _project.Id },
                };

            _redmineManager.CreateObject(issue);
        }