有时候,当运行Mono .NET应用程序时(似乎与输入数据无关,因为它不会改变),我会遇到以下情况:当尝试从一个非空队列中Dequeue元素时(我先检查其Count),会抛出异常:
Unhandled Exception: System.InvalidOperationException: Operation is not valid due to the current state of the object at System.Collections.Generic.Queue
虽然我肯定可以捕获这个异常,但是元素已经被Dequeue并且丢失了。是否还有其他人遇到过这种行为?
Unhandled Exception: System.InvalidOperationException: Operation is not valid due to the current state of the object at System.Collections.Generic.Queue
1[DBWorkItem].Peek ()[0x00000]
at System.Collections.Generic.Queue
1[DBWorkItem].Dequeue () [0x00000]
at DBProcessor.process (System.Object q) [0x0006b] in <...>虽然我肯定可以捕获这个异常,但是元素已经被Dequeue并且丢失了。是否还有其他人遇到过这种行为?