Enqueue error

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
520
Programming Experience
3-5
Somethime when i Enqueue a picturebox into a queue, it would give me this error about source array was not long enough. Why is that?
 
Can you be more specific? Can you show us the EXACT code and tell us the EXACT error message, as well as the type of the exception and the stack trace? We really shouldn't have to ask you not to provide vague approximations of error messages. It sounds like it might have something to do with resizing the queue's internal array but that should happen automatically without throwing an exception. What is the Count and Capacity at the time?
 
Its just a normal enqueue into a queue of picturebix type. _message="Source array was not long enough. Check srcindex and length, and the array's lower bounds." _hresult="-2147024809" there are still 3 items in the queue. It only happen sometime. Even the same hundred of picturebox with same image. Afterward it will leave the last slot empty.
It might be because the enqueue and dequeue are on different threads. Guess i need to lock it.
 
Last edited:
Back
Top