Prev: Excel named ranges help needed
Next: Thanks again!
From: Buu Nguyen on 26 Apr 2010 09:40 I'm using the Task Parallel Library (TPL) in .NET 4.0. I want to centralize the handling logic of all unhandled exceptions by using the Thread.GetDomain().UnhandledException event. However, in my application, the event is never fired for threads started with TPL code, e.g. Task.Factory.StartNew(...). The event is indeed fired if I use the traditional Thread(threadStart).Start(). This MSDN article (http://msdn.microsoft.com/en-us/library/dd997415%28v=VS.100%29.aspx) suggests to use Task#Wait() to catch the AggregateException when working with TPL, but that is not I want because it is not "centralized" enough (need to explicitly wait for each task) and blocks the main thread on the wait, which I don't want. Does anyone have any solution for this?
|
Pages: 1 Prev: Excel named ranges help needed Next: Thanks again! |