[Mono-bugs] [Bug 77019][Nor] New - List<T>.AddRange thows exception
when called with empty collection
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Dec 16 19:59:06 EST 2005
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 awaddell at fnfr.com.
http://bugzilla.ximian.com/show_bug.cgi?id=77019
--- shadow/77019 2005-12-16 19:59:06.000000000 -0500
+++ shadow/77019.tmp.3614 2005-12-16 19:59:06.000000000 -0500
@@ -0,0 +1,77 @@
+Bug#: 77019
+Product: Mono: Class Libraries
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: awaddell at fnfr.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: List<T>.AddRange thows exception when called with empty collection
+
+Description of Problem:
+
+The following code should run clean, but it throws and exception.
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace AddRangeBug
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ List<int> myList = new List<int>();
+ Dictionary<string, int> myDictionary = new
+Dictionary<string,int>();
+
+ myList.AddRange(myDictionary.Values);
+
+ }
+ }
+}
+
+
+Steps to reproduce the problem:
+gmcs -target:exe -optimize- -noconfig -nowarn:1691,67 -out:AddRangeBug.exe
+-define:DEBUG -define:TRACE -define:FIXME -define:MONO -define:HEADLESS
+-define:BUGFIX_76441 -reference:System -reference:System.Data
+-reference:System.Xml Program.cs Properties/AssemblyInfo.cs
+[awaddell at AWLNX AddRangeBug]$ mono AddRangeBug.exe
+
+[awaddell at AWLNX AddRangeBug]$
+
+
+1.
+2.
+3.
+
+Actual Results:
+Unhandled Exception: System.ArgumentException: index larger than largest
+valid index of array
+in <0x001c8>
+System.Collections.Generic.Dictionary`2+ValueCollection[System.String,System.Int32]:CopyTo
+(System.Int32[] , Int32 )
+in <0x0003f> System.Collections.Generic.List`1[System.Int32]:AddCollection
+(ICollection`1 )
+in <0x00098> System.Collections.Generic.List`1[System.Int32]:AddRange
+(IEnumerable`1 )
+in <0x00049> AddRangeBug.Program:Main (System.String[] args)
+
+
+Expected Results:
+clean (same as .NET)
+
+How often does this happen?
+always
+
+Additional Information:
More information about the mono-bugs
mailing list