AlexanderKrutov / DataTables.Queryable

.Net library for clever processing of requests from datatables.net jQuery plugin on the server side (ASP.NET, Nancy or any other web server).
MIT License
50 stars 19 forks source link

NullReferenceException inside BuildStringContainsPredicate #38

Closed nino-s closed 5 years ago

nino-s commented 5 years ago

https://github.com/AlexanderKrutov/DataTables.Queryable/blob/master/DataTables.Queryable/QueryableExtensions.cs#L349

If the option caseInsensitive is set for columns, you do a ToLower call on the object string. If the object is null, both expressions which are build up on line 354 and 355 will call ToLower first. So you get a NullPointer before you check for not null.

nino-s commented 5 years ago

@AlexanderKrutov can you confirm this issue?

AlexanderKrutov commented 5 years ago

@nino-s Thank you for contributing! Sorry for late response. Your fix will be included in the nearest release.

VictorioBerra commented 5 years ago

@nino-s what DMBS are you using? SQL Server 2008-2017?

nino-s commented 5 years ago

@VictorioBerra sry for the late response. Correct SQL Server 2017.

VictorioBerra commented 5 years ago

@nino-s IIRC, SQL Server by default all queries are case insensitive.

Note, this does not mean we should not fix the bug, I just wanted to point out that you should not have to set that option for columns if you are using SQL Server 2017.

nino-s commented 5 years ago

Alright, thx for mentioning that :)