Commit 2b7498d8 authored by Marc Gravell's avatar Marc Gravell

Merge pull request #319 from jeremymeng/CoreClr

Ignore certain unobserved Task exceptions in test teardown
parents c4eb409b b6f9378e
......@@ -50,6 +50,9 @@ static TestBase()
{
Console.WriteLine("Unobserved: " + args.Exception);
args.SetObserved();
#if CORE_CLR
if (IgnorableExceptionPredicates.Any(predicate => predicate(args.Exception.InnerException))) return;
#endif
Interlocked.Increment(ref failCount);
lock (exceptions)
{
......@@ -57,6 +60,15 @@ static TestBase()
}
};
}
#if CORE_CLR
static Func<Exception, bool>[] IgnorableExceptionPredicates = new Func<Exception, bool>[]
{
e => e != null && e is ObjectDisposedException && e.Message.Equals("Cannot access a disposed object.\r\nObject name: 'System.Net.Sockets.NetworkStream'."),
e => e != null && e is IOException && e.Message.StartsWith("Unable to read data from the transport connection:")
};
#endif
protected void OnConnectionFailed(object sender, ConnectionFailedEventArgs e)
{
Interlocked.Increment(ref failCount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment