Thread and Asynchronous Callback Exceptions

What happens if an exception occurs in another thread of the current AppDomain or in an asynchronous callback? Two samples will illustrate what happens when an exception occurs in an asynchronous callback or in another thread.

Asynchronous Callback Exceptions

At first, you might not consider exceptions in the context of an asynchronous callback. However, when you try it, it seems that there is a bug because it does not seem to work as you planned. Perhaps you were under the false impression that asynchronous callbacks simply use the ThreadPool, and the ThreadPool is a simple collection of Threads. It is more complex than that. The following sample application will help you understand what is happening ...

Get .NET Common Language Runtime Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.