Nullable comparison throws ArgumentException - {"Unsupported filter

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Critical - P2
    • None
    • Affects Version/s: 2.2.3
    • Component/s: LINQ
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I have a class with 2 Nullable DateTime properties.
      The query that I'm trying to run is:

      Repository.GetAll().Where(_ => _.DateDelivered.HasValue && _.DateDue.HasValue && _.DateDelivered.Value == _.DateDue.Value);

      I'm getting the following exception:
      System.ArgumentException {"Unsupported filter: (Convert(

      {document}{DateDelivered}) == Convert({document} {DateDue}

      ))."}
      StackTrace :
      at MongoDB.Driver.Linq.Translators.PredicateTranslator.Translate(Expression node)
      at MongoDB.Driver.Linq.Translators.PredicateTranslator.TranslateAndAlso(BinaryExpression node)
      at MongoDB.Driver.Linq.Translators.PredicateTranslator.Translate(Expression node)
      at MongoDB.Driver.Linq.Translators.PredicateTranslator.Translate(Expression node, IBsonSerializerRegistry serializerRegistry)
      at MongoDB.Driver.Linq.Translators.QueryableTranslator.TranslateWhere(WhereExpression node)
      at MongoDB.Driver.Linq.Translators.QueryableTranslator.Translate(Expression node)
      at MongoDB.Driver.Linq.Translators.QueryableTranslator.TranslatePipeline(PipelineExpression node)
      at MongoDB.Driver.Linq.Translators.QueryableTranslator.Translate(Expression node)
      at MongoDB.Driver.Linq.Translators.QueryableTranslator.Translate(Expression node, IBsonSerializerRegistry serializerRegistry)
      at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Translate(Expression expression)
      at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Execute(Expression expression)
      at MongoDB.Driver.Linq.MongoQueryableImpl`2.GetEnumerator()
      at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
      at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
      at Moravia.SymLite.Toolkit.Toolkit.Main(String[] args) in c:_work\projects\symfonie-lite\Toolkit\Toolkit.Main.cs:line 29
      at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
      at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
      at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Threading.ThreadHelper.ThreadStart()

            Assignee:
            Unassigned
            Reporter:
            Carlos Casanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: