Added handling of AppDomain exception

The user can now provide an AppDomain so even background exception are
reported.