[CSHARP-2384] SkipName should also skip type descriptor instead of throwing an error Created: 13/Sep/18 Updated: 31/Mar/22 |
|
| Status: | Backlog |
| Project: | C# Driver |
| Component/s: | BSON |
| Affects Version/s: | 2.7.0 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Benjamin Piorczig | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Minor Change |
| Description |
|
ReadName() will read bson-type if there is one at current position and read the name. SkipName() does not read bson-type and will only skip the name.
In short: a user of SkipName() likely wants to skip the BsonReaderState.Type also.
I think it would be better if SkipName() would internally check if there is a bson type to read and if the bson-type is not equal name description it might throw an error. It should just skip the name description bson-type, because that is what one would suspect if using this api.
One has to replace ReadName() with ReadType() and SkipName().
|