Skip to content

Commit 0f796e9

Browse files
committed
Remove obsolete AttributeUtil.GetArguments overload
(While not strictly necessary to fix the failing test, it still helps to reduce the amount of code we need to look at.)
1 parent ee9c3ce commit 0f796e9

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

src/Castle.Core/DynamicProxy/Internal/AttributeUtil.cs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@ public static CustomAttributeInfo CreateInfo(CustomAttributeData attribute)
2828
{
2929
Debug.Assert(attribute != null, "attribute != null");
3030

31-
// .NET Core does not provide CustomAttributeData.Constructor, so we'll implement it
32-
// by finding a constructor ourselves
33-
Type[] constructorArgTypes;
34-
object[] constructorArgs;
35-
GetArguments(attribute.ConstructorArguments, out constructorArgTypes, out constructorArgs);
36-
var constructor = attribute.AttributeType.GetConstructor(constructorArgTypes);
31+
object[] constructorArgs = GetArguments(attribute.ConstructorArguments);
3732

3833
PropertyInfo[] properties;
3934
object[] propertyValues;
@@ -43,26 +38,14 @@ public static CustomAttributeInfo CreateInfo(CustomAttributeData attribute)
4338
attribute.AttributeType,
4439
attribute.NamedArguments, out properties, out propertyValues, out fields, out fieldValues);
4540

46-
return new CustomAttributeInfo(constructor,
41+
return new CustomAttributeInfo(attribute.Constructor,
4742
constructorArgs,
4843
properties,
4944
propertyValues,
5045
fields,
5146
fieldValues);
5247
}
5348

54-
private static void GetArguments(IList<CustomAttributeTypedArgument> constructorArguments,
55-
out Type[] constructorArgTypes, out object[] constructorArgs)
56-
{
57-
constructorArgTypes = new Type[constructorArguments.Count];
58-
constructorArgs = new object[constructorArguments.Count];
59-
for (var i = 0; i < constructorArguments.Count; i++)
60-
{
61-
constructorArgTypes[i] = constructorArguments[i].ArgumentType;
62-
constructorArgs[i] = ReadAttributeValue(constructorArguments[i]);
63-
}
64-
}
65-
6649
private static object[] GetArguments(IList<CustomAttributeTypedArgument> constructorArguments)
6750
{
6851
var arguments = new object[constructorArguments.Count];

0 commit comments

Comments
 (0)