http://bugzilla.novell.com/show_bug.cgi?id=579252
http://bugzilla.novell.com/show_bug.cgi?id=579252#c0 Summary: Array.AsReadOnly(x).CopyTo does not copy anything Classification: Mono Product: Mono: Class Libraries Version: 2.6.x Platform: All OS/Version: All Status: NEW Severity: Normal Priority: P5 - None Component: CORLIB AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729) Array.AsReadOnly with an array (byte[] in my case) returns a read-only wrapper around the array (of course). But this wrapper's CopyTo method does nothing at all. This causes IEnumerable.ToArray to fail when applied to the result of an Array.AsReadOnly call, because it uses ICollection<T>.CopyTo if the enumerable is a collection. See the following output from csharp: csharp> ((System.Collections.Generic.IEnumerable<byte>)(new byte [] {1, 2, 3})).ToArray (); { 1, 2, 3 } csharp> Array.AsReadOnly(new byte [] {1, 2, 3}).ToArray(); { 0, 0, 0 } Reading the code, I cannot see how this happens, because the two wrappers around the array simply call into their wrapped objects' CopyTo method. So it *should* work... and yet it does not. Reproducible: Always -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
