[Mono-bugs] [Bug 79076][Min] New - InvalidOperationException adding items to sorted ListView

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Aug 15 04:21:23 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by gert.driesen at pandora.be.

http://bugzilla.ximian.com/show_bug.cgi?id=79076

--- shadow/79076	2006-08-15 04:21:23.000000000 -0400
+++ shadow/79076.tmp.26111	2006-08-15 04:21:23.000000000 -0400
@@ -0,0 +1,73 @@
+Bug#: 79076
+Product: Mono: Class Libraries
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com                            
+ReportedBy: gert.driesen at pandora.be               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: InvalidOperationException adding items to sorted ListView
+
+When multiple items are added to a ListView with Sort set to either 
+Ascending or Descending, an InvalidOperationException is thrown.
+
+To reproduce, compile and run the following code snippet (using 
+mcs /r:System.Windows.Forms.dll test.cs):
+
+using System;
+using System.Windows.Forms;
+
+class ListViewSort
+{
+  [STAThread]
+  static void Main(string[] args)
+  {
+    ListView entryList = new ListView ();
+    entryList.Sorting = System.Windows.Forms.SortOrder.Descending;
+
+    entryList.BeginUpdate ();
+    entryList.Columns.Add ("Type", 100, HorizontalAlignment.Left);
+
+    ListViewItem item = new ListViewItem (new string [] { "A" });
+    entryList.Items.Add (item);
+    item = new ListViewItem (new string [] { "B" });
+    entryList.Items.Add (item);
+  }
+}
+
+Actual result:
+
+Unhandled Exception: System.InvalidOperationException: The comparer threw 
+an exception. ---> System.InvalidCastException: Cannot cast from source 
+type to destination type.
+  at System.Array.compare (System.Object value1, System.Object value2, 
+IComparer comparer) [0x00000] 
+  at System.Array.qsort (System.Array keys, System.Array items, Int32 
+low0, Int32 high0, IComparer comparer) [0x00000] 
+  at System.Array.Sort (System.Array keys, System.Array items, Int32 
+index, Int32 length, IComparer comparer) [0x00000] --- End of inner 
+exception stack trace ---
+
+  at System.Array.Sort (System.Array keys, System.Array items, Int32 
+index, Int32 length, IComparer comparer) [0x00000] 
+  at System.Array.Sort (System.Array array, Int32 index, Int32 length, 
+IComparer comparer) [0x00000] 
+  at System.Collections.ArrayList.Sort (IComparer comparer) [0x00000] 
+  at System.Windows.Forms.ListView.Sort () [0x00000] 
+  at (wrapper remoting-invoke-with-check) 
+System.Windows.Forms.ListView:Sort ()
+  at System.Windows.Forms.ListView+ListViewItemCollection.Add 
+(System.Windows.Forms.ListViewItem value) [0x00000] 
+  at ListViewSort.Main (System.String[] args) [0x00000] 
+
+Expected result:
+
+No errors.


More information about the mono-bugs mailing list