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

Enum conversion within IQueryable fails with Expression not supported exception

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: None
    • Component/s: LINQ3
    • Labels:
      None
    • Dotnet Drivers

      Summary

      My query includes a DTO conversion. As soon as this DTO contains an enum, which should also be converted from a source to a target type, the query fails with the exception ‘`Expression not supported’. We actually use Automapper for the conversion, but during the error analysis we were able to reproduce the behavior with the simplest enum conversion, a cast. The behavior occurs with the LinqProvider.V3, as soon as we switch to the LinqV2 provider, it works.

      It seems to me that the following requests in the community seem to have the same or at least a similar problem:

      https://www.mongodb.com/community/forums/t/conversion-from-nullable-enum-to-enum-fails-with-exception-for-linq3-provider/249557

      https://www.mongodb.com/community/forums/t/c-driver-linq3-convert-enuma-enumb-not-supported/267726

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            tobias.stieglmeier@baramundi.com Tobias Stieglmeier
            Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: