| Author |
Message |
DanielRose
Joined: 30 Oct 2009 Posts: 16 Location: Aachen, Germany
|
Posted: Tue Nov 20, 2012 4:35 pm Post subject: Fatal exception handler is missing "inner" exception |
|
|
I have smartassembly set to report exceptions on my application with a custom template.
Today I got an exception report as screenshot only, since the fatal exception handler was being called: The normal exception handler was called to report an exception. However, the handler threw an exception (due to a cross-thread call). This was caught and the fatal exception handler got called.
So far, so good. However, the original exception is not part of the data for the fatal exception handler! I fixed the bug in the exception handler, but I can't fix the original bug since I don't know what it is. The data is simply dropped. |
|
| Back to top |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 454
|
Posted: Wed Nov 21, 2012 9:29 pm Post subject: |
|
|
This is quite complex to provide definitive solutions.
Can you try to mitigate the problem by eliminating cross-threaded calls? |
|
| Back to top |
|
 |
DanielRose
Joined: 30 Oct 2009 Posts: 16 Location: Aachen, Germany
|
Posted: Thu Nov 22, 2012 10:07 am Post subject: |
|
|
I fixed the cross-thread call (and other potential problems). However, if for any reason an exception occurs during the exception handler, then the data about the original exception is still lost.
The code in SA is (from disassembly, and simplified):
| Code: |
public abstract class UnhandledExceptionHandler
{
private void ReportException(Exception exception, bool canContinue, bool manuallyReported)
{
try
{
ReportExceptionEventArgs e = new ReportExceptionEventArgs(reportSender, exception);
this.OnReportException(e);
}
catch (Exception ex)
{
this.OnFatalException(new FatalExceptionEventArgs(ex));
}
}
}
|
In the catch, the original exception is lost. I'm not sure how to best fix it. Perhaps an additional property on the FatalExceptionEventArgs? |
|
| Back to top |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 454
|
Posted: Thu Nov 22, 2012 2:41 pm Post subject: |
|
|
Firstly, thanks for taking my suggestion seriously
And I understand the exact problem a little better now- thanks to your further explanation.
I don't know if the data can be obtained (or if the FatalException status necessarily means it can't) but I will discuss this with our developers in order to get a clear answer for you. |
|
| Back to top |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 454
|
Posted: Fri Nov 23, 2012 2:18 pm Post subject: |
|
|
No news just yet.
In the meantime- do you get better behaviour if you use the default standard template? |
|
| Back to top |
|
 |
DanielRose
Joined: 30 Oct 2009 Posts: 16 Location: Aachen, Germany
|
Posted: Fri Nov 23, 2012 4:31 pm Post subject: |
|
|
I won't get any better behavior because the original exception is never passed to the fatal exception handler. The code would need to be modified as follows:
| Code: |
catch (Exception ex)
{
this.OnFatalException(new FatalExceptionEventArgs(ex, exception));
}
|
with the FatalExceptionEventArgs having an additional (optional) parameter for an "inner exception", since it's not possible to create an exception wrapping both exceptions or add exception as inner exception to ex (except perhaps with nasty Reflection on internal fields). |
|
| Back to top |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 454
|
Posted: Mon Nov 26, 2012 4:58 pm Post subject: |
|
|
| To save your time- I'm not getting any response from our dev teams as to whether this is expected behaviour or not so I have simply added this as a feature request. |
|
| Back to top |
|
 |
Chris.Allen
Joined: 12 Mar 2009 Posts: 454
|
Posted: Wed Nov 28, 2012 3:23 pm Post subject: |
|
|
The bug reference is SA-1596.
I cannot promise a speedy remedy but please check maybe each month. |
|
| Back to top |
|
 |
DanielRose
Joined: 30 Oct 2009 Posts: 16 Location: Aachen, Germany
|
Posted: Mon Jun 10, 2013 4:35 pm Post subject: |
|
|
| It has been a while since I reported this, and now 6.8 is out. Do you have a timeline for this request? |
|
| Back to top |
|
 |
|