New issue 162 by emp....@gmail.com: NullReferenceException in
ExpressionDispatcher.AnalyzeQueryProvider when using array or list as
IQueryable
http://code.google.com/p/dblinq2007/issues/detail?id=162
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
Attachments:
exception.txt 5.9 KB
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
Comment #1 on issue 162 by jonmpryor: NullReferenceException in
ExpressionDispatcher.AnalyzeQueryProvider when using array or list as
IQueryable
http://code.google.com/p/dblinq2007/issues/detail?id=162
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);
Try with this patch:
http://code.google.com/p/dblinq2007/issues/detail?id=132#c2