Rapidjson reads all integer types as doubles

Version: 1.0.72.0

Frequency: Consistently

Severity: Blocker

Context: Top Mach Studios F22 Raptor. On runway.

Similar MSFS 2020 issue: None

Bug description: When trying to read integers of any type with rapidjson, it reports them as doubles, breaking all code that asks for integers. Code works as expected in MSFS 2020.

Repro steps: Create json data with integers and try to read back with rapidjson. You will see "Assertion failed: data_.f.flags & (kUint64Flag, kInt64Flag, kIntFlag, etc…) followed by the function call that caused the assertion.

Attachments:

May be issue with writing integers not reading them; In my addons reading from json with .GetInt64() is not causing an issue.

It is very odd behavior. You can see “uID” in the top line is the one being read. It’s clearly an integer. Yet when running it through the checks to find out what type of number it is, isDouble() returns true, and a double value is returned from GetDouble(), though information is lost in the last several digits of the number. GetInt(), GetUint(), GetInt64(), and GetUint64() all trigger the “Assertion failed” warning and crash the wasm module.

I’ll do some more testing with smaller numbers to see if maybe the issue is related to numbers larger than 32-bits.

It seems the uIds being reported for air traffic from Coherent can be numbers larger than unsigned 64-bit integers in MSFS 2024. If the number is out of range, it appears to be converted to a double and returned as that.

18446744073709552000 - uId included in original screenshot
18446744073709551615 - uint64_t max

(Edit)
All uId’s returned from Coherent.call('GET_AIR_TRAFFIC') appear the same, so it looks like they aren’t being reported in MSFS 2024 at all.

Hello @BadHatter

This has been fixed in version 1.1.10.0.

Regards,
Sylvain

1 Like