Q:

Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection’s state is no longer correct

A:

2、原因分析:
Dictionary被多个线程同时所修改导致的所措。

3、解决办法:
Dictionary换成ConCurrentDictionary。

ConCurrentDictionary内部实现了锁机制。不会报以上错误。如果要用Dictionary则需要自己加入锁机制

文档更新时间: 2022-12-02 14:15   作者:admin