[Mono-bugs] [Bug 80199][Maj] New - ListViewItemCollection accepts a item owned by another ListView

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Dec 9 08:43:44 EST 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 dna at informatik.uni-kiel.de.

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

--- shadow/80199	2006-12-09 08:43:44.000000000 -0500
+++ shadow/80199.tmp.8202	2006-12-09 08:43:44.000000000 -0500
@@ -0,0 +1,69 @@
+Bug#: 80199
+Product: Mono: Class Libraries
+Version: 1.2
+OS: GNU/Linux [Other]
+OS Details: Ubuntu 6.10
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: dna at informatik.uni-kiel.de               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: ListViewItemCollection accepts a item owned by another ListView
+
+Description of Problem:
+ListViewItemCollection accepts a item that is allready owned bei another
+ListView.
+
+Testapplication:
+using System;
+using System.Windows.Forms;
+
+namespace ListViewTest
+{
+	static class Program
+	{
+		
+		static void Main()
+		{
+			ListView lv1 = new ListView();
+			ListView lv2 = new ListView();
+			ListViewItem item1 = new ListViewItem("item1");
+			lv1.Items.Add(item1);
+			lv2.Items.Add(item1);
+		}
+	}
+}
+
+Actual Results:
+No ArgumentException
+
+Expected Results:
+System.ArgumentException : Das Element item1 kann nur an einer Stelle
+hinzugefügt oder eingefügt werden. Entfernen Sie es von der aktuellen
+Position, oder klonen Sie es. Parametername: item
+   bei System.Windows.Forms.ListView.InsertItems(Int32 displayIndex,
+ListViewItem[] items, Boolean checkHosting)
+   bei
+System.Windows.Forms.ListView.ListViewNativeItemCollection.Add(ListViewItem
+value)
+   bei
+System.Windows.Forms.ListView.ListViewItemCollection.Add(ListViewItem value)
+
+Testcase:
+        [Test]
+        [ExpectedException(typeof(ArgumentException))] // An item cannot be
+added more than once. To add an item again, you need to clone it
+        public void ListViewItemCollectionTest_Add_ExistingItem2()
+        {
+            ListView lv1 = new ListView();
+            ListView lv2 = new ListView();
+            ListViewItem item1 = new ListViewItem("item1");
+            lv1.Items.Add(item1);
+            lv2.Items.Add(item1);
+        }


More information about the mono-bugs mailing list