Problems with Queue<T>

I am bewildered by this one. I often get:

4cf89aec-3a56-4d09-82f7-846146ff387a:3479 ArgumentException: Destination array was not long enough. Check destIndex and length, and the array’s lower bounds
at System.Array.Copy (System.Array sourceArray, System.Int32 sourceIndex, System.Array destinationArray, System.Int32 destinationIndex, System.Int32 length) [0x00000] in <00000000000000000000000000000000>:0
at System.Collections.Generic.Queue1[T].SetCapacity (System.Int32 capacity) [0x00000] in <00000000000000000000000000000000>:0 at System.Collections.Generic.Queue1[T].Enqueue (T item) [0x00000] in <00000000000000000000000000000000>:0
at Svelto.DataStructures.ThreadSafeQueue`1[T].Enqueue (T item) [0x00000] in <00000000000000000000000000000000>:0

seems like the Queue implementation is wrong somehow? Any clue one this one?

it’s not a Queue related problem, it’s something to do with system.Array itself instead.

Unity’s WebGL runs on one thread.
So threads related stuff shouldn’t work.
As far as I know, even the experimental threads support, is only for internal engine threads, and not for using the System.Threading classes

The application is single threaded. I write the ThreadSafeQueue and it uses a normal Queue inside. However the Queue is not the problem, I noticed the exceptions happen a few times (3 in my case) and then it stops and it happens on different data structures using Array.Copy or Array.Resize.