Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authormonojenkins <jo.shields+jenkins@xamarin.com>2018-09-04 14:14:23 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2018-09-04 14:14:23 +0300
commitfc2c8b6435aedc5ec072ac09abe207d30f4e32e7 (patch)
treebb0c07e346fef4a0c53675a674f9afaaa947f61f /mcs
parent330eec3b4c970e85536637686b5332d6b0863dc3 (diff)
[2018-06] [corlib] Bring back String.Concat with __arglist (#10458)
Backport of #10452. Fixes #9996 Tested repro project from the link on a local PostgresSQL server and EntityFramework packages. See https://github.com/aspnet/EntityFramework6/blob/master/src/EntityFramework/Core/Objects/ELinq/MethodCallTranslator.cs#L1482-L1497
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/corlib/ReferenceSources/String.cs7
-rw-r--r--mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs55
2 files changed, 62 insertions, 0 deletions
diff --git a/mcs/class/corlib/ReferenceSources/String.cs b/mcs/class/corlib/ReferenceSources/String.cs
index 6d8866a058a..f194b7c0f83 100644
--- a/mcs/class/corlib/ReferenceSources/String.cs
+++ b/mcs/class/corlib/ReferenceSources/String.cs
@@ -86,6 +86,13 @@ namespace System
return -1;
}
+ [CLSCompliant(false)]
+ public static String Concat(Object arg0, Object arg1, Object arg2, Object arg3, __arglist)
+ {
+ // Added to maintain backward compatibility, see https://github.com/mono/mono/issues/9996
+ throw new PlatformNotSupportedException();
+ }
+
internal unsafe int IndexOfUncheckedIgnoreCase (string value, int startIndex, int count)
{
int valueLen = value.Length;
diff --git a/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs b/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs
index c68116ea0ee..ef6b571451c 100644
--- a/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs
@@ -31,6 +31,7 @@
using NUnit.Framework;
using System;
+using System.Linq;
using System.Threading;
using System.Reflection;
#if !MONOTOUCH && !FULL_AOT_RUNTIME
@@ -890,6 +891,60 @@ namespace MonoTests.System.Reflection
}
}
+ static void EnsureMethodExists (Type type, string name, params Type[] parameterTypes)
+ {
+ var method = type.GetTypeInfo ().GetDeclaredMethods (name)
+ .SingleOrDefault (m => m.GetParameters ().Select (p => p.ParameterType).SequenceEqual (parameterTypes));
+ Assert.IsNotNull (method, $"{type}.{name}");
+ }
+
+ public void EnsureEntityFrameworkMethodsExist ()
+ {
+ // EntityFramework6 relies on the following methods
+ // see https://github.com/aspnet/EntityFramework6/blob/master/src/EntityFramework/Core/Objects/ELinq/MethodCallTranslator.cs#L846
+ // also https://github.com/mono/mono/pull/10452
+ EnsureMethodExists (typeof (Math), "Ceiling", typeof (decimal));
+ EnsureMethodExists (typeof (Math), "Ceiling", typeof (double));
+ EnsureMethodExists (typeof (Math), "Floor", typeof (decimal));
+ EnsureMethodExists (typeof (Math), "Floor", typeof (double));
+ EnsureMethodExists (typeof (Math), "Round", typeof (decimal));
+ EnsureMethodExists (typeof (Math), "Round", typeof (double));
+ EnsureMethodExists (typeof (Math), "Round", typeof (decimal), typeof (int));
+ EnsureMethodExists (typeof (Math), "Round", typeof (double), typeof (int));
+ EnsureMethodExists (typeof (Decimal), "Floor", typeof (decimal));
+ EnsureMethodExists (typeof (Decimal), "Ceiling", typeof (decimal));
+ EnsureMethodExists (typeof (Decimal), "Round", typeof (decimal));
+ EnsureMethodExists (typeof (Decimal), "Round", typeof (decimal), typeof (int));
+ EnsureMethodExists (typeof (String), "Replace", typeof (String), typeof (String));
+ EnsureMethodExists (typeof (String), "ToLower");
+ EnsureMethodExists (typeof (String), "ToUpper");
+ EnsureMethodExists (typeof (String), "Trim");
+ EnsureMethodExists (typeof (Math), "Truncate", typeof (decimal));
+ EnsureMethodExists (typeof (Math), "Truncate", typeof (double));
+ EnsureMethodExists (typeof (Math), "Pow", typeof (double), typeof (double));
+ EnsureMethodExists (typeof (Guid), "NewGuid");
+ EnsureMethodExists (typeof (String), "Contains", typeof (string));
+ EnsureMethodExists (typeof (String), "IndexOf", typeof (string));
+ EnsureMethodExists (typeof (String), "StartsWith", typeof (string));
+ EnsureMethodExists (typeof (String), "EndsWith", typeof (string));
+ EnsureMethodExists (typeof (String), "Substring", typeof (int));
+ EnsureMethodExists (typeof (String), "Substring", typeof (int), typeof (int));
+ EnsureMethodExists (typeof (String), "Remove", typeof (int));
+ EnsureMethodExists (typeof (String), "Remove", typeof (int), typeof (int));
+ EnsureMethodExists (typeof (String), "IsNullOrEmpty", typeof (string));
+ EnsureMethodExists (typeof (String), "Concat", typeof (string), typeof (string));
+ EnsureMethodExists (typeof (String), "Concat", typeof (string), typeof (string), typeof (string));
+ EnsureMethodExists (typeof (String), "Concat", typeof (string), typeof (string), typeof (string), typeof (string));
+ EnsureMethodExists (typeof (String), "Concat", typeof (object), typeof (object));
+ EnsureMethodExists (typeof (String), "Concat", typeof (object), typeof (object), typeof (object));
+ EnsureMethodExists (typeof (String), "Concat", typeof (object), typeof (object), typeof (object), typeof (object));
+ EnsureMethodExists (typeof (String), "Concat", typeof (object[]));
+ EnsureMethodExists (typeof (String), "Concat", typeof (string[]));
+ EnsureMethodExists (typeof (String), "Trim", typeof (Char[]));
+ EnsureMethodExists (typeof (String), "TrimStart", typeof (Char[]));
+ EnsureMethodExists (typeof (String), "TrimEnd", typeof (Char[]));
+ }
+
[Test]
public void TestLocalVariableTypes ()
{