Taking Exception to Exceptions in Tasks

Awhile back I converted most of the client framework to be much more MVVM-ish. Part of this turned over proxy management to a ProxyModel class. In so doing, the mechanisms for getting the server’s user list and latest text-chat messages for the user were converted to functions designed to work in a free-threaded manner (in response to callbacks from the server).

Since all the communication between the server and the client is now handled without the WPF dispatcher thread getting involved (and better, the Login Dialog uses a call to the ProxyModel that invokes UserList and GetMessages through a TaskFactory.StartNew), it has come to my attention that I am not observing exceptions thrown from within the confines of the task-scheduler created threads.

What used to pop-up a “friendly” Ikosa exception dialog on a failed login attempt now simply crashes the client process as the when the task is garbage collected, the thrown (unobserved) exceptions are AppDomain poison. This has become my next “must-fix”…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s