google-code-export / dblinq2007

Automatically exported from code.google.com/p/dblinq2007
Other
0 stars 0 forks source link

Analysis of static member fails. #314

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use a shared (aka static) class member in a Linq where condition.
2. This happens whether the shared member is an integer or an object such as a 
call into a dictionary.
EG for an integer: Where elems.ColumnName = _someSharedInteger
or for a dictionary: Where elems.ColumnName = _someSharedDict("key")

What is the expected output? What do you see instead?

I'm not sure what is supposed to happen. I get a nasty stack trace.

What version of the product are you using? On what operating system?

SVN latest version on Win XP SP3. Fully updated.

Please provide any additional information below.

The call is 
DBLinq.Data.Linq.Sugar.Implementation.ExpressionDispatcher.AnalyzeMember()

It's being called with a expression with .NodeType = MemberAccess, .Type = 
{Name = "Int32 FullName = "System.Int32"}.

The relevant lines appear to be
Expression objectExpression = null;
bool isStaticMemberAccess = memberExpression.Member.GetIsStaticMember();

Then all code up to line 889 don't execute if isStaticMemberAccess, so nothing 
is done until 889. Line 889 is

            if (objectExpression.Type == typeof(TimeSpan))

which throws an exception because objectExpression is still null.

Original issue reported on code.google.com by shawj...@gmail.com on 27 May 2011 at 5:53