[Mono-bugs] [Bug 487140] New: XLinq crashes when using orderby on an XElement

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Mar 20 07:07:30 EDT 2009


https://bugzilla.novell.com/show_bug.cgi?id=487140


           Summary: XLinq crashes when using orderby on an XElement
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.2.x
          Platform: All
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: avkekem at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=280886)
 --> (https://bugzilla.novell.com/attachment.cgi?id=280886)
testcase which crashes on 2.2.x

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2a1pre)
Gecko/20090128 Ubuntu/8.04 (hardy) Minefield/3.2a1pre

The query:
var result =    from book in authors

                            where !book.Value.Equals("The Tallest") 

                            orderby book ascending

                            select book;

gives the error:
Unhandled Exception: System.ArgumentException: does not implement right
interface
  at
System.Collections.Generic.Comparer`1+DefaultComparer[System.Xml.Linq.XElement].Compare
(System.Xml.Linq.XElement x, System.Xml.Linq.XElement y) [0x00074] in
/opt/mono-2.2/mcs/mono-2-2/mcs/class/corlib/System.Collections.Generic/Comparer.cs:84 
  at
System.Linq.SortSequenceContext`2[System.Xml.Linq.XElement,System.Xml.Linq.XElement].Compare
(Int32 first_index, Int32 second_index) [0x00000] in
/opt/mono-2.2/mcs/mono-2-2/mcs/class/System.Core/System.Linq/SortSequenceContext.cs:60 
  at System.Linq.QuickSort`1[System.Xml.Linq.XElement].CompareItems (Int32
first_index, Int32 second_index) [0x00000] in
/opt/mono-2.2/mcs/mono-2-2/mcs/class/System.Core/System.Linq/QuickSort.cs:73 
  at System.Linq.QuickSort`1[System.Xml.Linq.XElement].InsertionSort (Int32
left, Int32 right) [0x0002b] in
/opt/mono-2.2/mcs/mono-2-2/mcs/class/System.Core/System.Linq/QuickSort.cs:120 
  at System.Linq.QuickSort`1[System.Xml.Linq.XElement].Sort (Int32 left, Int32
right) [0x00095] in
/opt/mono-2.2/mcs/mono-2-2/mcs/class/System.Core/System.Linq/QuickSort.cs:112 
  at System.Linq.QuickSort`1[System.Xml.Linq.XElement].PerformSort () [0x00020]
in /opt/mono-2.2/mcs/mono-2-2/mcs/class/System.Core/System.Linq/QuickSort.cs:68 
  at
System.Linq.QuickSort`1+<Sort>c__Iterator20[System.Xml.Linq.XElement].MoveNext
() [0x00038] in
/opt/mono-2.2/mcs/mono-2-2/mcs/class/System.Core/System.Linq/QuickSort.cs:138 
  at Linq.Program.Main () [0x00091] in /tmp/Linq/Program.cs:32 
The Fattest


Changing the query to:
         var result =    from book in authors

                            where !book.Value.Equals("The Tallest") 

                            orderby book.Value ascending

                            select book;

gives response! But on ms.net the first example (from the books ;) ) is also
working. It seems XElement does currently not implement IComparable.

Reproducible: Always

Steps to Reproduce:
1.run the attached example
2.
3.
Actual Results:  
crash with stacktrace

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


More information about the mono-bugs mailing list