Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracing handlers with a VoidTaskResult is broken with Tracing 1.5.2 #674

Closed
matthewwilson opened this issue Oct 28, 2024 · 2 comments
Closed
Assignees
Labels
aot area/tracing Core tracing utility bug Unexpected, reproducible and unintended software behaviour released Fix or implementation already in main and released

Comments

@matthewwilson
Copy link

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

@matthewwilson matthewwilson added bug Unexpected, reproducible and unintended software behaviour triage Pending triage from maintainers labels Oct 28, 2024
@hjgraca hjgraca added the area/tracing Core tracing utility label Oct 29, 2024
@hjgraca hjgraca moved this to 📋 Backlog in Powertools for AWS Lambda (.NET) Oct 29, 2024
@hjgraca hjgraca added aot and removed triage Pending triage from maintainers labels Oct 29, 2024
@hjgraca hjgraca self-assigned this Oct 30, 2024
@hjgraca hjgraca moved this from 📋 Backlog to 🏗 In progress in Powertools for AWS Lambda (.NET) Nov 6, 2024
@hjgraca
Copy link
Contributor

hjgraca commented Nov 6, 2024

Hey @matthewwilson thank you for opening the issue.
We are going to release a fix next Tuesday. Pull request #675

@github-actions github-actions bot added the pending-release Fix or implementation already in dev waiting to be released label Nov 12, 2024
@hjgraca hjgraca closed this as completed Nov 12, 2024
@hjgraca
Copy link
Contributor

hjgraca commented Nov 12, 2024

release 1.17 #676

@hjgraca hjgraca added released Fix or implementation already in main and released and removed pending-release Fix or implementation already in dev waiting to be released labels Nov 12, 2024
@hjgraca hjgraca moved this from 🏗 In progress to ✅ Done in Powertools for AWS Lambda (.NET) Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aot area/tracing Core tracing utility bug Unexpected, reproducible and unintended software behaviour released Fix or implementation already in main and released
Projects
Status: Done
Development

No branches or pull requests

2 participants