I think that the exception is caused by threading issues.
Maybe you can use a mutex, or a ConcurentQueue, or a queue returned by Queue.Synchronized(myQueue).
Also see the remark about the enumerators:
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have been chasing a strange occasional IndexOutOfRangeException for a while and pinned it on the following line:
myQueue.Enqueue(myObject)
where:
protected Queue<MyObject> myQueue{ get; set; }
I don't know how this is possible. The stack trace:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
Stack Trace:
at Internal.Runtime.CompilerHelpers.ThrowHelpers.ThrowIndexOutOfRangeException() + 0x25
at ClassLibraryFoo.NVT.DecoderWin.<MethodFoo>d__38.MoveNext() + 0x46f
Could anyone shed some light on this?
I think that the exception is caused by threading issues.
Maybe you can use a mutex, or a ConcurentQueue, or a queue returned by Queue.Synchronized(myQueue).
Also see the remark about the enumerators: