[System] Rewrite Dns tests so that failures don't cause the process to crash.
commit3c2e1c56b2b2ac7e65e0fbb17d41e5fefb0730cf
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Wed, 14 Sep 2016 15:33:12 +0000 (14 17:33 +0200)
committerRolf Bjarne Kvinge <rolf@xamarin.com>
Fri, 16 Sep 2016 09:56:21 +0000 (16 11:56 +0200)
tree7729402b1572c248c05b906f37ce4e79c1b9d134
parentfee3014cd3471bad5b77f586902a0f579bae8988
[System] Rewrite Dns tests so that failures don't cause the process to crash.

Previously the tests were written so that some failures might occur on the
threadpool in methods that did not catch exceptions. In that case the process
would terminate due to an unhandled exception. So rewrite the tests to catch
exceptions in any code that doesn't run on the main thread, and forward those
exceptions to the main thread.

Also wait for async operations to complete on the main thread, and remove
asserts that are not supposed to be hit.

This is a backport of PR #3558.
mcs/class/System/Test/System.Net/DnsTest.cs