Skip to content

Commit

Permalink
Fix SpanByte ToString() to prevent Index Out of Range Error (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
KimJuHeok committed Mar 28, 2024
1 parent 9e0b027 commit 927249b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/storage/Tsavorite/cs/src/core/VarLen/SpanByte.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ public void CopyTo(byte* destination)
public override string ToString()
{
var bytes = AsSpan();
var len = Math.Min(Length, 8);
var len = Math.Min(Length, bytes.Length);
StringBuilder sb = new($"len: {Length}, mdLen: {MetadataSize}, isSer {Serialized}, ");
for (var ii = 0; ii < len; ++ii)
sb.Append(bytes[ii].ToString("x2"));
Expand Down

0 comments on commit 927249b

Please sign in to comment.