Skip to content

Commit b9af7bc

Browse files
committed
- PR comments
1 parent cd3da21 commit b9af7bc

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

src/MongoDB.Bson/IO/ReadOnlyMemoryBsonReader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ public override ObjectId ReadObjectId()
447447
}
448448

449449
/// <summary>
450-
/// Reads a raw BSON array. WARNING TODO
450+
/// Reads a raw BSON array.
451451
/// </summary>
452452
/// <returns>
453453
/// The raw BSON array.
@@ -656,7 +656,7 @@ private void PopContext()
656656
throw new FormatException($"Expected size to be {_context.Size}, not {actualSize}.");
657657
}
658658

659-
_context =_contextStack.Pop();
659+
_context = _contextStack.Pop();
660660
}
661661

662662
private void PushContext(BsonBinaryReaderContext newContext)

src/MongoDB.Bson/IO/TrieNameDecoder.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,11 @@ public string Decode(BsonStream stream, UTF8Encoding encoding)
104104
public string Decode(ReadOnlySpan<byte> span, UTF8Encoding encoding)
105105
{
106106
BsonTrieNode<TValue> node;
107-
if (_trie.TryGetNode(span, out node))
107+
if (_trie.TryGetNode(span, out node) && node.HasValue)
108108
{
109-
if (node.HasValue)
110-
{
111-
_found = true;
112-
_value = node.Value;
113-
return node.ElementName;
114-
}
109+
_found = true;
110+
_value = node.Value;
111+
return node.ElementName;
115112
}
116113

117114
_found = false;

src/MongoDB.Bson/ObjectModel/RawBsonDocument.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public override int ElementCount
6969
{
7070
ThrowIfDisposed();
7171
using var bsonReader = BsonBinaryReaderUtils.CreateBinaryReader(_slice, _readerSettings);
72-
var context = BsonDeserializationContext.CreateRoot(bsonReader);
7372

7473
var elementCount = 0;
7574

0 commit comments

Comments
 (0)