Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with NetServer.SendToAll() #122

Open
cclogg opened this issue Apr 6, 2019 · 0 comments
Open

Crash with NetServer.SendToAll() #122

cclogg opened this issue Apr 6, 2019 · 0 comments

Comments

@cclogg
Copy link

cclogg commented Apr 6, 2019

This has been a fairly rare occurrence, but we had a few crashes that looked like this:

System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at System.Collections.Generic.List`1.Enumerator.MoveNext()
   at Lidgren.Network.NetPeer.SendMessage(NetOutgoingMessage msg, IList`1 recipients, NetDeliveryMethod method, Int32 sequenceChannel)
   at Lidgren.Network.NetServer.SendToAll(NetOutgoingMessage msg, NetDeliveryMethod method)

It seems like the SendToAll method is enumerating all connections, but perhaps in the off chance that someone connects during that brief moment, this crash will happen. Side note: most of my code uses the SendMessage(NetOutgoingMessage msg, NetConnection recipient, NetDeliveryMethod method) method, and that one has never crashed thus far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant