AggregateException handling

2 posts, 0 answers
  1. coldacid
    coldacid avatar
    9 posts
    Member since:
    Apr 2012

    Posted 19 Mar 2013 Link to this post

    RadDiagnostics reports for AggregateException are next to useless, I've found. Since it doesn't dig into the list of actual exceptions from Task-called code, all you know is that an exception occurred somewhere in your app (if you're lucky the stack trace might give some clue as to where, but it's just as often a trace of something in the framework code and not the application). However, all is not lost. The following code packages up the type, message, and stack trace of each exception wrapped by AggregateException, allowing you to find out where in your program problems are occurring.
    void Diagnostics_ExceptionOccurred(object sender, ExceptionOccurredEventArgs e)
    {
        if (e.Exception.GetType() == typeof(AggregateException))
        {
            var builder = new System.Text.StringBuilder();
            var format = "\t[{0}][{1}]\n";
     
            builder.AppendLine();
            foreach (var ex in (e.Exception as AggregateException).InnerExceptions)
            {
                builder.AppendFormat(format, "Type", ex.GetType().Name);
                builder.AppendFormat(format, "Message", ex.Message);
                builder.AppendFormat(format, "StackTrace", ex.StackTrace);
            }
            e.CustomData += builder.ToString();
        }
    }
    Telerik, could you see to getting this into RadDiagnostics (for WP7 too, since BCL.Async lets us do all this TAP async coding there too)?
  2. Todor
    Admin
    Todor avatar
    778 posts

    Posted 22 Mar 2013 Link to this post

    Hi Chris,

    Thank you for contacting us.

    Your suggestion sounds reasonable. We are going to include such information in the diagnostics info that we send with RadDiagnostics. The changes will be included in our Service Pack release expected in early April.

    Greetings,
    Todor
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
Back to Top