Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-5163

Translate fails when serializing different sized numbers

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.27.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Dotnet Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      When operating on two (or more?) numbers of different sizes (e.g. `int` vs. `long`; `byte` vs. `int`), this exception is thrown: "Expression not supported: 36000000000 in (Convert($it.Date.Hour, Int64) * 36000000000) because it was not possible to determine how to serialize the constant." 

      This is because the serializer passed into `MongoDB.Driver.Linq.Linq3Implementation.Misc.SerializationHelper.SerializeValue` is incorrect. In the example that produced the specific exception above, an `Int32Serializer` is used for the `long` 36000000000. 

      This was initially discovered when investigating ticket ODATA-21 but has been reproduced in unit tests independent of OData involving queries where the two different-sized types are operated on in some fashion.

            Assignee:
            jania.vandevoorde@mongodb.com Jania Vandevoorde (Inactive)
            Reporter:
            jania.vandevoorde@mongodb.com Jania Vandevoorde (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: