Bug #61729 Skip/Take Clauses Causes Null Reference Exception in 6.3.7 and 6.4.1 Only
Submitted: 3 Jul 2011 15:06 Modified: 29 Sep 2011 20:20
Reporter: Wenbin Xu Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.3.7, 6.4.1 Beta OS:Microsoft Windows (Windows XP SP3 / 7 SP1)
Assigned to: Fernando Gonzalez.Sanchez CPU Architecture:Any
Tags: .net Connector, 6.3.7, 6.4.1, entity framework

[3 Jul 2011 15:06] Wenbin Xu
Description:
Symptom
-------
Execute LINQ to Entity query in 6.3.7 / 6.4.1 results in NullReferenceException. But the same code succeeds in 6.3.6.

How to repeat:
Steps to Reproduce
------------------
The problem happens in a big project and it is hard for me to upload a repro project/DB. However, I can describe the basics of what happens with pseudo code below.

1. var query = context.talents.Include("Gender");

2. query = query.Include("Industries");

3. query = query.Include("JobFunctions");

4. query = query.Where(...).OrderBy(...).ThenByDescending(...).Skip(0).Take(32);

5. query.ToList();

The exception happens at step#5. If I removed Skip/Take clause from step#4 or use 6.3.6 connector, then the execution succeeds.

Moreover, I'll upload the screenshot of exception to help isolate the problem.

Suggested fix:
Make code work the same as 6.3.6
[3 Jul 2011 15:15] Wenbin Xu
NullReferenceException Screenshot # 1

Attachment: 1.png (image/png, text), 64.82 KiB.

[3 Jul 2011 15:16] Wenbin Xu
NullReferenceException Screenshot # 2

Attachment: 2.png (image/png, text), 88.10 KiB.

[4 Jul 2011 7:18] Bogdan Degtyariov
Can you copy/paste the full stack trace when the exception occurs?
It is not very informative on the screenshot.
[4 Jul 2011 12:12] Wenbin Xu
Stack Trace

Attachment: stack_trace.txt (text/plain), 5.40 KiB.

[21 Jul 2011 0:34] Wenbin Xu
Is this a bug fix only in 6.3.7 / 6.4.1 or actually it solves a problem in upcoming 6.4.x releases?
[29 Sep 2011 20:20] Fernando Gonzalez.Sanchez
Thank you for your bug report. This issue has already been fixed in the latest released version of that product, which you can download at

  http://www.mysql.com/downloads/

This has been fixed in releases 6.2.6, 6.3.8 & 6.4.4.
[29 Feb 2012 21:25] John Russell
Added to changelog for 6.2.6, 6.3.8, 6.4.4: 

Executing a "LINQ to Entity" query could result in a
NullReferenceException error.