Modified ArrayPool.Shared.Rent(count) to allocate a minimum buffer size of 16, because at this point the value of count is 0, which unintentionally creates an empty array.
The doubling of the buffer should be done in the branch whose index has reached the end of the buffer, as well as the deallocation.