InvalidCastException in Cassandra.Data.Linq

Description

Unable to cast object of type 'System.Reflection.RuntimePropertyInfo' to type 'System.Reflection.FieldInfo'

at Cassandra.Data.Linq.CqlExpressionVisitor.GetFieldValue(MemberExpression node)
at Cassandra.Data.Linq.CqlExpressionVisitor.GetPropertyValue(MemberExpression node)
at Cassandra.Data.Linq.CqlExpressionVisitor.GetClosureValue(MemberExpression node)
at Cassandra.Data.Linq.CqlExpressionVisitor.FillCondition(MemberExpression node, StringBuilder clause, List`1 parameters)
at Cassandra.Data.Linq.CqlExpressionVisitor.VisitBinary(BinaryExpression node)
at Cassandra.Data.Linq.CqlExpressionVisitor.VisitBinary(BinaryExpression node)
at System.Linq.Expressions.ExpressionVisitor.VisitLambda[T](Expression`1 node)
at Cassandra.Data.Linq.CqlExpressionVisitor.VisitMethodCall(MethodCallExpression node)
at Cassandra.Data.Linq.CqlExpressionVisitor.GetSelect(Expression expression, Object[]& values)
at Cassandra.Data.Linq.CqlQueryBase`1.<ExecuteAsync>d__35.MoveNext()
at Cassandra.Tasks.TaskHelper.WaitToComplete(Task task, Int32 timeout)
at Cassandra.Data.Linq.CqlQueryBase`1.Execute()
...

Exception appears in cases like

WHERE will throw exception. The problem is

and this code in CqlExpressionVisitor.cs (added in 3.3.0, commit 83dc9d831118233945c0071902dc8d6aaf24f24b)

Environment

DataStax Community Edition v3.0.9, Windows 7

Activity

Show:
Dizentegrator
June 1, 2017, 12:27 AM

Thank you for reply. We have a lot of usages of such kind so we'll be waiting for fix, but anyway thanks for advise.

Collin Sauve
June 20, 2017, 6:19 AM

This is a show-stopper for my company's use of the library - we upgraded to 3.3.1 today and very quickly reverted back to 3.2.1 due to this issue.

Jorge Bay Gondra
June 20, 2017, 6:56 PM

Thanks for letting us know , we will prioritize it accordingly.

Collin Sauve
June 21, 2017, 11:12 AM

I think I have a fix for this here: https://github.com/datastax/csharp-driver/pull/315

Jorge Bay Gondra
June 22, 2017, 8:44 PM

Merged!
Thanks .

FYI: We plan to simplify the ExpressionVisitor once is done.

Fixed

Assignee

Unassigned

Reporter

Dizentegrator

Labels

Reproduced in

3.3.0

PM Priority

None

Fix versions

External issue ID

None

Doc Impact

None

Reviewer

None

Pull Request

None

Epic Link

None

Sprint

None

Pull Requests

None

Size

None

Components

Affects versions

Priority

Major