question

warddehairs avatar image
warddehairs asked

UpdateUserData misinterpreting dictionary

I'm trying to use an azure function script to set user data like this

 Dictionary<string, string> initialData = new Dictionary<string, string>();
    
 initialData.Add("TechBoosters", "1FF");
 ...
 initialData.Add("TechGenerator", "000");
    
 await server.UpdateUserDataAsync(new PlayFab.ServerModels.UpdateUserDataRequest() {
     Data = initialData,
     Permission = PlayFab.ServerModels.UserDataPermission.Private,
     PlayFabId = Util.masterAccountId
 });

The problem is this seems to start failing as soon as I have 11 entries in this list, with the following error:

Invalid input parameters, System.Collections.Generic.Dictionary`2[System.String,System.String[]]

Interestingly it seems to think the value class in the dictionary is an array of strings in stead of a single string. I have no idea why this is happening, I tried splitting the call into chunks of 10 or even doing them one by one, but I just got the same error. If I just set the first 10 values it works fine. It's all just plain alphanumeric characters, so nothing strange going on with the inputs.

I'm using the user data here to store specific data about tech unlocks, I'm not sure if it's the correct approach for this kind of thing, so alternate suggestions are welcome.

Player Data
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

·
Infer Wang avatar image
Infer Wang answered

You can see the limits in Title settings. More than 10 entries will cause error. 6535-image.png


image.png (19.2 KiB)
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.

warddehairs avatar image warddehairs commented ·

It seems things were going wrong because I was using Dictionary.Clear() to split the request into chunks. This does not work, as entries added to the dictionary before the clear are still passed into the request. I'm just instantiating a new dictionary for each request now (new Dictionary()) which works fine.

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.