babelshift/SteamWebAPI2

Achievement.DefaultValue throws JsonReaderException for large values

ckuepker opened this issue · 5 comments

Hi,

I stumbled upon a problem when trying to load achievements for a game using ISteamUserStats.GetSchemaForGameAsync(appid). Problem is that some games, e.g. CSS (240), CS GO (730) and Stanley Parable (221910), each have achievements with default values which exceed the int32 range: 4294967295

From what I can see I think that the property SchemaGameAchievement.DefaultValue should be int64 instead of int.

To reproduce simply call GetSchemaForGameAsync for any of the App IDs given above.

Exception:
System.AggregateException : Mindestens ein Fehler ist aufgetreten.
----> Newtonsoft.Json.JsonReaderException : JSON integer 4294967295 is too large or small for an Int32. Path 'game.availableGameStats.stats[0].defaultvalue', line 1, position 148.

I believe this should actually be a uint rather than a long. I made an effort last year to migrate all models to use the unsigned data types because the Steam Web API seems to work based on those.

For this specific case, 4294967295 is actually UInt32.MaxValue.

Oh, yes you are right about the unsigned range including the problematic value. In the PR I "upgraded" to long because the original data type was signed.

I tried it with uint as well and it also fixes the initial problem. I noticed however, that any of the changes causes some errors on the same interface for games which previously worked. Somehow the auto mapping fails. But that is a technology I know nothing about. Let me know if you'd like to have further details.

Thanks. I'll take a look.

Should be fixed on the newest nuget package release (4.0.7).