@@ -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