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則需要自己加入鎖機制