-
Notifications
You must be signed in to change notification settings - Fork 315
Description
To reproduce
I have a reproduction of the issue along with a possible fix here:
master...jm771:ReproUnobservedException
Bug description
WaitForCompletion waits for a task to complete with a timeout, and allows you to specify a handler for the timeout case. However, once the timeout has occurred it ditches the task, which means if that task later completes with whatever error caused it to timeout, the exception will be unobserved, and the UnobservedTaskException event will fire.
As AsyncHelper is internal, the bug wasn't experienced directly, but certain timeout conditions in Sql connections would lead to unobserved exceptions. My former employer had a policy of no unobserved exceptions, and so had a handler that killed the application when they occurred. We worked around this at the time by changing the handler to ignore this type of exception, and it's only now I'm finding time to file a proper bug report.