Or on Contains throws NullReferenceExceptions

Or on Contains throws NullReferenceExceptions

Postby nlz242 » Wed 29 Jul 2015 13:26

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
nlz242
 
Posts: 9
Joined: Fri 17 Apr 2015 15:09

Re: Or on Contains throws NullReferenceExceptions

Postby Shalex » Mon 03 Aug 2015 06:23

Thank you for your report. We have reproduced the issue and are investigating it.
Shalex
Devart Team
 
Posts: 7616
Joined: Thu 14 Aug 2008 12:44

Re: Or on Contains throws NullReferenceExceptions

Postby Shalex » Fri 21 Aug 2015 07:29

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.
Shalex
Devart Team
 
Posts: 7616
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle