Skip to content

Commit 7190e62

Browse files
committedFeb 10, 2024
Added an UnobservedTaskException handler in the unit tests
See issue #1703
1 parent d31d5f2 commit 7190e62

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎UnitTests/TestHelper.cs

+8
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,19 @@ static TestHelper ()
6060
}
6161

6262
#if NET5_0_OR_GREATER
63+
static void OnUnobservedTaskException (object sender, UnobservedTaskExceptionEventArgs e)
64+
{
65+
Console.WriteLine ("Unobserved Task Exception:");
66+
Console.WriteLine (e.Exception);
67+
}
68+
6369
[OneTimeSetUp]
6470
public static void Init ()
6571
{
6672
lock (CodePagesEncodingProvider.Instance)
6773
Encoding.RegisterProvider (CodePagesEncodingProvider.Instance);
74+
75+
TaskScheduler.UnobservedTaskException += OnUnobservedTaskException;
6876
}
6977
#endif
7078
}

0 commit comments

Comments
 (0)
Please sign in to comment.