Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by tufanuyguner · Sep 29, 2021 at 09:01 AM · sdkssupport

PlayFab JSON Deserializer breaks on WebGL

Hello, I'm having trouble getting WebGL builds to work. It throws NullRef after LoginWithCustomID request, this never happens in Editor.

This is the error I'm getting:

NullReferenceException: Object reference not set to an instance of an object.
  at PlayFab.Json.PocoJsonSerializerStrategy.DeserializeObject (System.Object value, System.Type type) [0x00000] in <00000000000000000000000000000000>:0 
  at PlayFab.Json.SimpleJsonInstance+PlayFabSimpleJsonCuztomization.DeserializeObject (System.Object value, System.Type type) [0x00000] in <00000000000000000000000000000000>:0 
  at PlayFab.Json.PlayFabSimpleJson.DeserializeObject (System.String json, System.Type type, PlayFab.Json.IJsonSerializerStrategy jsonSerializerStrategy) [0x00000] in <00000000000000000000000000000000>:0 
  at PlayFab.Json.PlayFabSimpleJson.DeserializeObject[T] (System.String json, PlayFab.Json.IJsonSerializerStrategy jsonSerializerStrategy) [0x00000] in <00000000000000000000000000000000>:0 
  at PlayFab.Json.SimpleJsonInstance.DeserializeObject[T] (System.String json) [0x00000] in <00000000000000000000000000000000>:0 
  at PlayFab.Internal.PlayFabUnityHttp.OnResponse (System.String response, PlayFab.Internal.CallRequestContainer reqContainer) [0x00000] in <00000000000000000000000000000000>:0 
  at PlayFab.Internal.PlayFabUnityHttp+<Post>d__12.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0 
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
PlayFab.Internal.PlayFabUnityHttp:OnResponse(String, CallRequestContainer)
PlayFab.Internal.<Post>d__12:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
(Filename: currently not available on il2cpp Line: -1)

This is the API response

. playfabapi.com/Client/LoginWithCustomID?sdk=UnitySDK-2.113.210830 Response:

{"code":200,"status":"OK","data":{"SessionTicket":"E04D539DD8494332--A22A7CAE63D64F6B-18AC3-8D98325FACBD8DF-EWWAGcSyR53S1LL+jCABjN77KCvGwzobizxFuWSevDg=","PlayFabId":"E04D539DD8494332","NewlyCreated":true,"SettingsForUser":{"NeedsAttribution":false,"GatherDeviceInfo":true,"GatherFocusInfo":true},"EntityToken":{"EntityToken":"NHxGUDIycHFHZTlYSG1sbzhCVTVjOWxTYUdNYWROUktjM2hXTUFxdmpoUjI0PXx7ImkiOiIyMDIxLTA5LTI5VDA4OjQ4OjU5LjQzMjc3NzVaIiwiaWRwIjoiQ3VzdG9tIiwiZSI6IjIwMjEtMDktMzBUMDg6NDg6NTkuNDMyNzc3NVoiLCJpZGkiOiJjZjIwYTA0Ny1iMWU3LTRjNmYtYWVmYi01ZTZiMGIwYTBmNWUiLCJoIjoiREQxQjI0QzMzM0Q5NDBEQiIsImVjIjoidGl0bGVfcGxheWVyX2FjY291bnQhRUI4N0ZBMENEOTdENTEwNi8xOEFDMy9FMDRENTM5REQ4NDk0MzMyL0NCNjUwRUQ3NkYzM0M1REMvIiwiZWkiOiJDQjY1MEVENzZGMzNDNURDIiwiZXQiOiJ0aXRsZV9wbGF5ZXJfYWNjb3VudCJ9","TokenExpiration":"2021-09-30T08:48:59.432Z","Entity":{"Id":"CB650ED76F33C5DC","Type":"title_player_account","TypeString":"title_player_account"}},"TreatmentAssignment":{"Variants":[],"Variables":[]}}}
Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by Gosen Gao · Sep 30, 2021 at 09:43 AM

First, the PlayFabSimpleJson has been replaced by PlayFab.PluginManager.GetPlugin<ISerializerPlugin>(PluginContract.PlayFab_Serializer), you may try it to see if this issue still happens. For more information, please refer to https://community.playfab.com/questions/24205/json-parsing-issues.html.

“Object reference not set to an instance of an object” is a general error which is often caused by something missing. I can’t reproduce this issue, can you figure out in which step does this error occur?

Comment
tufanuyguner

People who like this

1 Show 4 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image tufanuyguner · Sep 30, 2021 at 11:49 AM 0
Share

Hi, I haven't changed the default serializer plugin, but PlayFab.PluginManager.GetPlugin<ISerializerPlugin>(PluginContract.PlayFab_Serializer) returns SimpleJson

plugin = this.CreatePlugin<PlayFab.Json.SimpleJsonInstance>();

It only happens in Windows and WebGL builds and never in editor. It might be happening in other builds as well but I haven't tried them yet. Both IL and Mono backends has this issue.

Here's the line that throws the null reference:

Assets\PlayFabSDK\Shared\Internal\SimpleJson.cs:1468

and here's what I do to get the NullReference

PlayFabClientAPI.LoginWithCustomID(new LoginWithCustomIDRequest { CreateAccount = true, CustomId = Guid.NewGuid().ToString() },OnLoginSuccess, OnPlayFabError);
avatar image Gosen Gao tufanuyguner · Oct 01, 2021 at 06:03 AM 0
Share

I didn’t see anything about SimpleJson in your LoginWithCustomID call. So I can’t reproduce this issue. Would you mind providing us some detailed code on how and where you are using SimpleJson for further research?

avatar image tufanuyguner Gosen Gao · Oct 01, 2021 at 11:32 AM 0
Share

I'm not using PlayFab's JSON stuff anywhere, PlayFab uses it internally to deserialize API responses.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    8 People are following this question.

    avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

    Related Questions

    Time limited store 1 Answer

    [UE4] Crossplatform SDK compile errors 2 Answers

    Steam Login (Wrong AppID or Publisher ID)? 1 Answer

    How can i signin with google play and playfab,How can I sign in with the new google play plugin. 1 Answer

    KeyNotFoundException: The given key was not present in the dictionary. 2 Answers

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges