From bf71da45c67c25c0ce3a2957fa91f5eaec982199 Mon Sep 17 00:00:00 2001 From: annchous Date: Mon, 8 Nov 2021 20:28:27 +0300 Subject: [PATCH 1/2] fix: add missed open curly --- .../src/System/Reflection/CustomAttributeTypedArgument.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs b/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs index 18d033b5c4394d..3198e9fd458027 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs @@ -66,7 +66,7 @@ internal string ToString(bool typed) result.Append('['); int count = array.Count; result.Append(count.ToString()); - result.Append(']'); + result.Append("] { "); for (int i = 0; i < count; i++) { From 89ba1576907e9ff7df12c102d54220e5c230bb3b Mon Sep 17 00:00:00 2001 From: annchous Date: Mon, 8 Nov 2021 20:57:13 +0300 Subject: [PATCH 2/2] feat: add test --- .../CustomAttribute_Named_Typed_ArgumentTests.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs b/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs index d016e53c75e299..4460797182c873 100644 --- a/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs +++ b/src/libraries/System.Runtime/tests/System/Reflection/CustomAttribute_Named_Typed_ArgumentTests.cs @@ -52,6 +52,14 @@ public static void Test_CustomAttributeTypedArgument_Constructor() Assert.True(false, "Expected to find MyAttr Attribute"); } + [Fact] + public static void Test_CustomAttributeTypedArgument_ToString() + { + var argument = new CustomAttributeTypedArgument(new [] { new CustomAttributeTypedArgument(0) }); + + Assert.Equal("new CustomAttributeTypedArgument[1] { 0 }", argument.ToString()); + } + [MyAttr(MyKinds.First, Desc = "This is a description on a method")] private static void MyMethod() { } }