From 48923a371a71d5d3a10d6c81834960e4cec6bd31 Mon Sep 17 00:00:00 2001 From: Medha Tiwari Date: Thu, 19 Jun 2025 11:51:29 +0200 Subject: [PATCH 1/2] CSHARP-5621 Fix BinaryConnectionTests.ReceiveMessage_should_throw_a_FormatException fails with TimeoutException Signed-off-by: Medha Tiwari --- .../Core/Connections/BinaryConnectionTests.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/MongoDB.Driver.Tests/Core/Connections/BinaryConnectionTests.cs b/tests/MongoDB.Driver.Tests/Core/Connections/BinaryConnectionTests.cs index f39bb0a97a5..ebd3e5ed1c8 100644 --- a/tests/MongoDB.Driver.Tests/Core/Connections/BinaryConnectionTests.cs +++ b/tests/MongoDB.Driver.Tests/Core/Connections/BinaryConnectionTests.cs @@ -374,6 +374,10 @@ public void ReceiveMessage_should_throw_a_FormatException_when_message_is_an_inv using (var stream = new BlockingMemoryStream()) { var bytes = BitConverter.GetBytes(length); + if (!BitConerter.IsLittleEndian) + { + Array.Reverse(bytes); + } stream.Write(bytes, 0, bytes.Length); stream.Seek(0, SeekOrigin.Begin); var encoderSelector = new ReplyMessageEncoderSelector(BsonDocumentSerializer.Instance); From 511c8893938ce290b66b9da8eb2118005d8ab5b9 Mon Sep 17 00:00:00 2001 From: Medha Tiwari <75640645+medhatiwari@users.noreply.github.com> Date: Mon, 23 Jun 2025 19:38:09 +0530 Subject: [PATCH 2/2] Update BinaryConnectionTests.cs --- .../Core/Connections/BinaryConnectionTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/MongoDB.Driver.Tests/Core/Connections/BinaryConnectionTests.cs b/tests/MongoDB.Driver.Tests/Core/Connections/BinaryConnectionTests.cs index ebd3e5ed1c8..8a0ae8b75d6 100644 --- a/tests/MongoDB.Driver.Tests/Core/Connections/BinaryConnectionTests.cs +++ b/tests/MongoDB.Driver.Tests/Core/Connections/BinaryConnectionTests.cs @@ -374,7 +374,7 @@ public void ReceiveMessage_should_throw_a_FormatException_when_message_is_an_inv using (var stream = new BlockingMemoryStream()) { var bytes = BitConverter.GetBytes(length); - if (!BitConerter.IsLittleEndian) + if (!BitConverter.IsLittleEndian) { Array.Reverse(bytes); }