[CSHARP-2218] BsonBinaryData constructor throws incorrect ArgumentException message Created: 18/Mar/18 Updated: 28/Oct/23 Resolved: 02/Apr/18 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | BSON |
| Affects Version/s: | 2.5 |
| Fix Version/s: | 2.5.1 |
| Type: | Bug | Priority: | Trivial - P5 |
| Reporter: | James Hadwen | Assignee: | Robert Stam |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Description |
|
Error thrown in the lines:
However this.GuidRepresentation has yet to be initialized, parameter should actually be guidRepresentation. |
| Comments |
| Comment by Githook User [ 02/Apr/18 ] |
|
Author: {'email': 'robert@robertstam.org', 'name': 'rstam', 'username': 'rstam'}Message: |
| Comment by Githook User [ 02/Apr/18 ] |
|
Author: {'email': 'robert@robertstam.org', 'name': 'rstam', 'username': 'rstam'}Message: |
| Comment by Robert Stam [ 02/Apr/18 ] |
|
An instance of BsonBinaryData has two primary properties: SubType: A enum indicating what type of binary data this is In addition, for the two subtypes that represent UUIDs (UuidLegacy and UuidStandard) there is one additional property: {{GuidRepresentation}:} An enum indicating how the UUID is represented. There are strict rules about which combinations of SubType and GuidRepresentation are valid: 1. When SubType is UuidStandard, then GuidRepresentation MUST be Standard These rules are enforced by the BsonBinaryData constructors. |
| Comment by James Hadwen [ 18/Mar/18 ] |
|
To add, I'm not really certain why this constructor (in my case from BsonBinaryReader.ReadBinaryData() within an implementation of SerializerBase<T>) needs to preempt how I might or might not deconstruct the Guid. i.e. if the Guid is stored as LUUID, should I not be allowed to call BsonBinaryReader.ReadBinaryData().ToGuid(GuidRepresentation.CSharpLegacy) even if BsonDefaults.GuidRepresentation is set to Standard? |