[CSHARP-2036] ListCollections throws a FormatException with server 3.5.12 Created: 07/Sep/17  Updated: 28/Oct/23  Resolved: 08/Sep/17

Status: Closed
Project: C# Driver
Component/s: Operations
Affects Version/s: 2.4.4
Fix Version/s: 2.5

Type: Bug Priority: Major - P3
Reporter: Robert Stam Assignee: Robert Stam
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CSHARP-2182 C# Driver - System.FormatException on... Closed
Backwards Compatibility: Minor Change

 Description   

The following code:

var collections = database.ListCollections().ToList();

throws a FormatException when run against server 3.5.12. The message is:

The GuidRepresentation for the reader is CSharpLegacy, which requires the binary sub type to be UuidLegacy, not UuidStandard.

This is happening because the collection info now includes a UUID.

The ReadBinaryData method should be able to read either subtype 3 or subtype 4 BsonBinary values regardless of the settings. The GuidRepresentation from the settings should only be used when the value read is of subtype 3.

This change will be backward breaking only to applications that were counting on the BsonBinaryReader to enforce that all UUIDs read were of the expected subtype.


Generated at Wed Feb 07 21:41:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.