aws-lambda-dotnet
aws-lambda-dotnet copied to clipboard
dotnet-lambda package-ci throws an exception with signed dll
Describe the bug
Getting /usr/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(463,5): error : Error: Unexpected CodeView data signature value if signed dll included in project and PublishReadyToRun set to true, when running dotnet-lambda package-ci.
Expected Behavior
Published with no errors.
Current Behavior
error 19-Jul-2022 01:02:58 + echo Packaging Lambda ... error 19-Jul-2022 01:02:58 + dotnet-lambda package-ci -t /home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/deploy/../src/auth.template -c Release -f net6.0 -sb cdm-deploy-dev -sp auth/ -ot /home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/deploy/../deploy/out/auth-ci-master-nightly-989.cf.0 --region eu-west-1 build 19-Jul-2022 01:02:58 build 19-Jul-2022 01:02:58 Packaging Lambda ... build 19-Jul-2022 01:02:58 Amazon Lambda Tools for .NET Core applications (5.4.4) build 19-Jul-2022 01:02:58 Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet build 19-Jul-2022 01:02:58 build 19-Jul-2022 01:02:59 Processing CloudFormation resource ApiGatewayApi build 19-Jul-2022 01:02:59 Processing CloudFormation resource ApiFunction build 19-Jul-2022 01:02:59 Initiate packaging of ./Trimble.CDMService.Authorizer.API for resource ApiFunction build 19-Jul-2022 01:02:59 Executing publish command build 19-Jul-2022 01:02:59 ... invoking 'dotnet publish', working folder '/home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/deploy/../src/./Trimble.CDMService.Authorizer.API/bin/Release/net6.0/publish' build 19-Jul-2022 01:02:59 ... dotnet publish --output "/home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/deploy/../src/./Trimble.CDMService.Authorizer.API/bin/Release/net6.0/publish" --configuration "Release" --framework "net6.0" /p:GenerateRuntimeConfigurationFiles=true --runtime linux-x64 --self-contained false build 19-Jul-2022 01:02:59 ... publish: Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET build 19-Jul-2022 01:02:59 ... publish: Copyright (C) Microsoft Corporation. All rights reserved. build 19-Jul-2022 01:02:59 ... publish: Determining projects to restore... build 19-Jul-2022 01:03:00 ... publish: Restored /home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/src/Trimble.CDMService.Authorizer.API/Trimble.CDMService.Authorizer.API.csproj (in 452 ms). build 19-Jul-2022 01:03:00 ... publish: /usr/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(1114,5): warning NETSDK1179: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used. [/home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/src/Trimble.CDMService.Authorizer.API/Trimble.CDMService.Authorizer.API.csproj] build 19-Jul-2022 01:03:01 ... publish: Trimble.CDMService.Authorizer.API -> /home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/src/Trimble.CDMService.Authorizer.API/bin/Release/net6.0/linux-x64/Trimble.CDMService.Authorizer.API.dll build 19-Jul-2022 01:03:15 ... publish: /usr/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(463,5): error : Error: Unexpected CodeView data signature value. [/home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/src/Trimble.CDMService.Authorizer.API/Trimble.CDMService.Authorizer.API.csproj] build 19-Jul-2022 01:03:15 ... publish: /usr/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(463,5): error : System.BadImageFormatException: Unexpected CodeView data signature value. [/home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/src/Trimble.CDMService.Authorizer.API/Trimble.CDMService.Authorizer.API.csproj] build 19-Jul-2022 01:03:15 ... publish: /usr/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(463,5): error : at System.Reflection.PortableExecutable.PEReader.DecodeCodeViewDebugDirectoryData(AbstractMemoryBlock block) [/home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/src/Trimble.CDMService.Authorizer.API/Trimble.CDMService.Authorizer.API.csproj] build 19-Jul-2022 01:03:15 ... publish: /usr/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(463,5): error : at System.Reflection.PortableExecutable.PEReader.ReadCodeViewDebugDirectoryData(DebugDirectoryEntry entry) [/home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/src/Trimble.CDMService.Authorizer.API/Trimble.CDMService.Authorizer.API.csproj] build 19-Jul-2022 01:03:15 ... publish: /usr/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.CompilerTypeSystemContext.OpenAssociatedSymbolFile(String peFilePath, PEReader peReader) [/home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/src/Trimble.CDMService.Authorizer.API/Trimble.CDMService.Authorizer.API.csproj] build 19-Jul-2022 01:03:15 ... publish: /usr/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.CompilerTypeSystemContext.AddModule(String filePath, String expectedSimpleName, Boolean useForBinding, ModuleData oldModuleData) [/home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/src/Trimble.CDMService.Authorizer.API/Trimble.CDMService.Authorizer.API.csproj] build 19-Jul-2022 01:03:15 ... publish: /usr/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.CompilerTypeSystemContext.GetOrAddModuleFromPath(String filePath, Boolean useForBinding) [/home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/src/Trimble.CDMService.Authorizer.API/Trimble.CDMService.Authorizer.API.csproj] build 19-Jul-2022 01:03:15 ... publish: /usr/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.CompilerTypeSystemContext.GetModuleFromPath(String filePath) [/home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/src/Trimble.CDMService.Authorizer.API/Trimble.CDMService.Authorizer.API.csproj] build 19-Jul-2022 01:03:15 ... publish: /usr/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.Program.Run(String[] args) [/home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/src/Trimble.CDMService.Authorizer.API/Trimble.CDMService.Authorizer.API.csproj] build 19-Jul-2022 01:03:15 ... publish: /usr/share/dotnet/sdk/6.0.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(463,5): error : at ILCompiler.Program.Main(String[] args) [/home/centos/bamboo-agent-home/xml-data/build-dir/FE-CNB-JOB1/src/Trimble.CDMService.Authorizer.API/Trimble.CDMService.Authorizer.API.csproj]
Error: Unexpected CodeView data signature value gets repeated for all projects that attempted to pack.
Reproduction Steps
Sign a project dll with signtool 10.0.18362.0.
Create a NuGet of it.
Include it in the main project.
In the main project set PublishReadyToRun to true.
run dotnet-lambda package-ci -t -c Release -f net6.0 -sb
Possible Solution
Reasons: Included singed in dll. Included in the project (getting as NuGet). In the main project, PublishReadyToRun is set to true.
Additional Information/Context
The tool to sign the dll is signtool v 10.0.18362.0. DLL is packed in NuGet. (NuGet singed) If dll is not signed or PublishReadyToRun set to false no error is thrown. is
AWS .NET SDK and/or Package version used
Amazon Lambda Tools for .NET Core applications (5.4.4)
Targeted .NET Platform
.Net 6
Operating System and version
WSL Ubuntu 20.04