.NET 4.5 changed the exception handling behaviour of Tasks which caused us a lot of trouble. Now the unobserved exceptions are ignored whereas in .NET 4.0 the finalizer of the Task has thrown them.
It is possible to reactivate the “old” behaviour with the runtime configuration ThrowUnobservedTaskExceptions. This works for our WPF applications but I have not found a way to do the same with our unit tests.
At the moment a unit test can pass although a Task has thrown an unobserved exception. It is possible to define an “App.config” file for unit tests as well. But it seems that runtime settings are not applied.
How can I activate the ThrowUnobservedTaskExceptions behaviour in our VS unit tests?