Skip to content

Incorrect display of message body containing large numbers #1804

Closed
@tamararivera

Description

@tamararivera

Symptoms

The message body of failed message is incorrectly displayed if it contains a value larger than JavaScript's Number.MAX_VALUE

Who's affected

All users of ServicePulse who have message bodies with large numbers in a message property

Root cause

JavaScript has a maximum value for numbers, and JSON can only represent numbers as a number type, not the more recently introduced bigint. Any number in a serialized message larger than number.MAX_VALUE will therefore be rounded to the nearest base order of magnitude value when deserialized to JSON.

### Describe the bug

Description

When attempting to view the message body of a failed message containing a large number in ServicePulse, the displayed number appears incorrect.
For instance, a JSON object like { "x": 10000000000000001 } is displayed as { "x": 10000000000000000 }. Moreover, upon editing and retrying the message with changes to unrelated values, the incorrectly displayed value for 'x' (ending in 0) persists.

This happens for any number bigger than Number.MAX_SAFE_INTEGER on javascript.

Expected behavior

The large number within the message body should be accurately displayed, without any alteration or truncation.

Actual behavior

The large number is displayed incorrectly, rounded down, leading to potential data misinterpretation.

Versions

All

Steps to reproduce

  1. Send a message containing a large number (e.g., { "x": 10000000000000001 }) through the system.
  2. Encounter a failure and attempt to view the message body in ServicePulse.

Relevant log output

No response

Additional information

  • The issue is likely related to the inherent limitations of double precision floating-point representation used by JavaScript/JSON for such large values.
  • Despite the display issue in ServicePulse, NServiceBus and C# are capable of handling the serialization and deserialization of these values without errors, which for us means the display issue is unintended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions