"Collection was modified exception" in InProcessMessageBus.WaitForMessages #537

samueldjack opened this Issue Jul 18, 2012 · 2 comments

3 participants


I'm seeing a sporadic "Collection was modified" exception when enumerating the eventKeys enumerable in InProcessMessageBus.WaitForMessages.

The simple fix is to do

var eventKeysList = eventKeys.ToList();

at the top of the method, then use eventKeysList in place of eventKeys.


I also get this error a lot, and the fix mentioned above works.

This is also related: #388


Note that I was also having other issues, with my clients not receiving some messages issued by the server (it was very random).

After applying this fix, all messages now arrive properly at clients.

@davidfowl davidfowl was assigned Jul 24, 2012
@davidfowl davidfowl closed this Jul 24, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment