I have a WCF service hosted in IIS. The service already has a class implementing IErrorHandler where I log exceptions thrown in the context of a service call. The problem is, when the service is called it spawns a new thread to perform additional processing. When testing I discovered that any exception thrown in this thread will not get caught by my error handler. So, what alternative do I have to log this exception? Is there any way to plug AppDomain.UnhandledException somewhere? I have no problem with the IIS process being killed, I just don't want the error to go unnoticed.
UPDATE:
For the moment, what I've done is plug the AppDomain.UnhandledException event in a shared constructor in the service class. It seems to work, but I'm not sure if it's the better way to do it.