This is a migrated thread and some comments may be shown as answers.

AggregateException handling

1 Answer 23 Views
Diagnostics
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
coldacid
Top achievements
Rank 1
coldacid asked on 19 Mar 2013, 05:53 PM
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)?

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 22 Mar 2013, 01:16 PM
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.
Tags
Diagnostics
Asked by
coldacid
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or