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

Parsing Enums as Strings is case-insensitive

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.13.2
    • Affects Version/s: None
    • Component/s: None
    • None

      When enums are stored as string, they were parsed back case-sensitive until v2.12. Since that update, this behaviour was changed which causes issues when multiple enum values have different capitalizations.

      Example:

      public enum MyEnum {
          AnEnumValue,
          anenumvalue
      }

      In this example, Mongo will parse the string representation to the same Enum value.

      In my opinion, this behavior should at least be configurable.

      References in Code:

      - src/MongoDB.Bson/Serialization/Serializers/EnumSerializer.cs (in v2.12, the parsing logic has changed by adding a boolean parameter to Enum.Parse())

            Assignee:
            dmitry.lukyanov@mongodb.com Dmitry Lukyanov (Inactive)
            Reporter:
            raphael.guntersweiler@rwe.com Raphael Guntersweiler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: