question

Patrick avatar image
Patrick asked

PlayFab Login fails sometimes because LoginResult can not be deserialized

We found an odd behavior of PlayFabSimpleJsonCustomization - it will just use Enum.Parse instead of TryParse and thus fail when the playfab server returns a value that is not known to the playfab client - in our case an enum value "Unknown" is not found - however due to the behaviour of the serialization we cannot see the enum that is missing the value.

In general I think this behavior needs to be fixed on the client side - specifically the PlayFabSimpleJsonCuztomization should never throw and instead in the "worst-case" return an error for the caller

The full error stack trace is as follows: System.Enum+EnumResult.SetFailure (System.Enum+ParseFailureKind failure, System.String failureMessageID, System.Object failureMessageFormatArgument) (at :0) System.Enum.TryParseEnum (System.Type enumType, System.String value, System.Boolean ignoreCase, System.Enum+EnumResult& parseResult) (at :0) System.Enum.Parse (System.Type enumType, System.String value, System.Boolean ignoreCase) (at :0) PlayFab.Json.SimpleJsonInstance+PlayFabSimpleJsonCuztomization.DeserializeObject (System.Object value, System.Type type) (at :0) PlayFab.Json.SimpleJsonInstance+PlayFabSimpleJsonCuztomization.DeserializeObject (System.Object value, System.Type type) (at :0) PlayFab.Json.PocoJsonSerializerStrategy.DeserializeObject (System.Object value, System.Type type) (at :0) PlayFab.Json.SimpleJsonInstance+PlayFabSimpleJsonCuztomization.DeserializeObject (System.Object value, System.Type type) (at :0) PlayFab.Json.PocoJsonSerializerStrategy.DeserializeObject (System.Object value, System.Type type) (at :0) PlayFab.Json.SimpleJsonInstance+PlayFabSimpleJsonCuztomization.DeserializeObject (System.Object value, System.Type type) (at :0) PlayFab.Json.PocoJsonSerializerStrategy.DeserializeObject (System.Object value, System.Type type) (at :0) PlayFab.Json.SimpleJsonInstance+PlayFabSimpleJsonCuztomization.DeserializeObject (System.Object value, System.Type type) (at :0) PlayFab.Json.PocoJsonSerializerStrategy.DeserializeObject (System.Object value, System.Type type) (at :0) PlayFab.Json.SimpleJsonInstance+PlayFabSimpleJsonCuztomization.DeserializeObject (System.Object value, System.Type type) (at :0) PlayFab.Json.PocoJsonSerializerStrategy.DeserializeObject (System.Object value, System.Type type) (at :0) PlayFab.Json.SimpleJsonInstance+PlayFabSimpleJsonCuztomization.DeserializeObject (System.Object value, System.Type type) (at :0) PlayFab.Json.PlayFabSimpleJson.DeserializeObject[T] (System.String json, PlayFab.Json.IJsonSerializerStrategy jsonSerializerStrategy) (at :0) PlayFab.Internal.PlayFabHttp+<>c__DisplayClass23_0`1[TResult].<MakeApiCall>b0 () (at :0) PlayFab.Internal.PlayFabUnityHttp.OnResponse (System.String response, PlayFab.Internal.CallRequestContainer reqContainer) (at :0) PlayFab.Internal.PlayFabUnityHttp+d12.MoveNext () (at :0) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at :0) PlayFab.Internal.PlayFabUnityHttp:OnResponse(String, CallRequestContainer) PlayFab.Internal.d_12:MoveNext() UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

apisunity3dsdks
10 |1200

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

1 Answer

·
Xiao Zha avatar image
Xiao Zha answered

You may call the login API with Postman to get raw data of API response and see if the unknown value is the country code.

10 |1200

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

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.