[Mono-bugs] [Bug 77195][Maj] Changed - BitArray.CopyTo throws ArgumentException when 0-length BitArray is copied

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Jan 14 11:26:43 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 robertj at gmx.net.

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

--- shadow/77195	2006-01-10 10:41:41.000000000 -0500
+++ shadow/77195.tmp.13619	2006-01-14 11:26:43.000000000 -0500
@@ -2,13 +2,13 @@
 Product: Mono: Class Libraries
 Version: unspecified
 OS: All
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Major
 Component: CORLIB
 AssignedTo: mono-bugs at ximian.com                            
 ReportedBy: monobugzilla at bakta.org               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
@@ -118,6 +118,30 @@
 				Array.Copy (_array, 0, array, index, (_length + 31) / 32);
 				
 			} else {
 				throw new ArgumentException ("array", "Unsupported type");
 			}
 		}
+
+------- Additional Comments From robertj at gmx.net  2006-01-14 11:26 -------
+This is a MS.NET bug ;-)
+
+    byte[] bya = new byte[(al.Count+7)/8];
+
+Since al.Count == 0, you're creating a zero length array.
+
+The MSDN docs of BitArray.CopyTo (array, indes) state
+that ArgumentException will be thrown, if:
+
+array is multidimensional. 
+-or-
+**** index is equal to or greater than the length of array. ****
+-or-
+The number of elements in the source BitArray is greater than the
+available space from index to the end of the destination array.
+
+
+Mono's implementation behave like the docs. MS.NET doesn't
+throw an exception if BitArray.Count == 0 ...
+
+Should we mimic this bug??
+


More information about the mono-bugs mailing list