DbLinq / dblinq2007

LINQ provider for Oracle, PostgreSQL, MySQL, Ingres, SQLite, Firebird and ... SQL Server
Other
62 stars 31 forks source link

NullReferenceException in ExpressionDispatcher.AnalyzeQueryProvider when using array or list as IQueryable #162

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a Postgres DbLinq object.
2. Create a string array or list and use it as an IQueryable.
3. Run a LINQ query that calls Contains() on the above array.

Sample code:

// This works fine:
//var stringArray = new[] { "one", "two" };
// This fails:
var stringArray = new[] {"one", "two"}.AsQueryable();

var result =
    from l in db.lookupcodes
    where stringArray.Contains(l.lookupcode1)
    select l.lookupcode1;

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

Expected: results should be returned, same as when the array is used as an
IEnumerable. Actual: NullReferenceException is thrown (see exception.txt)

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

SVN revision 1239 on .NET 3.5 SP1, Windows XP Pro x64 SP2

Original issue reported on code.google.com by emp....@gmail.com on 21 Oct 2009 at 4:20

Attachments:

GoogleCodeExporter commented 9 years ago
Still present:

            var db = CreateDB();
            var stringArray = new[] { "Nancy", "Laura" }.AsQueryable();
            var q = from e in db.Employees
                    where stringArray.Contains(e.FirstName)
                    select e.FirstName;
            foreach (var e in q)
                Console.WriteLine(e);

Original comment by jonmpr...@gmail.com on 21 Jan 2010 at 11:01

GoogleCodeExporter commented 9 years ago
Try with this patch:
http://code.google.com/p/dblinq2007/issues/detail?id=132#c2 

Original comment by tos.oliv...@gmail.com on 1 Apr 2012 at 2:53