question

pcatroppa avatar image
pcatroppa asked

Unity - Getting NullReferenceException in SimpleJson.cs 1467 ONLY in Windows (build and run)

So we created a simple leaderboard for our game and are able to post stats in Android and in Windows Play-in-Editor BUT not when we "Build and Run" for Windows standalone exe.

Only on the windows build does it fail on the first call to LoginWithCustomID (or LoginWithEmail)

Here is the log:

NullReferenceException: Object reference not set to an instance of an object
  at PlayFab.Json.PocoJsonSerializerStrategy.DeserializeObject (System.Object value, System.Type type) [0x004be] in C:\dev\zekes-peak-game\Assets\PlayFabSdk\Shared\Internal\SimpleJson.cs:1467 
  at PlayFab.Json.SimpleJsonInstance+PlayFabSimpleJsonCuztomization.DeserializeObject (System.Object value, System.Type type) [0x00010] in C:\dev\zekes-peak-game\Assets\PlayFabSdk\Shared\Internal\ISerializer.cs:68 
  at PlayFab.Json.PlayFabSimpleJson.DeserializeObject (System.String json, System.Type type, PlayFab.Json.IJsonSerializerStrategy jsonSerializerStrategy) [0x0002e] in C:\dev\zekes-peak-game\Assets\PlayFabSdk\Shared\Internal\SimpleJson.cs:604 
  at PlayFab.Json.PlayFabSimpleJson.DeserializeObject[T] (System.String json, PlayFab.Json.IJsonSerializerStrategy jsonSerializerStrategy) [0x00001] in C:\dev\zekes-peak-game\Assets\PlayFabSdk\Shared\Internal\SimpleJson.cs:609 
  at PlayFab.Json.SimpleJsonInstance.DeserializeObject[T] (System.String json) [0x00001] in C:\dev\zekes-peak-game\Assets\PlayFabSdk\Shared\Internal\ISerializer.cs:129 
  at PlayFab.Internal.PlayFabUnityHttp.OnResponse (System.String response, PlayFab.Internal.CallRequestContainer reqContainer) [0x0000e] in C:\dev\zekes-peak-game\Assets\PlayFabSdk\Shared\Internal\PlayFabHttp\PlayFabUnityHttp.cs:223 
UnityEngine.DebugLogHandler:Internal_LogException()
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
PlayFab.Internal.PlayFabUnityHttp:OnResponse(String, CallRequestContainer) (at C:\dev\zekes-peak-game\Assets\PlayFabSdk\Shared\Internal\PlayFabHttp\PlayFabUnityHttp.cs:268)
PlayFab.Internal.<Post>d__20:MoveNext() (at C:\dev\zekes-peak-game\Assets\PlayFabSdk\Shared\Internal\PlayFabHttp\PlayFabUnityHttp.cs:191)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
 
(Filename: C:/dev/zekes-peak-game/Assets/PlayFabSdk/Shared/Internal/SimpleJson.cs Line: 1467)

We were able to debug and it does seem like the post is going through but not deserializing even though the response from the server is 200 OK.

"{\"code\":200,\"status\":\"OK\",\"data\":{\"SessionTicket\":...

Please let me know if we missed something for the Unity Windows stand alone.

Using the latest SDK 2.62.190304.

2 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.

Andy avatar image Andy ♦♦ commented ·

What version of Unity are you using?

0 Likes 0 ·
pcatroppa avatar image pcatroppa commented ·

Hi Andy, I have tried using Unity 2018.3.7f1 and Unity 2018.3.2f1 (with the same result for both).

0 Likes 0 ·
pcatroppa avatar image
pcatroppa answered

Finally figured it out. We had our "Managed Stripping Level" set to High in "Player Settings...". It only works if this value is set to Low or Disabled.

Unity was probably discarding/merging one of the two SimpleJson.cs files or something along those lines.


1 comment
10 |1200

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

Akash avatar image Akash commented ·

This saved me from so much hassle...thank you so very much :D

Honestly, by myself I would have never been able to solve this.

,

Thank you so much for this, it saved me from so much hassle...made my day...thank you :D

0 Likes 0 ·
Maor Cohen avatar image
Maor Cohen answered

If you'd like to keep the highest stripping level you can follow this solution: https://community.playfab.com/answers/67984/view.html

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.