Skip to content

Commit 545df75

Browse files
CSHARP-3694: Sporadic tests failures: ReceiveMessage_should_not_produce_unobserved_task_exceptions_on_fail (#538)
1 parent dcadb19 commit 545df75

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/MongoDB.Driver.Core.Tests/Core/Connections/BinaryConnectionTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,10 @@ public void ReceiveMessage_should_not_produce_unobserved_task_exceptions_on_fail
477477
var mockStream = new Mock<Stream>();
478478
EventHandler<UnobservedTaskExceptionEventArgs> eventHandler = (s, args) =>
479479
{
480-
unobservedTaskExceptionRaised = true;
481-
args.SetObserved();
480+
if (args.Exception.InnerException is MongoConnectionException)
481+
{
482+
unobservedTaskExceptionRaised = true;
483+
}
482484
};
483485

484486
try

0 commit comments

Comments
 (0)