Improvement for error reporting

.NET obfuscator and automated error reporting

Improvement for error reporting

Postby GieltjE » Sat Oct 26, 2013 10:10 am

The error reporting form doesn't send the exception data, below is a modified snippet that adds this data (in most cases this contains a lot of useful data (for instance mysql errors will add the error code), and when calling ExceptionReporting.Report it allows for easy adding of environment variables).

Code: Select all
       readonly List<string> _keys = new List<string>();
       readonly List<string> _values = new List<string>();

        public ExceptionReportingForm(UnhandledExceptionHandler unhandledExceptionHandler, ReportExceptionEventArgs reportExceptionEventArgs) : this()
         int newHeight = Height;

                _values.AddRange(from object value in reportExceptionEventArgs.Exception.Data.Values select value.ToString());
                _keys.AddRange(from object key in reportExceptionEventArgs.Exception.Data.Keys select key.ToString());

                int countOnlyOnce = _keys.Count;
                for (int i = 0; i < countOnlyOnce; i++)
                    reportExceptionEventArgs.AddCustomProperty(_keys[i], _values[i]);
            catch (Exception) {}

Why isn't something like this added to the defualt exception handlers?
Posts: 17
Joined: Sat Aug 24, 2013 12:51 pm

Postby jessica.ramos » Mon Oct 28, 2013 4:50 pm

Hi there,

Thank you for your post!

We've got a feature request to add the exception data to the default exception reporting templates (with internal reference SA-264) and I've +1'd this request with your information--thank you for your feedback!

Many thanks as well for sharing your solution for this. :)
Jessica Ramos
Technical Support
Red Gate Software Ltd.
Posts: 542
Joined: Mon Apr 23, 2012 12:13 pm

Postby GieltjE » Sat Nov 02, 2013 8:44 am

One of the other interesting things you can do with this is make the exception reporter behave differently when you set a certain value.
For example I used it to be able to send some reports silently without user interaction (Visible = false; ShowInTaskbar = false; and some other small hacks needed).
Posts: 17
Joined: Sat Aug 24, 2013 12:51 pm

Return to SmartAssembly 6

Who is online

Users browsing this forum: No registered users and 0 guests