This is a bad form because it does not save the stack trace:
try { } catch (Exception e) { throw e;
However, if the exception is caught in a thread other than the UI, I want to make it back to the user interface and process it so that the user receives the message like this:
try { } catch (Exception e) { Dispatcher.Invoke((Action)(() => { throw; })); }
However, I cannot use the throw keyword here because the C # lexer (correctly) does not consider the throw statement to be inside the catch . I have to do the following:
try { } catch (Exception e) { Dispatcher.Invoke((Action)(() => { throw e; })); }
and rethrow the exception that loses the stack trace.
Is there any (simple) way around this (I could always pack the stack trace at the time the exception is ready to switch threads, but that seems hokey)?
Note. I saw this stream , but it only looks like the header, not the content.
Michael
source share