ASP.NET Exception Handling in background threads
Posted
by Xodarap
on Stack Overflow
See other posts from Stack Overflow
or by Xodarap
Published on 2010-06-15T23:13:42Z
Indexed on
2010/06/16
7:52 UTC
Read the original article
Hit count: 295
When I do ThreadPool.QueueUserWorkItem, I don't want unhandled exceptions to kill my entire process. So I do something like:
ThreadPool.QueueUserWorkItem(delegate() {
try { FunctionIActuallyWantToCall(); }
catch { HandleException(); }
});
Is this the recommended pattern? It seems like there should be a simpler way to do this. It's in an asp.net-mvc app, if that's relevant.
© Stack Overflow or respective owner