[netcore] More Array.Copy fixes (#13842)
commit63462357025b7928e0f541ffebafe2e82406485c
authorFilip Navara <filip.navara@gmail.com>
Sat, 6 Apr 2019 09:17:32 +0000 (6 11:17 +0200)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Sat, 6 Apr 2019 09:17:32 +0000 (6 11:17 +0200)
tree06f8d6e99983e11015f0253ed0239d7c5302b234
parentd12d4c9f45d8dbadf9d1d4660516905242a044b0
[netcore] More Array.Copy fixes (#13842)

Remaining errors:
```
/Users/filipnavara/Documents/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs(391,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    System.Tests.ArrayTests.Copy_SZArray(sourceArray: [0, 1, 2, 3, null, ...], sourceIndex: 2, destinationArray: [204, 204, 204, 204, 204, ...], destinationIndex: 5, length: 3, expected: [204, 204, 204, 204, 204, ...]) [FAIL]
      System.InvalidCastException : Specified cast is not valid.
      Stack Trace:
        /Users/filipnavara/Documents/mono/mcs/class/System.Private.CoreLib/System/Array.cs(170,0): at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
        /Users/filipnavara/Documents/mono/mcs/class/System.Private.CoreLib/System/Array.cs(87,0): at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
        /Users/vsts/agent/2.149.2/work/1/s/src/System.Runtime/tests/System/ArrayTests.cs(1293,0): at System.Tests.ArrayTests.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Array expected)
        /Users/vsts/agent/2.149.2/work/1/s/src/System.Runtime/tests/System/ArrayTests.cs(1243,0): at System.Tests.ArrayTests.Copy_SZArray(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Array expected)
        /Users/filipnavara/Documents/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs(391,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    System.Tests.ArrayTests.SetValue_Casting_Invalid [FAIL]
      Assert.Throws() Failure
      Expected: typeof(System.InvalidCastException)
      Actual:   (No exception was thrown)
      Stack Trace:
        /Users/vsts/agent/2.149.2/work/1/s/src/System.Runtime/tests/System/ArrayTests.cs(3939,0): at System.Tests.ArrayTests.SetValue_Casting_Invalid()
        /Users/filipnavara/Documents/mono/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs(391,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
```

The last Copy_SZArray test case is `yield return new object[] { new object[] { 0, 1, 2, 3, null, 5, 6, 7, 8, 9 }, 2, new int?[] { 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc }, 5, 3, new int?[] { 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 2, 3, null, 0xcc, 0xcc } };`
mcs/class/System.Private.CoreLib/System/Array.cs
mcs/class/System.Private.CoreLib/System/DefaultBinder.cs