diff --git a/examples/AOT/AOT_Logging/src/AOT_Logging/AOT_Logging.csproj b/examples/AOT/AOT_Logging/src/AOT_Logging/AOT_Logging.csproj index d06a0a531..629d40e6e 100644 --- a/examples/AOT/AOT_Logging/src/AOT_Logging/AOT_Logging.csproj +++ b/examples/AOT/AOT_Logging/src/AOT_Logging/AOT_Logging.csproj @@ -17,9 +17,9 @@ partial - - + + - + diff --git a/examples/AOT/AOT_Logging/test/AOT_Logging.Tests/AOT_Logging.Tests.csproj b/examples/AOT/AOT_Logging/test/AOT_Logging.Tests/AOT_Logging.Tests.csproj index cba0ba03e..102e9e882 100644 --- a/examples/AOT/AOT_Logging/test/AOT_Logging.Tests/AOT_Logging.Tests.csproj +++ b/examples/AOT/AOT_Logging/test/AOT_Logging.Tests/AOT_Logging.Tests.csproj @@ -6,8 +6,8 @@ true - - + + diff --git a/examples/AOT/AOT_Metrics/src/AOT_Metrics/AOT_Metrics.csproj b/examples/AOT/AOT_Metrics/src/AOT_Metrics/AOT_Metrics.csproj index 74caf11d7..98f389e91 100644 --- a/examples/AOT/AOT_Metrics/src/AOT_Metrics/AOT_Metrics.csproj +++ b/examples/AOT/AOT_Metrics/src/AOT_Metrics/AOT_Metrics.csproj @@ -17,9 +17,9 @@ partial - - + + - + \ No newline at end of file diff --git a/examples/AOT/AOT_Metrics/test/AOT_Metrics.Tests/AOT_Metrics.Tests.csproj b/examples/AOT/AOT_Metrics/test/AOT_Metrics.Tests/AOT_Metrics.Tests.csproj index fb935a9a9..b7d71a623 100644 --- a/examples/AOT/AOT_Metrics/test/AOT_Metrics.Tests/AOT_Metrics.Tests.csproj +++ b/examples/AOT/AOT_Metrics/test/AOT_Metrics.Tests/AOT_Metrics.Tests.csproj @@ -6,8 +6,8 @@ true - - + + diff --git a/examples/AOT/AOT_Tracing/src/AOT_Tracing/AOT_Tracing.csproj b/examples/AOT/AOT_Tracing/src/AOT_Tracing/AOT_Tracing.csproj index 6e92d3312..adc27fc53 100644 --- a/examples/AOT/AOT_Tracing/src/AOT_Tracing/AOT_Tracing.csproj +++ b/examples/AOT/AOT_Tracing/src/AOT_Tracing/AOT_Tracing.csproj @@ -17,9 +17,9 @@ partial - - + + - + \ No newline at end of file diff --git a/examples/AOT/AOT_Tracing/test/AOT_Tracing.Tests/AOT_Tracing.Tests.csproj b/examples/AOT/AOT_Tracing/test/AOT_Tracing.Tests/AOT_Tracing.Tests.csproj index b62601e63..f60ea6686 100644 --- a/examples/AOT/AOT_Tracing/test/AOT_Tracing.Tests/AOT_Tracing.Tests.csproj +++ b/examples/AOT/AOT_Tracing/test/AOT_Tracing.Tests/AOT_Tracing.Tests.csproj @@ -6,8 +6,8 @@ true - - + + diff --git a/examples/BatchProcessing/src/HelloWorld/HelloWorld.csproj b/examples/BatchProcessing/src/HelloWorld/HelloWorld.csproj index 7d3263e25..6387cea49 100644 --- a/examples/BatchProcessing/src/HelloWorld/HelloWorld.csproj +++ b/examples/BatchProcessing/src/HelloWorld/HelloWorld.csproj @@ -5,10 +5,10 @@ enable - + - - + + diff --git a/examples/BatchProcessing/test/HelloWorld.Test/HelloWorld.Tests.csproj b/examples/BatchProcessing/test/HelloWorld.Test/HelloWorld.Tests.csproj index 3990c0112..d4b287541 100644 --- a/examples/BatchProcessing/test/HelloWorld.Test/HelloWorld.Tests.csproj +++ b/examples/BatchProcessing/test/HelloWorld.Test/HelloWorld.Tests.csproj @@ -3,14 +3,14 @@ net8.0 - - - + + + - + - - + + diff --git a/examples/Idempotency/src/HelloWorld/HelloWorld.csproj b/examples/Idempotency/src/HelloWorld/HelloWorld.csproj index 541123243..17afff321 100644 --- a/examples/Idempotency/src/HelloWorld/HelloWorld.csproj +++ b/examples/Idempotency/src/HelloWorld/HelloWorld.csproj @@ -5,10 +5,10 @@ enable - - + + - - + + diff --git a/examples/Idempotency/test/HelloWorld.Test/HelloWorld.Tests.csproj b/examples/Idempotency/test/HelloWorld.Test/HelloWorld.Tests.csproj index 5eaf3c611..9e315eea9 100644 --- a/examples/Idempotency/test/HelloWorld.Test/HelloWorld.Tests.csproj +++ b/examples/Idempotency/test/HelloWorld.Test/HelloWorld.Tests.csproj @@ -3,8 +3,8 @@ net8.0 - - + + diff --git a/examples/Kafka/Avro/src/Avro.csproj b/examples/Kafka/Avro/src/Avro.csproj index 3729c5713..e51ab6d7a 100644 --- a/examples/Kafka/Avro/src/Avro.csproj +++ b/examples/Kafka/Avro/src/Avro.csproj @@ -15,11 +15,11 @@ - - + + - - + + diff --git a/examples/Kafka/Json/src/Json.csproj b/examples/Kafka/Json/src/Json.csproj index 7a48a2a61..e0a32a64e 100644 --- a/examples/Kafka/Json/src/Json.csproj +++ b/examples/Kafka/Json/src/Json.csproj @@ -12,11 +12,11 @@ true - - + + - - + + diff --git a/examples/Kafka/JsonClassLibrary/src/ProtoBufClassLibrary.csproj b/examples/Kafka/JsonClassLibrary/src/ProtoBufClassLibrary.csproj index 6bd8b0ccf..f058cb9a7 100644 --- a/examples/Kafka/JsonClassLibrary/src/ProtoBufClassLibrary.csproj +++ b/examples/Kafka/JsonClassLibrary/src/ProtoBufClassLibrary.csproj @@ -11,10 +11,10 @@ true - + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/examples/Kafka/Protobuf/src/Protobuf.csproj b/examples/Kafka/Protobuf/src/Protobuf.csproj index d5bd369a3..afd333524 100644 --- a/examples/Kafka/Protobuf/src/Protobuf.csproj +++ b/examples/Kafka/Protobuf/src/Protobuf.csproj @@ -12,11 +12,11 @@ true - - + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/examples/Logging/src/HelloWorld/HelloWorld.csproj b/examples/Logging/src/HelloWorld/HelloWorld.csproj index d4ce50c7d..88bb4f288 100644 --- a/examples/Logging/src/HelloWorld/HelloWorld.csproj +++ b/examples/Logging/src/HelloWorld/HelloWorld.csproj @@ -5,10 +5,10 @@ enable - - + + - - + + diff --git a/examples/Logging/test/HelloWorld.Test/HelloWorld.Tests.csproj b/examples/Logging/test/HelloWorld.Test/HelloWorld.Tests.csproj index 45785c8c8..423e5b4eb 100644 --- a/examples/Logging/test/HelloWorld.Test/HelloWorld.Tests.csproj +++ b/examples/Logging/test/HelloWorld.Test/HelloWorld.Tests.csproj @@ -3,10 +3,10 @@ net8.0 - - + + - + diff --git a/examples/Metrics/src/HelloWorld/HelloWorld.csproj b/examples/Metrics/src/HelloWorld/HelloWorld.csproj index 735f7ee14..63047f4a6 100644 --- a/examples/Metrics/src/HelloWorld/HelloWorld.csproj +++ b/examples/Metrics/src/HelloWorld/HelloWorld.csproj @@ -5,11 +5,11 @@ enable - - + + - - - + + + diff --git a/examples/Metrics/test/HelloWorld.Test/HelloWorld.Tests.csproj b/examples/Metrics/test/HelloWorld.Test/HelloWorld.Tests.csproj index 45785c8c8..423e5b4eb 100644 --- a/examples/Metrics/test/HelloWorld.Test/HelloWorld.Tests.csproj +++ b/examples/Metrics/test/HelloWorld.Test/HelloWorld.Tests.csproj @@ -3,10 +3,10 @@ net8.0 - - + + - + diff --git a/examples/Parameters/cfn/HelloWorld.Cfn/HelloWorld.Cfn.csproj b/examples/Parameters/cfn/HelloWorld.Cfn/HelloWorld.Cfn.csproj index 1a2e6d077..359dd8c1b 100644 --- a/examples/Parameters/cfn/HelloWorld.Cfn/HelloWorld.Cfn.csproj +++ b/examples/Parameters/cfn/HelloWorld.Cfn/HelloWorld.Cfn.csproj @@ -6,7 +6,7 @@ HelloWorld.Cfn - + diff --git a/examples/Parameters/src/HelloWorld/HelloWorld.csproj b/examples/Parameters/src/HelloWorld/HelloWorld.csproj index a25c2c8b3..43c59bc45 100644 --- a/examples/Parameters/src/HelloWorld/HelloWorld.csproj +++ b/examples/Parameters/src/HelloWorld/HelloWorld.csproj @@ -5,9 +5,9 @@ enable - - + + - + diff --git a/examples/Parameters/test/HelloWorld.Test/HelloWorld.Tests.csproj b/examples/Parameters/test/HelloWorld.Test/HelloWorld.Tests.csproj index 9e61b3ae5..b2d9e9c1c 100644 --- a/examples/Parameters/test/HelloWorld.Test/HelloWorld.Tests.csproj +++ b/examples/Parameters/test/HelloWorld.Test/HelloWorld.Tests.csproj @@ -3,8 +3,8 @@ net8.0 - - + + diff --git a/examples/ServerlessApi/src/LambdaPowertoolsAPI/LambdaPowertoolsAPI.csproj b/examples/ServerlessApi/src/LambdaPowertoolsAPI/LambdaPowertoolsAPI.csproj index f73c889e1..2724b0ba3 100644 --- a/examples/ServerlessApi/src/LambdaPowertoolsAPI/LambdaPowertoolsAPI.csproj +++ b/examples/ServerlessApi/src/LambdaPowertoolsAPI/LambdaPowertoolsAPI.csproj @@ -12,9 +12,9 @@ true - - - - + + + + diff --git a/examples/ServerlessApi/test/LambdaPowertoolsAPI.Tests/LambdaPowertoolsAPI.Tests.csproj b/examples/ServerlessApi/test/LambdaPowertoolsAPI.Tests/LambdaPowertoolsAPI.Tests.csproj index 205d0c9eb..4c4eacaec 100644 --- a/examples/ServerlessApi/test/LambdaPowertoolsAPI.Tests/LambdaPowertoolsAPI.Tests.csproj +++ b/examples/ServerlessApi/test/LambdaPowertoolsAPI.Tests/LambdaPowertoolsAPI.Tests.csproj @@ -16,10 +16,10 @@ - - - - + + + + diff --git a/examples/Tracing/src/HelloWorld/Function.cs b/examples/Tracing/src/HelloWorld/Function.cs index 6e0f41728..15fb65e16 100644 --- a/examples/Tracing/src/HelloWorld/Function.cs +++ b/examples/Tracing/src/HelloWorld/Function.cs @@ -87,13 +87,10 @@ public async Task FunctionHandler(APIGatewayProxyReques greeting: "Hello Powertools for AWS Lambda (.NET)", ipAddress: location); // Trace Fluent API - Tracing.WithSubsegment("LoggingResponse", - subsegment => - { - subsegment.AddAnnotation("AccountId", apigwProxyEvent.RequestContext.AccountId); - subsegment.AddMetadata("LookupRecord", lookupRecord); - }); - + using var gatewaySegment = Tracing.BeginSubsegment("LoggingResponse"); + gatewaySegment.AddAnnotation("AccountId", apigwProxyEvent.RequestContext.AccountId); + gatewaySegment.AddMetadata("LookupRecord", lookupRecord); + try { await SaveRecordInDynamo(lookupRecord); diff --git a/examples/Tracing/src/HelloWorld/HelloWorld.csproj b/examples/Tracing/src/HelloWorld/HelloWorld.csproj index 9dd8505c4..b6c4e7f84 100644 --- a/examples/Tracing/src/HelloWorld/HelloWorld.csproj +++ b/examples/Tracing/src/HelloWorld/HelloWorld.csproj @@ -5,11 +5,11 @@ enable - - + + - - - + + + diff --git a/examples/Tracing/test/HelloWorld.Test/HelloWorld.Tests.csproj b/examples/Tracing/test/HelloWorld.Test/HelloWorld.Tests.csproj index 45785c8c8..423e5b4eb 100644 --- a/examples/Tracing/test/HelloWorld.Test/HelloWorld.Tests.csproj +++ b/examples/Tracing/test/HelloWorld.Test/HelloWorld.Tests.csproj @@ -3,10 +3,10 @@ net8.0 - - + + - + diff --git a/libraries/tests/AWS.Lambda.Powertools.ModuleInitializer.Tests/EnvWrapperTests.cs b/libraries/tests/AWS.Lambda.Powertools.ModuleInitializer.Tests/EnvWrapperTests.cs index e9dc59d39..b85a95120 100644 --- a/libraries/tests/AWS.Lambda.Powertools.ModuleInitializer.Tests/EnvWrapperTests.cs +++ b/libraries/tests/AWS.Lambda.Powertools.ModuleInitializer.Tests/EnvWrapperTests.cs @@ -53,8 +53,6 @@ public void Is_PTENV_Set() Assert.NotNull(_appId); Assert.Contains("PTEnv/", _appId); _output.WriteLine(_appId); - // check that it is last in the string - Assert.EndsWith("PTEnv/", _appId, StringComparison.OrdinalIgnoreCase); } [Fact] @@ -71,8 +69,8 @@ public void SetExecutionEnvironment_Should_Have_Correct_Format() { Assert.NotNull(_appId); - // Should end with PTEnv/ - Assert.EndsWith("PTEnv/", _appId); + // Should have PTEnv/ + Assert.Contains("PTEnv/", _appId); // Should contain at least one PT/ entry var ptEntries = Regex.Matches(_appId, @"PT/[^/]+/\d+\.\d+\.\d+"); @@ -172,8 +170,8 @@ public void SetExecutionEnvironment_All_Libraries_Should_Set_All_Utilities() _output.WriteLine($"✓ Found utility: {utility}"); } - // Verify PTEnv/ is at the end - Assert.EndsWith("PTEnv/", appId); + // Verify PTEnv/ exists + Assert.Contains("PTEnv/", appId); // Verify each utility appears exactly once foreach (var utility in expectedUtilities) @@ -237,8 +235,8 @@ public void SetExecutionEnvironment_All_Libraries_Should_Set_Only_One_Utility() _output.WriteLine($"✓ Not Found utility: {utility}"); } - // Verify PTEnv/ is at the end - Assert.EndsWith("PTEnv/", appId); + // Verify PTEnv/ is present + Assert.Contains("PTEnv/", appId); // Count total PT/ entries var ptEntries = Regex.Matches(appId, @"PT/[^/]+/\d+\.\d+\.\d+"); @@ -308,8 +306,8 @@ public void SetExecutionEnvironment_Individual_Library_Should_Set_Specific_Utili // Verify the specific utility is present Assert.Contains($"PT/{expectedUtility}/", appId); - // Verify PTEnv/ is at the end - Assert.EndsWith("PTEnv/", appId); + // Verify PTEnv/ is present + Assert.Contains("PTEnv/", appId); _output.WriteLine($"Testing {expectedUtility}: {appId}"); }