Manually controlling exception handling
danielsena
Posts: 11
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...
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
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.