Skip to content
This repository has been archived by the owner on Feb 25, 2021. It is now read-only.

Commit

Permalink
Fix ArrayBuilder capacity expansion bug
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveSandersonMS committed Feb 16, 2018
1 parent b28232c commit 1f3fb3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Microsoft.AspNetCore.Blazor/RenderTree/ArrayBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public int Append(in T item)
{
if (_itemsInUse == _items.Length)
{
SetCapacity(_itemsInUse * 2, preserveContents: true);
SetCapacity(_items.Length * 2, preserveContents: true);
}

var indexOfAppendedItem = _itemsInUse++;
Expand All @@ -72,7 +72,7 @@ internal int Append(T[] source, int startIndex, int length)
var requiredCapacity = _itemsInUse + length;
if (_items.Length < requiredCapacity)
{
var candidateCapacity = _itemsInUse * 2;
var candidateCapacity = _items.Length * 2;
while (candidateCapacity < requiredCapacity)
{
candidateCapacity *= 2;
Expand Down

0 comments on commit 1f3fb3b

Please sign in to comment.