From 689371c74a9823ec8270ce1d892016bd2638fd6b Mon Sep 17 00:00:00 2001 From: Alexander Tsoi Date: Wed, 16 Feb 2022 16:01:39 -0500 Subject: [PATCH] Include custom attributes in ExcelFunctionRegistration --- Source/ExcelRna.Extensions.Hosting/IExcelFunctionsProvider.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/ExcelRna.Extensions.Hosting/IExcelFunctionsProvider.cs b/Source/ExcelRna.Extensions.Hosting/IExcelFunctionsProvider.cs index c456326..94b85d0 100644 --- a/Source/ExcelRna.Extensions.Hosting/IExcelFunctionsProvider.cs +++ b/Source/ExcelRna.Extensions.Hosting/IExcelFunctionsProvider.cs @@ -46,6 +46,8 @@ private static bool TryCreateFunctionRegistration(MethodInfo methodInfo, IServic excelFunctionAttribute.Name ??= lambda.Name; var parameters = methodInfo.GetParameters().Select(p => new ExcelParameterRegistration(p)); registration = new ExcelFunctionRegistration(lambda, excelFunctionAttribute, parameters); + registration.CustomAttributes.AddRange(methodInfo.GetCustomAttributes(true).Where(a => a is not ExcelFunctionAttribute)); + registration.ReturnRegistration.CustomAttributes.AddRange(methodInfo.ReturnParameter.GetCustomAttributes(true)); return true; }