File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,15 @@ public void GetMemory_Sizes()
45
45
Assert . Throws < ArgumentOutOfRangeException > ( ( ) => seq . GetMemory ( - 1 ) ) ;
46
46
}
47
47
48
+ [ Fact ]
49
+ public void Reset_AfterPartialAdvance ( )
50
+ {
51
+ var seq = new Sequence < object > ( new MockMemoryPool < object > { Contents = { new object [ 4 ] } } ) ;
52
+ seq . Write ( new object [ 3 ] ) ;
53
+ seq . AdvanceTo ( seq . AsReadOnlySequence . GetPosition ( 2 ) ) ;
54
+ seq . Reset ( ) ;
55
+ }
56
+
48
57
[ Fact ]
49
58
public void MemoryPool_ReleasesReferenceOnRecycle ( )
50
59
{
Original file line number Diff line number Diff line change @@ -396,7 +396,7 @@ internal void Assign(T[] array)
396
396
/// </summary>
397
397
internal void ResetMemory ( ArrayPool < T > ? arrayPool )
398
398
{
399
- this . ClearReferences ( this . Start , this . End ) ;
399
+ this . ClearReferences ( this . Start , this . End - this . Start ) ;
400
400
this . Memory = default ;
401
401
this . Next = null ;
402
402
this . RunningIndex = 0 ;
You can’t perform that action at this time.
0 commit comments