generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Labels
aotarea/tracingCore tracing utilityCore tracing utilitybugUnexpected, reproducible and unintended software behaviourUnexpected, reproducible and unintended software behaviourreleasedFix or implementation already in main and releasedFix or implementation already in main and released
Description
Expected Behaviour
Adding the tracing annotation to a function that returns a Task should work as expected
[Tracing]
async Task FunctionHandler(Input input, ILambdaContext context)
Current Behaviour
Decorating a function that returns a void Task with the Tracing annotation causes the following exception:
"errorType": "NotSupportedException",
"errorMessage": "'AWS.Lambda.Powertools.Common.UniversalWrapperAttribute.WrapAsync[System.Threading.Tasks.VoidTaskResult](System.Func`2[System.Object[],System.Threading.Tasks.Task`1[System.Threading.Tasks.VoidTaskResult]],System.Object[],AWS.Lambda.Powertools.Common.AspectEventArgs)' is missing native code. MethodInfo.MakeGenericMethod() is not compatible with AOT compilation. Inspect and fix AOT related warnings that were generated when the app was published. For more information see https://aka.ms/nativeaot-compatibility",
"stackTrace": [
"at System.Reflection.Runtime.MethodInfos.RuntimeNamedMethodInfo`1.GetUncachedMethodInvoker(RuntimeTypeInfo[], MemberInfo) + 0x30",
"at System.Reflection.Runtime.MethodInfos.RuntimeNamedMethodInfo`1.MakeGenericMethod(Type[]) + 0x1c4",
"at AWS.Lambda.Powertools.Common.UniversalWrapperAspect.CreateMethodHandler(Type, IEnumerable`1) + 0x1f4",
"at AWS.Lambda.Powertools.Common.UniversalWrapperAspect.GetMethodHandler(MethodBase, Type, IEnumerable`1) + 0x94",
"at AWS.Lambda.Powertools.Common.UniversalWrapperAspect.Handle(Object, Type, MethodBase, Func`2, String, Object[], Type, Attribute[]) + 0x100",
"at Program.<>c__DisplayClass0_0.__a$_around_<<Main>$>g__FunctionHandler|0_100663379_w_0(Object[]) + 0x130",
"at Program.<>c__DisplayClass0_0.<<Main>$>g__FunctionHandler|0(ScheduleInput input, ILambdaContext context) + 0x50",
"at Amazon.Lambda.RuntimeSupport.HandlerWrapper.<>c__DisplayClass14_0`1.<<GetHandlerWrapper>b__0>d.MoveNext() + 0x90",
...
]
}```
### Code snippet
We're using the following dependencies and trimmer settings
Possible Solution
No response
Steps to Reproduce
deploy a lambda function with the following handler
[Tracing]
async Task FunctionHandler(Input input, ILambdaContext context)
{
Powertools for AWS Lambda (.NET) version
latest
AWS Lambda function runtime
dotnet8 (AOT)
Debugging logs
No response
Metadata
Metadata
Assignees
Labels
aotarea/tracingCore tracing utilityCore tracing utilitybugUnexpected, reproducible and unintended software behaviourUnexpected, reproducible and unintended software behaviourreleasedFix or implementation already in main and releasedFix or implementation already in main and released
Type
Projects
Status
✅ Done