1、问题描述:

项目多线程运用了Dictionary报错Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state

2、原因分析:

Dictionary被多个线程同时所修改导致的所措。

3、解决办法:

Dictionary换成ConCurrentDictionary。

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

相关文章:

  • 2022-01-13
  • 2022-02-21
  • 2021-10-26
  • 2021-09-17
  • 2021-12-06
  • 2022-12-23
  • 2021-09-04
  • 2022-12-23
猜你喜欢
  • 2021-06-24
  • 2022-02-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
  • 2022-12-23
相关资源
相似解决方案