Fix a bug when setting capacity to 0 on MemoryStream causes crash on ToArray call