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()
4545 Assert . Throws < ArgumentOutOfRangeException > ( ( ) => seq . GetMemory ( - 1 ) ) ;
4646 }
4747
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+
4857 [ Fact ]
4958 public void MemoryPool_ReleasesReferenceOnRecycle ( )
5059 {
Original file line number Diff line number Diff line change @@ -396,7 +396,7 @@ internal void Assign(T[] array)
396396 /// </summary>
397397 internal void ResetMemory ( ArrayPool < T > ? arrayPool )
398398 {
399- this . ClearReferences ( this . Start , this . End ) ;
399+ this . ClearReferences ( this . Start , this . End - this . Start ) ;
400400 this . Memory = default ;
401401 this . Next = null ;
402402 this . RunningIndex = 0 ;
You can’t perform that action at this time.
0 commit comments