throw exception "into" another thread
-
hi, i have the well-known worker-thread doing some computations in the background. when there is an exception raised in this thread, it simply vanishes into hyperspace. X| is there any standard-way of handling exception thrown by the worker-thread in the calling thread? i could do numorous nasty hacks and workaround, but i don't know any "nice" way :-O thx for ideas. :wq
-
hi, i have the well-known worker-thread doing some computations in the background. when there is an exception raised in this thread, it simply vanishes into hyperspace. X| is there any standard-way of handling exception thrown by the worker-thread in the calling thread? i could do numorous nasty hacks and workaround, but i don't know any "nice" way :-O thx for ideas. :wq
Best idea I can think of is to wrap it all in a huge try block and raise an event with the details of the exception in it. Events are designed to be caught, exceptions aren't. Paul
-
hi, i have the well-known worker-thread doing some computations in the background. when there is an exception raised in this thread, it simply vanishes into hyperspace. X| is there any standard-way of handling exception thrown by the worker-thread in the calling thread? i could do numorous nasty hacks and workaround, but i don't know any "nice" way :-O thx for ideas. :wq
You can attach an event handler to the current
AppDomain
'sUnhandledException
event. This won't filter exceptions from that particular thread but it at least you can handle that exception.James Sig code stolen from David Wulff
-
hi, i have the well-known worker-thread doing some computations in the background. when there is an exception raised in this thread, it simply vanishes into hyperspace. X| is there any standard-way of handling exception thrown by the worker-thread in the calling thread? i could do numorous nasty hacks and workaround, but i don't know any "nice" way :-O thx for ideas. :wq
try using a singleton to handle the exception...
"When the only tool you have is a hammer, a sore thumb you will have."