Page 1 of 1

Or on Contains throws NullReferenceExceptions

Posted: Wed 29 Jul 2015 13:26
by nlz242
Hello,
I'm thinking this may be related to the changes made to support DbInExpression (see : http://forums.devart.com/viewtopic.php?f=1&t=32061 )

Since we've updated dotConnect to 8.4.457, we are having a weird bug.
OR on Contains are throwing a NullReferenceExceptions but they work fine if i isolate the Contains and repeat the conditions outside the OR.

For example, this will throw on the bool exists line:

Code: Select all

string x = "somestring";
List<String> list1 = new List<string> { "string1", "string2" };
List<String> list2 = new List<string> { "string3", "string4" };
bool exists = (from o in myObjectContext.MYTABLEs where o.X == x && (list1.Contains(o.Y) || list2.Contains(o.Z)).Any();
But this, which is fonctionnally the same, works well:

Code: Select all

string x = "somestring";
List<String> list1 = new List<string> { "string1", "string2" };
List<String> list2 = new List<string> { "string3", "string4" };
bool exists = (from o in myObjectContext.MYTABLEs where (o.X == x && list1.Contains(o.Y)) || (o.X == x && list2.Contains(o.Z)).Any();
As a temporary work around, i've modified my queries to use the later, since x && (y || z) == (x && y) || (x && z)
So : x && (y || z), where y and z are list.Contains is broken.

Thanks

Re: Or on Contains throws NullReferenceExceptions

Posted: Mon 03 Aug 2015 06:23
by Shalex
Thank you for your report. We have reproduced the issue and are investigating it.

Re: Or on Contains throws NullReferenceExceptions

Posted: Fri 21 Aug 2015 07:29
by Shalex
The bug with throwing System.NullReferenceException when applying logical OR operator to the results of several IEnumerable<T>.Contains(T t) is fixed in the newest (8.5.478) build of dotConnect for Oracle: http://forums.devart.com/viewtopic.php?f=1&t=32324.