Exceptions on thread pool threads

advertisements

Related:

  • How to catch exceptions from a ThreadPool.QueueUserWorkItem?
  • Exceptions on .Net ThreadPool Threads

If a method throws an exceptions that is called by the ThreadPool.QueueUserWorkItem method where will the exception be thrown? or will it just be eaten?

I mean it will never be thrown on the calling thread right?



NO, the exception will never propagate to another thread. It will eventually crash the thread, and be caught by the runtime. At this point the runtime raises the AppDomain.UnhandledException event where the exception can be observed.

You can read more about this here.