1.9.1
github-actions
released this
21 Mar 11:08
·
225 commits
to refs/heads/develop
since this release
Summary
In this release we fix an issue that was causing a System.InvalidCastException
exception when decorating with the Tracing attribute generic methods that would be called with different T as parameters or return T.
Thank you @Kuling for reporting the issue.
using Amazon.Lambda.APIGatewayEvents;
using Amazon.Lambda.Core;
using AWS.Lambda.Powertools.Tracing;
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
namespace MyFunction
{
public interface ISampleService
{
Task<T> LoadAsync<T>(T query);
}
[Tracing]
public class SampleService : ISampleService
{
public async Task<T> LoadAsync<T>(T query)
{
return default;
}
}
[Tracing]
public class Function
{
public async Task<APIGatewayProxyResponse> FunctionHandlerAsync(APIGatewayProxyRequest request, ILambdaContext context)
{
var target = new SampleService();
await target.LoadAsync<double>(3.4);
await target.LoadAsync<int>(5); // Bug
return null;
}
}
}