[Mono-bugs] [Bug 497720] New: System.Collections.Generic.KeyCollection.CopyTo(TKey [] array, int arrayIndex) behaves different on Mono / .NET

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Apr 23 13:07:41 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=497720


           Summary: System.Collections.Generic.KeyCollection.CopyTo(TKey
                    [] array, int arrayIndex) behaves different on Mono /
                    .NET
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: i386
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jonas.larsson at manodo.se
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.9)
Gecko/2009042113 Ubuntu/9.04 (jaunty) Firefox/3.0.9

If KeyCollection.Count is 0 (zero, empty) this method always throws
ArgumentOutOfRangeException(). The MS .NET implementation however does not.
Please compare your code with MS using Reflector or other tools.

Mono Code:
if (arrayIndex < 0 || array.Length <= arrayIndex)
  throw new ArgumentOutOfRangeException ();

MS Code:
if (index < 0)
  ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.index);

These kind of bugs makes porting .NET code to mono really challenging and
risky.

Reproducible: Always

Steps to Reproduce:
1. Create a Generic keyed collection
2. Call Keys.CopyTo on the empty collection
3. Get exception
Actual Results:  
Exception

Expected Results:  
Nothing. Copy the keys from an empty collection should do nothing.

-- 
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.


More information about the mono-bugs mailing list