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

Support standard byte order when serializing Guids

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Minor Change

      Description

      Sadly, all existing C# drivers, including this official one, have been serializing Guids with the wrong byte order all along. This is because the byte array returned by Guid.ToByteArray returns an array where the first three groups (of 4, 2 and 2 bytes respectively) are reversed, as in little endian format.

      This is not a problem as long as only C# drivers are reading and writing the Guids. However, all other drivers are storing UUIDs with the standard byte order, so it becomes difficult to interoperate between the C# and other drivers when using Guids.

      This feature request is for a mechanism to allow C# applications to indicate when they would like Guids to be serialized using the standard byte order instead of Microsoft's internal byte order. For historical reasons everything will continue to default to Microsoft's byte order (so as not to break backward compatibility with existing code and data).

      There will be a new enum:

      public enum GuidByteOrder

      { Microsoft, Standard }

      To see all the changes involved in implementing this feature start by searching for occurrences of "GuidByteOrder" and follow the code changes from there (or look at the commit).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rstam Robert Stam
              Reporter:
              rstam Robert Stam
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: