Summary
AWS Lambda Powertools for .NET - Tracing 1.6.0
🐛 Bug Fixes
- Fixed a NotSupportedException that occurred when using the Tracing utility in native AOT mode with async methods that don't return a value (Task)
- Special thanks to @matthewwilson for reporting this issue! ⭐
📦 Package Information
- Version: 1.6.0
- Package: AWS.Lambda.Powertools.Tracing
Native AOT Support
Important
To allow Tracing to work with your types in native AOT mode, you must add **WithTracing()**
to your source generator configuration. This works with either:
- The default SourceGeneratorLambdaJsonSerializer
- The Powertools Logging utility source generator PowertoolsSourceGeneratorSerializer
Tip
For detailed implementation guidelines, please refer to our AOT support documentation.
Implementation Examples
Using Default Source Generator
using AWS.Lambda.Powertools.Tracing;
using AWS.Lambda.Powertools.Tracing.Serializers;
private static async Task Main()
{
Func<string, ILambdaContext, string> handler = FunctionHandler;
await LambdaBootstrapBuilder.Create(handler, new SourceGeneratorLambdaJsonSerializer<LambdaFunctionJsonSerializerContext>()
.WithTracing())
.Build()
.RunAsync();
}
Using Powertools Logging Source Generator
using AWS.Lambda.Powertools.Logging;
using AWS.Lambda.Powertools.Logging.Serializers;
using AWS.Lambda.Powertools.Tracing;
using AWS.Lambda.Powertools.Tracing.Serializers;
private static async Task Main()
{
Func<string, ILambdaContext, string> handler = FunctionHandler;
await LambdaBootstrapBuilder.Create(handler,
new PowertoolsSourceGeneratorSerializer<LambdaFunctionJsonSerializerContext>()
.WithTracing())
.Build()
.RunAsync();
}