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

byte[] array access is not supported in LINQ

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Linq, LINQ3
    • None

      The following code:

      class A
      {
          public byte[] ByteArray {get; set;}
      }
      collection.AsQueryable().Where(o => o.ByteArray[0] == 1).ToCursor();

      Fails with
      LINQ2: 

      System.InvalidOperationException: 'Convert({document}.ByteArray[0], Int32) is not supported.'

      LINQ3:

      System.InvalidOperationException: MongoDB.Bson.Serialization.Serializers.ByteArraySerializer must implement IBsonArraySerializer to be used with LINQ.

      Other integer types work as expected.

            Assignee:
            Unassigned Unassigned
            Reporter:
            boris.dogadov@mongodb.com Boris Dogadov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: