[netcore] Allow different enums as return type in CreateDelega… (mono/mono#15787)
authorEgor Bogatov <egorbo@gmail.com>
Wed, 24 Jul 2019 07:50:29 +0000 (10:50 +0300)
committerMarek Safar <marek.safar@gmail.com>
Wed, 24 Jul 2019 07:50:29 +0000 (09:50 +0200)
* Relaxed check for return type in CreateDelegate

* fix build errors

Commit migrated from https://github.com/mono/mono/commit/122494330d635205b0a8766deaeafd0d79bd3d60

src/mono/netcore/CoreFX.issues.rsp
src/mono/netcore/CoreFX.issues_linux_arm64.rsp [new file with mode: 0644]
src/mono/netcore/Makefile
src/mono/netcore/System.Private.CoreLib/src/System/Delegate.cs

index 4259011..fe425dd 100644 (file)
 #-nomethod System.Net.Http.Functional.Tests.SocketsHttpHandler_HttpClientHandler_ClientCertificates_Test.AutomaticOrManual_DoesntFailRegardlessOfWhetherClientCertsAreAvailable
 
 ####################################################################
-##  System.Net.HttpListener.Tests
-####################################################################
-
-# TODO:
-# System.ArgumentException : Cannot bind to the target method because its signature is not compatible with that of the delegate type.
-# at System.Delegate.CreateDelegate(Type type, Object firstArgument, MethodInfo method, Boolean throwOnBindFailure, Boolean allowClosed)
-# at System.Delegate.CreateDelegate(Type type, MethodInfo method, Boolean throwOnBindFailure)
-# at System.Delegate.CreateDelegate(Type type, MethodInfo method)
-# at System.Reflection.RuntimeMethodInfo.CreateDelegate(Type delegateType)
-# at System.Net.CookieExtensions.IsRfc2965Variant(Cookie cookie)
-#
-# https://github.com/mono/mono/issues/15008
--noclass System.Net.Tests.HttpListenerResponseCookiesTests
-
-####################################################################
 ##  System.Net.Sockets.Tests
 ####################################################################
 
diff --git a/src/mono/netcore/CoreFX.issues_linux_arm64.rsp b/src/mono/netcore/CoreFX.issues_linux_arm64.rsp
new file mode 100644 (file)
index 0000000..9e071c9
--- /dev/null
@@ -0,0 +1,2 @@
+# these tests are extremly slow on our arm64 CI
+-nonamespace System.Transactions.Tests
index 1352921..98ca5f5 100644 (file)
@@ -38,6 +38,9 @@ PLATFORM_AOT_PREFIX := lib
 NETCORESDK_EXT = tar.gz
 UNZIPCMD = tar -xvf
 XUNIT_FLAGS = -notrait category=nonlinuxtests @../../../../CoreFX.issues_linux.rsp
+ifeq ($(COREARCH), arm64)
+XUNIT_FLAGS = $(XUNIT_FLAGS) -notrait category=nonlinuxtests @../../../../CoreFX.issues_linux_arm64.rsp
+endif
 TESTS_PLATFORM = Linux.x64
 DOTNET := $(shell ./init-tools.sh | tail -1)
 endif
index 5bdd965..09fec99 100644 (file)
@@ -339,6 +339,17 @@ namespace System
                                // Delegate covariance
                                if (!returnType.IsValueType && delReturnType.IsAssignableFrom (returnType))
                                        returnMatch = true;
+                               else
+                               {
+                                       bool isDelArgEnum = delReturnType.IsEnum;
+                                       bool isArgEnum = returnType.IsEnum;
+                                       if (isArgEnum && isDelArgEnum)
+                                               returnMatch = Enum.GetUnderlyingType (delReturnType) == Enum.GetUnderlyingType (returnType);
+                                       else if (isDelArgEnum && Enum.GetUnderlyingType (delReturnType) == returnType)
+                                               returnMatch = true;
+                                       else if (isArgEnum && Enum.GetUnderlyingType (returnType) == delReturnType)
+                                               returnMatch = true;
+                               }
                        }
 
                        return returnMatch;