Enable Error Reporting, but only send error reports programa

taktiqtaktiq Posts: 5 Bronze 1
edited February 25, 2016 9:32AM in SmartAssembly
Hi,

we use SmartAssembly's automated error reporting for our application. We also use a custom template with our own implementation of UnhandledExceptionHandler.

For some type of exceptions, we trigger the error reporting programatically via ExceptionReporting.Report(...). Now we would like to trigger the reporting programatically for *all* exceptions, i.e. not have SmartAssembly show the error reporting dialog automatically.

Background: We attach log files to our error reports. Background: when exceptions are caught by SmartAssembly and the error report is generated before we have a chance to log those errors to file in our handler of Dispatcher.CurrentDispatcher.UnhandledException.
What we would like to do in our handler is
1) log the exception to file
2) call ExceptionReporting.Report(...) to send the error report with the log file afterwards

However if I deactivate "Automated Error Reporting" in the SmartAssembly configuration, I cannot select our DLL with the UnhandledExceptionHandler as a custom template at all.

Is there a way to use automated error reporting with a custom template and only trigger error reports programatically?!

Any help appreciated,
Christoph Danne

Comments

  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    Hi Christoph,

    I'm afraid it's not possible to instruct SmartAssembly to only report handled exceptions. :/ Just to confirm though, all of your application's exceptions are handled by Dispatcher.CurrentDispatcher.UnhandledException and in that method, you write to the log and then call on Report(exception)? Some alternatives could be to:

    1) Instead of logging from within Dispatcher.CurrentDispatcher.UnhandledException, do the logging from within your custom template's OnReportException method and make sure to write to the log before calling on form.ShowDialog()

    2) Edit your code to add a certain Data property to exceptions if they have already been written to the log file, and then edit your custom reporting template to only show the dialog if the exception has that specific Data property

    I hope one of those may be a suitable workaround! Please let us know how you get on.

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


  • taktiqtaktiq Posts: 5 Bronze 1
    Hi Jessica,

    thanks for the reply and the suggested workarounds. In fact, we also thought about option 1) and this seems a viable workaround. Logging from the exception handler is perfectly OK, but good to know that this is the best way to achieve the desired behaviour.

    Thanks,
    Christoph
  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    Hi Christoph,

    I'm so glad to hear that, please do let us know how things go!

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


  • taktiqtaktiq Posts: 5 Bronze 1
    Hi Jessica,

    we did introduce the logging into the exception handler, which resolved this issue for us.

    Thanks for your support,
    Christoph
Sign In or Register to comment.