Error Reporting - Send Error Report in Background Via Code

.NET obfuscator and automated error reporting

Moderators: Luke Jefferson, melvyn.harbour, dom.smith

Error Reporting - Send Error Report in Background Via Code

Postby memeDeveloper » Fri Jun 22, 2012 8:01 pm

Hi

I am using Smart Assembly 6 - Developer Edition. Mainly I am using the Error Reporting Feature and I have created a custom template for the error dialog box that gets shown to the user by modifying the "Custom UI" template in the SDK. Now, I need to show this dialog box to users for some exceptions while not show it for other exceptions.

I know that the OnReporException method in the "UnhandledExceptionHandlerWithAdvancedUI" class is what handles showing the dialog box.

I have checked the "UnhandledExceptionHandlerWithoutUI" class which is used to report errors without a dialog box (in the background) and the OnReportException code is different:

protected override void OnReportException(ReportExceptionEventArgs e)
{
for (int i=0; i<3; i++)
{
if (e.SendReport()) break;
}
e.TryToContinue = true;
}


If I use this code is my custom template instead of the one that shows the form, the reports gets sent in the background without a dialog box.

However, I need to have the option
to send the report in the background for some exceptions only and the rest by showing the custom dialog box.

Can that be achieved with Smart Assembly Error Reporting SDK? Is there a method that I can call to send that error report in the background ?


Thanks
memeDeveloper
 
Posts: 17
Joined: Fri Jun 22, 2012 7:49 pm

Postby Chris.Allen » Mon Jun 25, 2012 12:07 pm

Yes- this works in a straight-forward way. For example:


//////////////////
protected override void OnReportException(ReportExceptionEventArgs e)
{



if (MyStaticBoolean)
{

e.SendReport();

e.TryToContinue = true;


}


else
{

ExceptionReportingForm form = new ExceptionReportingForm(this, e);
form.ShowDialog();

}



}

////

i.e. just put the conditional logic in the OnReportException Method. Bingo!
Chris.Allen
 
Posts: 594
Joined: Thu Mar 12, 2009 4:17 pm

Postby memeDeveloper » Mon Jun 25, 2012 3:10 pm

Thanks for the reply, I have tried your suggestion and it works. I will have to set that boolean variable everywhere in my application where I don't want to show the dialog box but still I am glad I am able to do that now. Thanks.
memeDeveloper
 
Posts: 17
Joined: Fri Jun 22, 2012 7:49 pm

Postby memeDeveloper » Mon Jun 25, 2012 6:12 pm

One more question, Will this work with Handled Exception, I know that I can add ExceptionReporting.Report(ex); in the catch block and it will show the error dialog box but how can I call OnReportException from the catch block in order to report it silently in the background without the dialog box ?
memeDeveloper
 
Posts: 17
Joined: Fri Jun 22, 2012 7:49 pm

Postby Chris.Allen » Tue Jul 03, 2012 12:19 pm

If you rethrow the handled exception- it should behave exactly the same as an unhandled exception.
Chris.Allen
 
Posts: 594
Joined: Thu Mar 12, 2009 4:17 pm


Return to SmartAssembly 6

Who is online

Users browsing this forum: No registered users and 0 guests

cron