© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
4 replies
koopa

Collection was modified enumeration operation may not execute

Hi - I am working on a client - server chat application for my school project. The server app has a list called "messageRecievedList" which received messages are appended to. Whenever this list is appended, the function UpdateMessageModification() is called to re print all the messages. However, it causes this problem at completely RANDOM times (I.e. I can send 40 messages from a client fine or sometimes it will only be 26 or something)
unknown.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Collection was modified. Enumeration operation may not execute.
C#CC# / help
15mo ago
✅ enumeration help
C#CC# / help
17mo ago
Modified collection (IsoDayOfWeek noda time enum) not being persisted upon SaveChanges
C#CC# / help
3y ago
Restart method with fresh list to iterate through without triggering 'collection was modified' error
C#CC# / help
4y ago