[netcore] Minor fixes around System.Reflection (mono/mono#15905)
authorEgor Bogatov <egorbo@gmail.com>
Sat, 3 Aug 2019 18:49:38 +0000 (21:49 +0300)
committerMarek Safar <marek.safar@gmail.com>
Sat, 3 Aug 2019 18:49:38 +0000 (20:49 +0200)
* Minor fixes

* Update HelloWorld.csproj

Commit migrated from https://github.com/mono/mono/commit/e08bddaa63bd117fad4fe6b99d41e272689adf97

src/mono/mono/metadata/reflection.c
src/mono/netcore/CoreFX.issues.rsp
src/mono/netcore/System.Private.CoreLib/resources/SR.cs
src/mono/netcore/System.Private.CoreLib/src/System.Reflection/RuntimePropertyInfo.cs

index f40e2b5..1b3955a 100644 (file)
@@ -2632,7 +2632,11 @@ reflection_bind_generic_method_parameters (MonoMethod *method, MonoArrayHandle t
        mono_error_assert_ok (error);
 
        if (!mono_verifier_is_method_valid_generic_instantiation (inflated)) {
+#if ENABLE_NETCORE
+               mono_error_set_argument (error, NULL, "Invalid generic arguments");
+#else
                mono_error_set_argument (error, "typeArguments", "Invalid generic arguments");
+#endif
                return NULL;
        }
 
index 9d2ce86..78760f6 100644 (file)
 # https://github.com/mono/mono/issues/14907
 -nomethod BasicEventSourceTests.TestsManifestNegative.Test_GenerateManifest_InvalidEventSources
 
-# Both tests below have a delegate binding error - signature is not compatible with that of the delegate type.
-# https://github.com/mono/mono/issues/14909
--nomethod BasicEventSourceTests.TestsWrite.Test_Write_T_EventListener
--nomethod BasicEventSourceTests.TestsWrite.Test_Write_T_EventListener_UseEvents
-
 ####################################################################
 ##  System.Dynamic.Runtime.Tests
 ####################################################################
 -nomethod System.Linq.Expressions.Tests.IndexExpressionTests.IndexedPropertyGetReturnsWrongType
 
 # Expected ArgumentException got IndexOutOfRangeException https://github.com/mono/mono/issues/14930
--nomethod System.Linq.Expressions.Tests.IndexExpressionTests.IndexedPropertySetterNoParams
 -nomethod System.Linq.Expressions.Tests.ArrayIndexTests.NonZeroBasedOneDimensionalArrayIndex
 -nomethod System.Linq.Expressions.Tests.ArrayIndexTests.NonZeroBasedOneDimensionalArrayIndexMethod
 
 # https://github.com/mono/mono/issues/14934
 -nomethod System.Linq.Expressions.Tests.ArrayBoundsTests.MultipleNegativeBoundErrorMessage
 
-# Delegate creation w/ reflection https://github.com/mono/mono/issues/14950
--nomethod System.Linq.Expressions.Tests.CallTests.EnumArgAndReturn
-
-# Expected test Assertion fails https://github.com/mono/mono/issues/14951
--nomethod System.Linq.Expressions.Tests.CallTests.MethodName_TypeArgsDontMatchConstraints_ThrowsArgumentException
-
 ####################################################################
 ##  System.Linq.Parallel.Tests
 ####################################################################
index 2afa4dc..8c7afd9 100644 (file)
@@ -1219,4 +1219,5 @@ partial class SR
        public const string Serialization_DangerousDeserialization_Switch = "An action was attempted during deserialization that could lead to a security vulnerability. The action has been aborted. To allow the action, set the '{0}' AppContext switch to true.";
        public const string Arg_MustBeRuntimeAssembly = "Object must be of type RuntimeAssembly.";
        public const string InvalidOperation_SpanOverlappedOperation = "This operation is invalid on overlapping buffers.";
+       public const string SetterHasNoParams = "Setter must have parameters.";
 }
index b52b6f6..bf5f76f 100644 (file)
@@ -192,6 +192,8 @@ namespace System.Reflection
                                        return info.get_method.ReturnType;
                                } else {
                                        ParameterInfo[] parameters = info.set_method.GetParametersInternal ();
+                                       if (parameters.Length == 0)
+                                               throw new ArgumentException     (SR.SetterHasNoParams, "indexer");
                                        
                                        return parameters [parameters.Length - 1].ParameterType;
                                }