This error was happened in my Asp.net c# project ,specifically in a for loop iterating through the contents in a list .
My code something like this :
foreach (RequestContent content in Contents)
{
do something
}
I googled for this type of error and finally got a solution .
I changed the code to :
foreach (RequestContent content in Contents.ToList()){
do something
}
and it worked fine.
The issue was that Contents was getting modified inside the loop. Calling Contents.ToList() copies the values of Contents to a seperate list at the start of the loop .No one can access this list . so nothing can modify it inside the loop and it worked perfectly .