Describe the bug
Hi, the new versions of Amazon.Lambda.Tools v6.0.0 and v6.0.1 do not support comments in the aws-lambda-tools-defaults.json file, while previous v5.X versions did.
For example, given the following JSON (see the comment after function-memory-size):
Then running dotnet lambda package gives the error:
Amazon Lambda Tools for .NET Core applications (6.0.1)
Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet
Error parsing default config D:\Company.Lambdas\aws-lambda-tools-defaults.json: '/' is an invalid start of a property name. Expected a '"'. LineNumber: 11 | BytePositionInLine: 31.
I know that the JSON standard does not technically support comments, but it can be useful when the JSON is used for configuration files.
This did work in v5 and I think the change from LitJSON to System.Text.Json done in aws/aws-extensions-for-dotnet-cli#393 caused this issue. System.Text.Json does support comments but it must be enabled via JsonSerializerOptions.ReadCommentHandling.
Regression Issue
Expected Behavior
The dotnet lambda package should complete without errors.
Current Behavior
See above, the tool immediately exits with the error Error parsing default config...
Reproduction Steps
See above, use the provided JSON and run dotnet lambda package
Possible Solution
See above, update the behavior introduced in aws/aws-extensions-for-dotnet-cli#393 to use JsonSerializerOptions.ReadCommentHandling.
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
Amazon.Lambda.Tools v6.0.0 / v6.0.1
Targeted .NET Platform
.NET 8
Operating System and version
Windows 11
Describe the bug
Hi, the new versions of Amazon.Lambda.Tools v6.0.0 and v6.0.1 do not support comments in the
aws-lambda-tools-defaults.jsonfile, while previous v5.X versions did.For example, given the following JSON (see the comment after
function-memory-size):{ "Information": [ "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.", "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.", "dotnet lambda help", "All the command line options for the Lambda command can be specified in this file." ], "profile": "", "region": "ap-southeast-2", "configuration": "Release", "package-type": "image", "function-memory-size": 256, // some comment explaining reasoning "image-command": "Company.Lambdas::Company.Lambdas.LambdaEntryPoint::FunctionHandlerAsync", "docker-host-build-output-dir": "./bin/Release/lambda-publish" }Then running
dotnet lambda packagegives the error:I know that the JSON standard does not technically support comments, but it can be useful when the JSON is used for configuration files.
This did work in v5 and I think the change from LitJSON to System.Text.Json done in aws/aws-extensions-for-dotnet-cli#393 caused this issue. System.Text.Json does support comments but it must be enabled via
JsonSerializerOptions.ReadCommentHandling.Regression Issue
Expected Behavior
The
dotnet lambda packageshould complete without errors.Current Behavior
See above, the tool immediately exits with the error
Error parsing default config...Reproduction Steps
See above, use the provided JSON and run
dotnet lambda packagePossible Solution
See above, update the behavior introduced in aws/aws-extensions-for-dotnet-cli#393 to use
JsonSerializerOptions.ReadCommentHandling.Additional Information/Context
No response
AWS .NET SDK and/or Package version used
Amazon.Lambda.Tools v6.0.0 / v6.0.1
Targeted .NET Platform
.NET 8
Operating System and version
Windows 11