diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/CollectionsMarshal.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/CollectionsMarshal.cs index e3cecd684abf6a..95115864488f19 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/CollectionsMarshal.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/CollectionsMarshal.cs @@ -91,7 +91,11 @@ public static void SetCount(List list, int count) list._version++; - if (count > list.Capacity) + if (list.Capacity == 0) + { + list._items = new T[count]; + } + else if (count > list.Capacity) { list.Grow(count); }