diff options
-rw-r--r-- | src/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs b/src/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs index dff766236..8f09f8236 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/CustomAttributeTypedArgument.cs @@ -31,8 +31,11 @@ namespace System.Reflection if (value is Array a) { Type etype = a.GetType().GetElementType(); CustomAttributeTypedArgument[] new_value = new CustomAttributeTypedArgument[a.GetLength(0)]; - for (int i = 0; i < new_value.Length; ++i) - new_value[i] = new CustomAttributeTypedArgument(etype, a.GetValue(i)); + for (int i = 0; i < new_value.Length; ++i) { + var val = a.GetValue (i); + var elemType = etype == typeof (System.Object) ? val.GetType () : etype; + new_value[i] = new CustomAttributeTypedArgument (elemType, val); + } Value = new System.Collections.ObjectModel.ReadOnlyCollection <CustomAttributeTypedArgument>(new_value); } #endif |