XNA Creators Club Online
Page 1 of 1 (10 items)
Sort Posts: Previous Next

Exception in NetworkSession update

Last post 12/16/2009 4:47 PM by Adam and Perusse. 9 replies.
  • 8/12/2009 2:30 AM

    Exception in NetworkSession update

    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:
    1. Create a new Live session with only one local gamer signed-in.
    2. Have a remote gamer join your game with a guest (he should already have a guest signed in before joining your session).
    3. Have the remote gamer leave the session.
    4. 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.
  • 8/12/2009 5:18 PM In reply to

    Re: Exception in NetworkSession update

    This doesn't ring any bells with me, sorry. Please do file it on Connect.
    XNA Framework Developer - blog - homepage
  • 8/12/2009 6:31 PM In reply to

    Re: Exception in NetworkSession update

    Thanks,

    Here's the link to the issue in Connect, if anyone ever has the issue as well.


    Hot Potato Online : Available now! Developer profits go for Child's Play.
  • 10/6/2009 4:38 AM In reply to

    Re: Exception in NetworkSession update

    Any updates to this issue? The workaround posted on the Connect website doesn't work, since the session has no knowledge of the missing gamer(s) and therefore cannot remove the associated machine (throws an "Operation is not valid due to the current state of the object" exception).
  • 10/28/2009 2:46 PM In reply to

    Re: Exception in NetworkSession update

    Got the same error on a game session we had Monday when a player with two guests left after around an hour playing with no issues. Seems like it doesn't happen too often though.
  • 12/16/2009 3:15 AM In reply to

    Re: Exception in NetworkSession update

    Adam and Perusse:
    Thanks,

    Here's the link to the issue in Connect, if anyone ever has the issue as well.



    I looked at the connect issue, and it has a work-around. Only problem is I don't see how to do it. The work-around involves manually finding the gamer that's no longer valid and removing it from the session... but how do you remove a gamer from NetworkSession.AllGamers if it's a read only collection?

    At the moment my game has to exit the session and return to the title screen when this exception is encountered, and it's really not pretty!
    Creed Arena is on XBOX Live Indie Games. Fight other gladiators in a futuristic arena. Check it out now!

    Finally, a chat site for XNA devs. Kick back and chat with fellow Creator's Club members on XNA Chat!
  • 12/16/2009 3:19 AM In reply to

    Re: Exception in NetworkSession update

    The workaround doesn't, well, work since the ID is no longer valid like you said.
  • 12/16/2009 10:14 AM In reply to

    Re: Exception in NetworkSession update

    Hmm. Surely the guy who posted it would have checked that the solution works first? Maybe he just didn't explain it very well...
    Creed Arena is on XBOX Live Indie Games. Fight other gladiators in a futuristic arena. Check it out now!

    Finally, a chat site for XNA devs. Kick back and chat with fellow Creator's Club members on XNA Chat!
  • 12/16/2009 4:21 PM In reply to

    Re: Exception in NetworkSession update

    I don't know. I spent several hours on just this problem, and I simply could not come up with a solution to save the current session. Once that local player goes into limbo, the session no longer recognizes the id or remote machine in any way and throws an exception on every update. If there really is a way to recover from this, I would love to know.
  • 12/16/2009 4:47 PM In reply to

    Re: Exception in NetworkSession update

    Same for me when I entered the issue. I ended up simply terminating the network session once I get the exception, with a user message saying that there was a network disconnection. It's weird for a host, but it's the only solution I could find. I don't know the guy who entered the workaround. Let's hope he can give more info here.
    Hot Potato Online : Available now! Developer profits go for Child's Play.
Page 1 of 1 (10 items) Previous Next