question

simonl avatar image
simonl asked

FormatException on Network reconnect,FormatException spam after a reconnect

Hi,

We're using Playfab on Windows 10 for multiplayer and using an xbox live token to sign in.

We are able to successfully get two players into a network for the first time. One player calls CreateAndJoinNetwork() and the other uses JoinNetwork(string networkId). Once we've disconnected them both call LeaveNetwork successfully. The problem then arrises when we attempt to re-connect them. The host is able to create a Network without any issues but when the client calls JoinNetwork we receive hundereds of errors inside the Playfab SDK on both host and client. The exception is:

FormatException: Input string was not in a correct format.
  at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x00057] in <fb001e01371b4adca20013e0ac763896>:0 
  at System.Number.ParseUInt64 (System.String value, System.Globalization.NumberStyles options, System.Globalization.NumberFormatInfo numfmt) [0x00014] in <fb001e01371b4adca20013e0ac763896>:0 
  at System.UInt64.Parse (System.String s, System.IFormatProvider provider) [0x00008] in <fb001e01371b4adca20013e0ac763896>:0 
  at System.Convert.ToUInt64 (System.String value) [0x0000c] in <fb001e01371b4adca20013e0ac763896>:0 
  at PlayFab.Party._Internal.PlayFabChatXboxLivePolicyProvider.GetPlayerByXuid (System.UInt64 xuid) [0x0001f] in C:\Repositories\PhogsProjects\Phogs\Assets\Plugins\Playfab\PlayFabPartySDK\Source\Scripts\PartyUnitySDK\PlayFabChatXboxLivePolicyProvider.cs:556 
  at PlayFab.Party._Internal.PlayFabChatXboxLivePolicyProvider.IsReadyToSetChatPermissions (PartyXBLCSharpSDK.PARTY_XBL_CHAT_USER_HANDLE localXblChatUser, PartyXBLCSharpSDK.PARTY_XBL_CHAT_USER_HANDLE targetXblChatUser) [0x0003b] in C:\Repositories\PhogsProjects\Phogs\Assets\Plugins\Playfab\PlayFabPartySDK\Source\Scripts\PartyUnitySDK\PlayFabChatXboxLivePolicyProvider.cs:409 
  at PlayFab.Party._Internal.PlayFabChatXboxLivePolicyProvider.ProcessQueuedOperations () [0x00001] in C:\Repositories\PhogsProjects\Phogs\Assets\Plugins\Playfab\PlayFabPartySDK\Source\Scripts\PartyUnitySDK\PlayFabChatXboxLivePolicyProvider.cs:268 
  at PlayFab.Party.PlayFabMultiplayerManager.ProcessQueuedOperations () [0x000c2] in C:\Repositories\PhogsProjects\Phogs\Assets\Plugins\Playfab\PlayFabPartySDK\Source\Scripts\PartyUnitySDK\PlayFabMultiplayerManager.cs:767 
  at PlayFab.Party.PlayFabMultiplayerManager.Update () [0x00012] in C:\Repositories\PhogsProjects\Phogs\Assets\Plugins\Playfab\PlayFabPartySDK\Source\Scripts\PartyUnitySDK\PlayFabMultiplayerManager.cs:144 


So far all I've figured out is that the _platformSpecificUserId inside PlayfabPlayer is mapped to the Xbox Live XUID of our players during the first play session but when they reconnect it's set to the same value as EntityKey.ID but I can't figure out why.

Any help would be greatly appreciated.

Thanks,

Si

multiplayer
10 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Citrus Yan avatar image Citrus Yan commented ·

May I know the SDK you're using along with its version?

0 Likes 0 ·
simonl avatar image simonl commented ·

Hi @Citrus Yan,

We're using Playfab Party version: https://github.com/PlayFab/PlayFabPartyUnity/releases/tag/1.5.0.1-main.0

And Playfab SDK Version: 2.97.201014.

Thanks

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan simonl commented ·

Cool, we will try to reproduce this issue from our side and keep you updated.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan simonl commented ·

Actually, it would be helpful if you can provide the code snippet you were using, along with the brief steps to reproduce the issue. Do you mind sharing that?

0 Likes 0 ·
simonl avatar image simonl Citrus Yan commented ·

Hi Citrus,

Sorry for the delay. I will put together a small sample project for you tomorrow and send that across (I'm based in the UK).

I will make sure I include a readme with some reproduction steps as well.

0 Likes 0 ·
Show more comments
Show more comments

1 Answer

·
Bob Cowburn avatar image
Bob Cowburn answered

I have exactly the same problem. Using the same SDKs as yourself. My fix was to put protection on the line that causes the exception.

private PlayFabPlayer GetPlayerByXuid(ulong xuid)
        {
            PlayFabPlayer player = null;
            foreach (PlayFabPlayer currentPlayer in _multiplayerManager.RemotePlayers)
            {
                ulong currentPlayerXuid = 0;    

                if (!string.IsNullOrEmpty(currentPlayer._platformSpecificUserId))  <--- ***Fixed here***
                    currentPlayerXuid = Convert.ToUInt64(currentPlayer._platformSpecificUserId);
 
                if (currentPlayerXuid != 0 &&
                    xuid != 0 &&
                    currentPlayerXuid == xuid)
                {
                    player = currentPlayer;
                    break;
                }
            }

            return player;

        }<br>

After doing this, I have found other errors that occur. Can provide you with details, you may experience the same yourself.

The fix is not ideal, but it prevents the constant error logging and allows you to progress a little.

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bob Cowburn avatar image Bob Cowburn commented ·

It's possible you may be experiencing this problem also. It could be related to the issue (of course I'm only guessing about this). The exception only fires once, with apparently benign effects, its easy to miss in the log.


https://community.playfab.com/questions/46355/exception-thrown-in-party-create-new-network-compl.html

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Bob Cowburn commented ·

Thanks for sharing your insights with us!

0 Likes 0 ·
simonl avatar image simonl commented ·

Hi Bob,

Thank you for your reply!

When I put the above fix in I start receiving the following repeated errors (Truncated for character limit):

[GamepassLobby] Playfab Network Error. Type Error. Code: 20481. Message a user with this Xbox Live user id already exists.
Lobby:OnError(Object, PlayFabMultiplayerManagerErrorArgs) (at C:\Repositories\Playfab\Playfab\Assets\Scripts\Lobby.cs:86)
PlayFab.Party.PlayFabMultiplayerManager:_LogError(UInt32, PlayFabMultiplayerManagerErrorType) (at C:\Repositories\Playfab\Playfab\Assets\PlayFabPartySDK\Source\Scripts\PartyUnitySDK\PlayFabMultiplayerManager.cs:475)

a user with this Xbox Live user id already exists
PlayFab.Party.PlayFabMultiplayerManager:_LogError(String) (at C:\Repositories\Playfab\Playfab\Assets\PlayFabPartySDK\Source\Scripts\PartyUnitySDK\PlayFabMultiplayerManager.cs:450)
PlayFab.Party.PlayFabMultiplayerManager:_LogError(UInt32, PlayFabMultiplayerManagerErrorType) (at C:\Repositories\Playfab\Playfab\Assets\PlayFabPartySDK\Source\Scripts\PartyUnitySDK\PlayFabMultiplayerManager.cs:478)

Are these the same errors you see?

0 Likes 0 ·
Bob Cowburn avatar image Bob Cowburn simonl commented ·

Yes, same problem. I had a brief look at why, it's related to the same issue, i.e. the empty string '_platformSpecificUserId ', and the fix to prevent the exception.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.