我试图将值排入队列,它工作正常.程序运行几个小时后,我收到以下错误
System.ArgumentException: length
at System.Array.Copy (System.Array sourceArray, System.Int32 sourceIndex, System.Array destinationArray, System.Int32 destinationIndex, System.Int32 length) [0x000c3] in <f56c876907e742b0aa586f051fcce845>:0
at System.Collections.Generic.Queue`1[T].SetCapacity (System.Int32 capacity) [0x0001e] in <ccafeb0e74bd436bb84e5138772c2bb0>:0
at System.Collections.Generic.Queue`1[T].Enqueue (T item) [0x0003e] in <ccafeb0e74bd436bb84e5138772c2bb0>:0
at VSCaptureMP.MPudpclient.ExportWaveToCSV () [0x0010a] in <f1c552d4f5b3424d9438ec1100580a9d>:0
at VSCaptureMP.MPudpclient.PollPacketDecoder (System.Byte[] packetbuffer, System.Int32 headersize) [0x00121] in <f1c552d4f5b3424d9438ec1100580a9d>:0
Run Code Online (Sandbox Code Playgroud)
我每隔一百毫秒排队一次,我有一个从队列中出队的任务.队列没有增加,其数量在250到500之间.可能是什么问题?我也尝试过ConcurrentQueue.然后该程序运行时间更长,但在12小时后它给出了以下异常:
at (wrapper alloc) System.Object.AllocVector(intptr,intptr)
at System.Collections.Concurrent.ConcurrentQueue1+Segment[T]..ctor (System.Int32 boundedLength) [0x00006] in <f56c876907e742b0aa586f051fcce845>:0
at System.Collections.Concurrent.ConcurrentQueue1[T].EnqueueSlow (T item) [0x00051] in <f56c876907e742b0aa586f051fcce845>:0
at System.Collections.Concurrent.ConcurrentQueue`1[T].Enqueue (T item) [0x00010] in <f56c876907e742b0aa586f051fcce845>:0
Run Code Online (Sandbox Code Playgroud) c# ×1