[netcore] Minor fixes, fix GetTypeTests.GetType_EmptyString (mono/mono#15933)
authorEgor Bogatov <egorbo@gmail.com>
Thu, 1 Aug 2019 20:56:56 +0000 (23:56 +0300)
committerSteve Pfister <steveisok@users.noreply.github.com>
Thu, 1 Aug 2019 20:56:56 +0000 (16:56 -0400)
* Fixes https://github.com/mono/mono/issues/15023

* Fixes https://github.com/mono/mono/issues/15189 (were marked as "require large array
support" in dotnet/corefx by @filipnavara)

* Move InternalGetHashCode to RuntimeHelpers

Commit migrated from https://github.com/mono/mono/commit/26f3df98810411b62fcf41daaff5d407df3ba7b5

src/mono/mono/metadata/icall-def-netcore.h
src/mono/mono/metadata/icall.c
src/mono/mono/metadata/reflection.c
src/mono/netcore/CoreFX.issues.rsp
src/mono/netcore/Makefile
src/mono/netcore/System.Private.CoreLib/src/System.Reflection.Emit/AssemblyBuilder.cs
src/mono/netcore/System.Private.CoreLib/src/System.Reflection/RuntimeAssembly.cs
src/mono/netcore/System.Private.CoreLib/src/System.Runtime.CompilerServices/RuntimeHelpers.cs
src/mono/netcore/System.Private.CoreLib/src/System/Object.cs

index 941f1fe..cbb1222 100644 (file)
@@ -173,7 +173,6 @@ NOHANDLES(ICALL(MATHF_21, "Tanh", ves_icall_System_MathF_Tanh))
 
 ICALL_TYPE(OBJ, "System.Object", OBJ_1)
 HANDLES(OBJ_1, "GetType", ves_icall_System_Object_GetType, MonoReflectionType, 1, (MonoObject))
-ICALL(OBJ_2, "InternalGetHashCode", mono_object_hash_internal)
 HANDLES(OBJ_3, "MemberwiseClone", ves_icall_System_Object_MemberwiseClone, MonoObject, 1, (MonoObject))
 
 ICALL_TYPE(ASSEM, "System.Reflection.Assembly", ASSEM_2)
@@ -324,6 +323,7 @@ ICALL_TYPE(RUNH, "System.Runtime.CompilerServices.RuntimeHelpers", RUNH_1)
 HANDLES(RUNH_1, "GetObjectValue", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetObjectValue, MonoObject, 1, (MonoObject))
 HANDLES(RUNH_2, "GetUninitializedObjectInternal", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_GetUninitializedObjectInternal, MonoObject, 1, (MonoType_ptr))
 HANDLES(RUNH_3, "InitializeArray", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray, void, 2, (MonoArray, MonoClassField_ptr))
+ICALL(RUNH_7, "InternalGetHashCode", mono_object_hash_internal)
 HANDLES(RUNH_3a, "PrepareMethod", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_PrepareMethod, void, 3, (MonoMethod_ptr, gpointer, int))
 HANDLES(RUNH_4, "RunClassConstructor", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunClassConstructor, void, 1, (MonoType_ptr))
 HANDLES(RUNH_5, "RunModuleConstructor", ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_RunModuleConstructor, void, 1, (MonoImage_ptr))
index 18ad501..73e412f 100644 (file)
@@ -4910,7 +4910,11 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssemblyHand
                mono_reflection_free_type_info (&info);
                mono_error_cleanup (parse_error);
                if (throwOnError) {
+#if ENABLE_NETCORE
+                       mono_error_set_argument (error, "typeName@0", "failed to parse the type");
+#else
                        mono_error_set_argument (error, "typeName", "failed to parse the type");
+#endif
                        goto fail;
                }
                /*g_print ("failed parse\n");*/
index 3ec2151..f40e2b5 100644 (file)
@@ -1918,7 +1918,11 @@ mono_reflection_parse_type_checked (char *name, MonoTypeNameParse *info, MonoErr
        if (ok) {
                mono_identifier_unescape_info (info);
        } else {
+#if ENABLE_NETCORE
+               mono_error_set_argument_format (error, "typeName@0", "failed parse: %s", name);
+#else
                mono_error_set_argument_format (error, "typeName", "failed parse: %s", name);
+#endif
        }
        return (ok != 0);
 }
index efb194b..2dd4292 100644 (file)
 # https://github.com/mono/mono/issues/15021
 -nomethod System.Reflection.Tests.AssemblyNameTests.Ctor_String_Invalid
 
-# Typename string differs 
-# https://github.com/mono/mono/issues/15023
--nomethod System.Reflection.Tests.GetTypeTests.GetType_EmptyString
-
 # Expected ArgumentException, but none was thrown
 # https://github.com/mono/mono/issues/15024
 -nomethod System.Reflection.Tests.MethodInfoTests.Invoke_OptionalParameterUnassingableFromMissing_WithMissingValue_ThrowsArgumentException
 -nomethod System.Diagnostics.Tests.StackFrameTests.Ctor_SkipFrames_FNeedFileInfo
 
 ####################################################################
-##  System.Drawing.Common.Tests
-####################################################################
-
-# Expects OOM, may be large array support?
-# https://github.com/mono/mono/issues/15189
--nomethod System.Drawing.Drawing2D.Tests.ColorBlendTests.Ctor_LargeCount_ThrowsOutOfMemoryException
--nomethod System.Drawing.Drawing2D.Tests.BlendTests.Ctor_LargeCount_ThrowsOutOfMemoryException
-
-####################################################################
 ##  System.Numerics.Vectors.Tests
 ####################################################################
 
index 1916d95..e0ed1ac 100644 (file)
@@ -86,6 +86,9 @@ run-sample: prepare
        $(DOTNET) build sample/HelloWorld
        MONO_ENV_OPTIONS="--debug" COMPlus_DebugWriteToStdErr=1 ./dotnet --fx-version "$(NETCOREAPP_VERSION)" sample/HelloWorld/bin/netcoreapp3.0/HelloWorld.dll
 
+run-sample-coreclr:
+       cd sample/HelloWorld && $(DOTNET) run
+
 run-aspnet-sample: prepare
        rm -rf sample/AspNetCore/{bin,obj}
        $(DOTNET) publish sample/AspNetCore -c Debug -r $(RID)
index a357382..f15997d 100644 (file)
@@ -451,7 +451,7 @@ namespace System.Reflection.Emit
                        if (name == null)
                                throw new ArgumentNullException (name);
                        if (name.Length == 0)
-                       throw new ArgumentException ("name", "Name cannot be empty");
+                       throw new ArgumentException ("Name cannot be empty", nameof (name));
 
                        var res = InternalGetType (null, name, throwOnError, ignoreCase);
                        if (res is TypeBuilder) {
index 2ebea8c..7c7c205 100644 (file)
@@ -234,7 +234,7 @@ namespace System.Reflection
                                throw new ArgumentNullException (nameof (name));
 
                        if (name.Length == 0)
-                               throw new ArgumentException ("name", "Name cannot be empty");
+                               throw new ArgumentException ("Name cannot be empty");
 
                        return InternalGetType (null, name, throwOnError, ignoreCase);
                }
index 1612d4f..5886d95 100644 (file)
@@ -19,9 +19,12 @@ namespace System.Runtime.CompilerServices
                        get;
                }
 
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               static extern int InternalGetHashCode (object o);
+
                public static int GetHashCode (object o)
                {
-                       return Object.InternalGetHashCode (o);
+                       return InternalGetHashCode (o);
                }
 
                public static new bool Equals (object? o1, object? o2)
index 80658d6..8321b0a 100644 (file)
@@ -14,10 +14,6 @@ namespace System
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                protected extern object MemberwiseClone ();
 
-               // TODO: Move to RuntimeHelpers
-               [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               internal static extern int InternalGetHashCode (object o);
-
                [Intrinsic]
                internal ref byte GetRawData () => throw new NotImplementedException ();