What are the challenges you face when working across database platforms? Take the survey
Options

Manually controlling exception handling

danielsenadanielsena Posts: 11
edited September 3, 2014 6:18AM in SmartAssembly
I would like to control unhandled exceptions within my program manually, utilizing the SmartAssembly features to report the error if needed.

I have added event handlers to the AppDomain.CurrentDomain.UnhandledException and Current.DispatcherUnhandledException events which work as desired using custom exception handling code to call ExceptionReporting.Report(e) in order to report the error.

After compiling the exe with SmartAssembly, the SmartAssembly report template is shown before my exception handling event is fired.

I have used reflection to remove the SmartAssembly hooks to AppDomain.CurrentDomain.UnhandledException and Application.Current.DispatcherUnhandledException before attaching my method, however this does not seem to disable the SmartAssembly integration... is there another event I need to handle, or is there a better way of achieving what I am trying to do?


Thanks for any help anyone can offer on this matter...

Comments

  • Options
    I managed to find a work around to my problem, although it is not a nice solution...

    I added code to the SA custom template OnReportException method.

    if (e.Exception.HelpLink != "SHOW_EXCEPTION" && e.CanContinue)
    {
    e.TryToContinue = true;
    return;
    }

    And in my generic exception handler I added the SHOW_EXCEPTION string to the HelpLink.
Sign In or Register to comment.