| Author |
Message |
memeDeveloper
Joined: 22 Jun 2012 Posts: 17
|
Posted: Fri Jun 22, 2012 8:01 pm Post subject: Error Reporting - Send Error Report in Background Via Code |
|
|
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 |
|
| Back to top |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 454
|
Posted: Mon Jun 25, 2012 12:07 pm Post subject: |
|
|
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! |
|
| Back to top |
|
 |
memeDeveloper
Joined: 22 Jun 2012 Posts: 17
|
Posted: Mon Jun 25, 2012 3:10 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
memeDeveloper
Joined: 22 Jun 2012 Posts: 17
|
Posted: Mon Jun 25, 2012 6:12 pm Post subject: |
|
|
| 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 ? |
|
| Back to top |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 454
|
Posted: Tue Jul 03, 2012 12:19 pm Post subject: |
|
|
| If you rethrow the handled exception- it should behave exactly the same as an unhandled exception. |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group