[Mono-bugs] [Bug 572540] New: Linq query ignores more than two orderby keys

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jan 21 00:21:47 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=572540

http://bugzilla.novell.com/show_bug.cgi?id=572540#c0


           Summary: Linq query ignores more than two orderby keys
    Classification: Mono
           Product: Mono: Compilers
           Version: 2.6.x
          Platform: All
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: sgroot at tkl.iis.u-tokyo.ac.jp
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Created an attachment (id=337859)
 --> (http://bugzilla.novell.com/attachment.cgi?id=337859)
Example program source demonstrating the bug

User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64;
Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729;
Media Center PC 6.0; InfoPath.3)

If a linq query uses an orderby clause with more than two values, the compiler
uses only the first two and ignores the rest.

This can be seen when viewing the resulting IL; the compiler will output a call
to Enumerable.OrderBy for the first sort key, and a call to Enumerable.ThenBy
for the second sort key, but it does not emit a call to Enumerable.ThenBy for
any of the remaining sort keys.

This is strictly a compiler bug, because manually calling ThenBy the
appropriate number of times does yield the correct result.

Reproducible: Always

Steps to Reproduce:
1. Write a program with a linq expression that sorts on more than two sort keys
(an example is attached to this bug report).
2. Compile this program with gmcs.
3. Run it to observe incorrect behaviour.
Actual Results:  
The gmcs compiler emits code to sort by the first two keys, but not by the
remaining keys.

Expected Results:  
The compiler should emit code to use all the specified sort keys.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list