Skip to content

Commit 72e05dd

Browse files
authored
CSHARP-5621: Fix BinaryConnectionTests.ReceiveMessage_should_throw_a_FormatException fails with TimeoutException (#1715)
1 parent 1186b93 commit 72e05dd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,10 @@ public void ReceiveMessage_should_throw_a_FormatException_when_message_is_an_inv
374374
using (var stream = new BlockingMemoryStream())
375375
{
376376
var bytes = BitConverter.GetBytes(length);
377+
if (!BitConverter.IsLittleEndian)
378+
{
379+
Array.Reverse(bytes);
380+
}
377381
stream.Write(bytes, 0, bytes.Length);
378382
stream.Seek(0, SeekOrigin.Begin);
379383
var encoderSelector = new ReplyMessageEncoderSelector<BsonDocument>(BsonDocumentSerializer.Instance);

0 commit comments

Comments
 (0)