InvalidOperationException When calling ResourceManager.GetString

后端 未结 2 1650
再見小時候
再見小時候 2021-01-12 00:13

My application throw the exception occasionally:

Exception type: InvalidOperationException Exception message: Collection was modified; enumeration

2条回答
  •  心在旅途
    2021-01-12 00:30

    Actually InvalidOperationException Exception message: Collection was modified; enumeration operation may not execute means:

    We are changing the elements in the collection while looping over it with foreach.

    I think this should solve your problem.

    foreach (var func in list.ToList())
    {
    //Do your stuff
    }
    

提交回复
热议问题