Hi, nice library. Source code is a bit complex. Anyway, when calling the ToArray method on the HTMLOptionsCollection class it is using internally the CopyTo method, but his method is overridden and is calling ToArray again recursively. etc.. which leads to a stack overflow
I think a possible solution is to implement the CopyTo as follows:
_void ICollection.CopyTo(HTMLOptionElement[] array, int arrayIndex)
{
if (array == null)
throw new ArgumentNullException(nameof(array));
if (arrayIndex < 0)
throw new ArgumentOutOfRangeException(nameof(arrayIndex));
if (array.Length - arrayIndex < Count)
throw new ArgumentException("Not enough elements after arrayIndex in the destination array.");
for (int i = 0; i < Count; ++i)
array[i + arrayIndex] = this[i];
Hi, nice library. Source code is a bit complex. Anyway, when calling the ToArray method on the HTMLOptionsCollection class it is using internally the CopyTo method, but his method is overridden and is calling ToArray again recursively. etc.. which leads to a stack overflow
I think a possible solution is to implement the CopyTo as follows:
_void ICollection.CopyTo(HTMLOptionElement[] array, int arrayIndex)
{
if (array == null)
throw new ArgumentNullException(nameof(array));
if (arrayIndex < 0)
throw new ArgumentOutOfRangeException(nameof(arrayIndex));
if (array.Length - arrayIndex < Count)
throw new ArgumentException("Not enough elements after arrayIndex in the destination array.");
}_