I got this error a couple times last night, and I’m not too sure what to say about it -
Looking over the loops in ProcessInternalMessages, it seems like this error should never happen. So why would it?
Including the LocalClient.ProcessInternalMessages code -
private void ProcessInternalMessages()
{
if (m_InternalMsgs.Count == 0)
{
return;
}
// new msgs will get put in m_InternalMsgs2
List<InternalMsg> tmp = m_InternalMsgs;
m_InternalMsgs = m_InternalMsgs2;
// iterate through existing set
foreach (var msg in tmp)
{
if (s_InternalMessage.reader == null)
{
s_InternalMessage.reader = new NetworkReader(msg.buffer);
}
else
{
s_InternalMessage.reader.Replace(msg.buffer);
}
s_InternalMessage.reader.ReadInt16(); //size
s_InternalMessage.channelId = msg.channelId;
s_InternalMessage.conn = connection;
s_InternalMessage.msgType = s_InternalMessage.reader.ReadInt16();
m_Connection.InvokeHandler(s_InternalMessage);
m_FreeMessages.Push(msg);
connection.lastMessageTime = Time.time;
}
// put m_InternalMsgs back and clear it
m_InternalMsgs = tmp;
m_InternalMsgs.Clear();
// add any newly generated msgs in m_InternalMsgs2 and clear it
foreach (var msg in m_InternalMsgs2)
{
m_InternalMsgs.Add(msg);
}
m_InternalMsgs2.Clear();
}
I’d guess one of those foreach loops is messing up…probably the first one. Looking at this a bit deeper, it seems like this function is only really called by UNetStaticUpdate so I’m not totally sure how this could be breaking.