I'm currently doing multiple tests with my game and came upon an exception deep in the XNA networking code.
I can repro the error very easily and I was wondering if anyone else was able to repro this issue (or if Microsoft could confirm that it is a valid issue in the XNA framework). If anyone can confirm, I can add it to MS Connect.
My game supports having guests on each machine, this is important if you want to repro the exception. Those tests are done on Xbox through Xbox Live, using XNA GS 3.1.
Here are the repro steps:
- Create a new Live session with only one local gamer signed-in.
- Have a remote gamer join your game with a guest (he should already have a guest signed in before joining your session).
- Have the remote gamer leave the session.
- Repeat steps 2 and 3 with the same gamers.
I get the following crash after doing steps 2-3 about three times:
A first chance exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.dll
An unexpected error has occurred.
Here's the call stack:
Microsoft.Xna.Framework.GamerServices.GamerCollection`1.FindGamerWithInternalIndexAndRemove(Int32 index)
Microsoft.Xna.Framework.Net.NetworkSession.ProcessGamerLeft(Byte*& readData)
Microsoft.Xna.Framework.Net.NetworkSession.ProcessUpdateResults(Int32 outputDataSize)
Microsoft.Xna.Framework.Net.NetworkSession.Update()
...
I only get this error when the remote machine is joining with a guest. If the remote machine only has one player signed in, I don't get the crash.
This error is also unrecoverable. The next time you call NetworkSession.Update(), the call stack stops at "Microsoft.Xna.Framework.Net.NetworkSession.ProcessUpdateResults(Int32 outputDataSize)" with an InvalidOperationException.
The only way to recover is to Dispose the network session, which I'm doing in my game while giving the players an error message that the network session has ended.
Thanks,
Jean-François Pérusse
Hot Potato Online : Available now! Developer profits go for
Child's Play.