Fix DynamicMethodToString.ToStringTest
authorEgorBo <egorbo@gmail.com>
Wed, 11 Sep 2019 23:03:01 +0000 (02:03 +0300)
committerMarek Safar <marek.safar@gmail.com>
Thu, 12 Sep 2019 06:55:12 +0000 (08:55 +0200)
Commit migrated from https://github.com/mono/mono/commit/1d324e617acf855f97c191fb9ae31605e36f68b7

src/mono/netcore/CoreFX.issues.rsp
src/mono/netcore/CoreFX.issues_windows.rsp
src/mono/netcore/System.Private.CoreLib/System.Private.CoreLib.csproj
src/mono/netcore/System.Private.CoreLib/src/System.Reflection.Emit/DynamicMethod.cs
src/mono/netcore/System.Private.CoreLib/src/System.Runtime.InteropServices/SafeHandle.cs [new file with mode: 0644]

index 902729e..d18b0f4 100644 (file)
 -nomethod System.Reflection.Emit.Tests.DynamicILInfoTests.SetX_NullInput_ThrowsArgumentNullException
 -nomethod System.Reflection.Emit.Tests.DynamicMethodctor1.InvalidOwner_ThrowsArgumentException
 
-# Exception string is different (Expect System.String vs actual String)
-# https://github.com/mono/mono/issues/15323
--nomethod System.Reflection.Emit.Tests.DynamicMethodToString.ToStringTest
-
 # Expected: typeof(System.ArgumentOutOfRangeException)
 # Actual:   typeof(System.OverflowException): Arithmetic operation resulted in an overflow.
 # https://github.com/mono/mono/issues/15334
index a8696da..d9e7365 100644 (file)
@@ -67,4 +67,7 @@
 -nomethod System.Xml.Tests.CTransformResolverTest.TC_AbsolutePath_Transform
 -nomethod System.Tests.StringTests.NormalizationTest
 -nomethod System.Globalization.Tests.StringNormalizationAllTests.Normalize
--nomethod System.Globalization.Tests.StringNormalizationTests.IsNormalized
\ No newline at end of file
+-nomethod System.Globalization.Tests.StringNormalizationTests.IsNormalized
+
+# * Assertion at method-to-ir.c:12425, condition `var->opcode == OP_REGOFFSET' not met
+-nomethod System.Runtime.Tests.NullableMetadataTests.ShimsHaveOnlyTypeForwards
\ No newline at end of file
index d8e6eb5..474ccc5 100644 (file)
       <Compile Include="src\System.Runtime.InteropServices\GCHandle.cs" />
       <Compile Include="src\System.Runtime.InteropServices\Marshal.cs" />
       <Compile Include="src\System.Runtime.InteropServices\MarshalAsAttribute.cs" />
+      <Compile Include="src\System.Runtime.InteropServices\SafeHandle.cs" />
       <Compile Include="src\System.Runtime.Loader\AssemblyLoadContext.cs" />
       <Compile Include="src\System.Runtime.Loader\AssemblyDependencyResolver.cs" />
       <Compile Include="src\System.Runtime.Remoting.Contexts\Context.cs" />
index cf7fe2b..13589e2 100644 (file)
@@ -36,6 +36,7 @@
 #if MONO_FEATURE_SRE
 
 using System;
+using System.Text;
 using System.Reflection;
 using System.Reflection.Emit;
 using System.Globalization;
@@ -319,14 +320,14 @@ namespace System.Reflection.Emit {
                }
 
                public override string ToString () {
-                       string parms = String.Empty;
-                       ParameterInfo[] p = GetParametersInternal ();
-                       for (int i = 0; i < p.Length; ++i) {
-                               if (i > 0)
-                                       parms = parms + ", ";
-                               parms = parms + p [i].ParameterType.Name;
-                       }
-                       return ReturnType.Name+" "+Name+"("+parms+")";
+                       var sbName = new ValueStringBuilder (MethodNameBufferSize);
+                       sbName.Append (ReturnType.FormatTypeName ());
+                       sbName.Append (' ');
+                       sbName.Append (Name);
+                       sbName.Append ('(');
+                       AppendParameters (ref sbName, parameters ?? Array.Empty<Type> (), CallingConvention);
+                       sbName.Append (')');
+                       return sbName.ToString ();
                }
 
                public override MethodAttributes Attributes {
diff --git a/src/mono/netcore/System.Private.CoreLib/src/System.Runtime.InteropServices/SafeHandle.cs b/src/mono/netcore/System.Private.CoreLib/src/System.Runtime.InteropServices/SafeHandle.cs
new file mode 100644 (file)
index 0000000..c9910f9
--- /dev/null
@@ -0,0 +1,14 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.CompilerServices;
+
+namespace System.Runtime.InteropServices
+{
+       // Mono runtime relies on exact layout
+       [StructLayout (LayoutKind.Sequential)]
+       public abstract partial class SafeHandle
+       {
+       }
+}