-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Labels
Milestone
Description
Steps to Reproduce
Execute the following snippet
typeof(object[]).GetTypeInfo().DeclaredConstructors.ToArray()[0].Invoke(new object[] { -1 });
or this test
Current Behavior
The code throws TargetInvocationException
Expected Behavior
The code throws OverflowException as it occurs on .Net Core FX
On which platforms did you notice this
[ ] macOS
[ ] Linux
[ ] Windows
Version Used:
Stacktrace
Result of unit test execution:
System.Reflection.Tests.ConstructorInfoTests.Invoke_OneDimensionalArray_NegativeLengths_ThrowsOverflowException [FAIL]
Assert.Throws() Failure
Expected: typeof(System.OverflowException)
Actual: typeof(System.Reflection.TargetInvocationException): Exception has been thrown by the target of an invocation.
---- System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
-------- System.OverflowException :
Stack Trace:
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00012] in /Users/admin/dev/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:704
at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0007a] in /Users/admin/dev/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:688
at System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in /Users/admin/dev/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:720
at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in /Users/admin/dev/mono/external/corefx/src/Common/src/CoreLib/System/Reflection/ConstructorInfo.cs:18
at System.Reflection.Tests.ConstructorInfoTests+<>c__DisplayClass8_1.<Invoke_OneDimensionalArray_NegativeLengths_ThrowsOverflowException>b__0 () [0x00000] in /Users/admin/dev/mono/external/corefx/src/System.Reflection/tests/ConstructorInfoTests.cs:104
----- Inner Stack Trace -----
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00012] in /Users/admin/dev/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:704
at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0007a] in /Users/admin/dev/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:688
at System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in /Users/admin/dev/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:720
at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in /Users/admin/dev/mono/external/corefx/src/Common/src/CoreLib/System/Reflection/ConstructorInfo.cs:18
at System.Reflection.Tests.ConstructorInfoTests+<>c__DisplayClass8_1.<Invoke_OneDimensionalArray_NegativeLengths_ThrowsOverflowException>b__0 () [0x00000] in /Users/admin/dev/mono/external/corefx/src/System.Reflection/tests/ConstructorInfoTests.cs:104
----- Inner Stack Trace -----
at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in /Users/admin/dev/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:69