Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.6.0 dotnet lambda package does not copy all files from publish folder #248

Closed
stpanzer opened this issue Nov 8, 2022 · 7 comments
Closed
Labels

Comments

@stpanzer
Copy link

stpanzer commented Nov 8, 2022

Describe the bug

When running dotnet lambda package, the zip stage skips the PDB file. This breaks local debugging for SAM applications.

I've confirmed the previous behavior in 5.5.0 (see repro steps) was to copy the PDB file.

Expected Behavior

The PDB file to be copied into the zip.

Current Behavior

PDB file was not copied.

Reproduction Steps

radicaledward@work-panzer  ~/test/dotnettest  dotnet new console
The template "Console App" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /home/radicaledward/test/dotnettest/dotnettest.csproj...
  Determining projects to restore...
  Restored /home/radicaledward/test/dotnettest/dotnettest.csproj (in 62 ms).
Restore succeeded.


 radicaledward@work-panzer  ~/test/dotnettest  dotnet lambda package
Amazon Lambda Tools for .NET Core applications (5.6.0)
Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet

Executing publish command
... invoking 'dotnet publish', working folder '/home/radicaledward/test/dotnettest/bin/Release/net6.0/publish'
... dotnet publish "/home/radicaledward/test/dotnettest" --output "/home/radicaledward/test/dotnettest/bin/Release/net6.0/publish" --configuration "Release" --framework "net6.0" /p:GenerateRuntimeConfigurationFiles=true --runtime linux-x64 --self-contained False
... publish: Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
... publish: Copyright (C) Microsoft Corporation. All rights reserved.
... publish:   Determining projects to restore...
... publish:   Restored /home/radicaledward/test/dotnettest/dotnettest.csproj (in 92 ms).
... publish:   dotnettest -> /home/radicaledward/test/dotnettest/bin/Release/net6.0/linux-x64/dotnettest.dll
... publish:   dotnettest -> /home/radicaledward/test/dotnettest/bin/Release/net6.0/publish/
Changed permissions on published file (chmod +rx dotnettest).
Changed permissions on published file (chmod +rx dotnettest.pdb).
Changed permissions on published file (chmod +rx dotnettest.dll).
Changed permissions on published file (chmod +rx dotnettest.runtimeconfig.json).
Changed permissions on published file (chmod +rx dotnettest.deps.json).
Zipping publish folder /home/radicaledward/test/dotnettest/bin/Release/net6.0/publish to /home/radicaledward/test/dotnettest/bin/Release/net6.0/dotnettest.zip
... zipping:   adding: dotnettest (deflated 63%)
... zipping:   adding: dotnettest.dll (deflated 59%)
... zipping:   adding: dotnettest.runtimeconfig.json (deflated 32%)
... zipping:   adding: dotnettest.deps.json (deflated 54%)
Created publish archive (/home/radicaledward/test/dotnettest/bin/Release/net6.0/dotnettest.zip).
Lambda project successfully packaged: /home/radicaledward/test/dotnettest/bin/Release/net6.0/dotnettest.zip

Note that this works fine on 5.5.0:

radicaledward@work-panzer  ~/test/dotnettest  dotnet tool uninstall --global Amazon.Lambda.Tools
Tool 'amazon.lambda.tools' (version '5.6.0') was successfully uninstalled.
 radicaledward@work-panzer  ~/test/dotnettest  dotnet tool install --global Amazon.Lambda.Tools --version 5.5.0
You can invoke the tool using the following command: dotnet-lambda
Tool 'amazon.lambda.tools' (version '5.5.0') was successfully installed.
 radicaledward@work-panzer  ~/test/dotnettest  dotnet lambda package
Amazon Lambda Tools for .NET Core applications (5.5.0)
Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet

Executing publish command
Deleted previous publish folder
... invoking 'dotnet publish', working folder '/home/radicaledward/test/dotnettest/bin/Release/net6.0/publish'
... dotnet publish --output "/home/radicaledward/test/dotnettest/bin/Release/net6.0/publish" --configuration "Release" --framework "net6.0" /p:GenerateRuntimeConfigurationFiles=true --runtime linux-x64 --self-contained false
... publish: Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
... publish: Copyright (C) Microsoft Corporation. All rights reserved.
... publish:   Determining projects to restore...
... publish:   All projects are up-to-date for restore.
... publish:   dotnettest -> /home/radicaledward/test/dotnettest/bin/Release/net6.0/linux-x64/dotnettest.dll
... publish:   dotnettest -> /home/radicaledward/test/dotnettest/bin/Release/net6.0/publish/
Changed permissions on published file (chmod +rx dotnettest).
Changed permissions on published file (chmod +rx dotnettest.pdb).
Changed permissions on published file (chmod +rx dotnettest.dll).
Changed permissions on published file (chmod +rx dotnettest.runtimeconfig.json).
Changed permissions on published file (chmod +rx dotnettest.deps.json).
Zipping publish folder /home/radicaledward/test/dotnettest/bin/Release/net6.0/publish to /home/radicaledward/test/dotnettest/bin/Release/net6.0/dotnettest.zip
... zipping:   adding: dotnettest (deflated 63%)
... zipping:   adding: dotnettest.pdb (deflated 42%)
... zipping:   adding: dotnettest.dll (deflated 59%)
... zipping:   adding: dotnettest.runtimeconfig.json (deflated 32%)
... zipping:   adding: dotnettest.deps.json (deflated 54%)
Created publish archive (/home/radicaledward/test/dotnettest/bin/Release/net6.0/dotnettest.zip).
Lambda project successfully packaged: /home/radicaledward/test/dotnettest/bin/Release/net6.0/dotnettest.zip

Possible Solution

No response

Additional Information/Context

No response

Targeted .NET platform

6.0.302

CLI extension version

Package Id               Version         Commands
------------------------------------------------------
amazon.lambda.tools      5.6.0           dotnet-lambda
dotnet-ef                6.0.4           dotnet-ef
dotnet-symbol            1.0.212301      dotnet-symbol

Environment details (OS name and version, etc.)

WSL ubuntu

@stpanzer stpanzer added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 8, 2022
@ashishdhingra
Copy link
Contributor

@stpanzer Looks like in Amazon.Lambda.Tools version 5.6.0, the change to skip dbg and pdb files was added at

if (relativePath.EndsWith(".dbg", StringComparison.OrdinalIgnoreCase) || relativePath.EndsWith(".pdb", StringComparison.OrdinalIgnoreCase)) // Don't include debugging symbols
.

I do see in your log that you are using Release configuration per command dotnet publish "/home/radicaledward/test/dotnettest" --output "/home/radicaledward/test/dotnettest/bin/Release/net6.0/publish" --configuration "Release" --framework "net6.0" /p:GenerateRuntimeConfigurationFiles=true --runtime linux-x64 --self-contained False. The above logic appears to be common for release and debug configuration, however, unsure if we should include pdb files in Release configuration.

Needs review with the team.

Thanks,
Ashish

@ashishdhingra ashishdhingra added needs-review and removed needs-triage This issue or PR still needs to be triaged. labels Nov 8, 2022
@normj
Copy link
Member

normj commented Nov 8, 2022

@stpanzer sorry for breaking your debug workflow. I'll work on getting a fix out quickly.

For background we have been working on adding Native AOT support and we wanted to not bundle the dbg files in, the native debug symbols file, because they are huge. We were over reaching by also removing pdb files to reduce executable size which aren't even generated for Native AOT. I'll change the code to only remove dbg files to unblock you. In the future we might add back a setting to optional exclude pdb files.

@stpanzer
Copy link
Author

stpanzer commented Nov 8, 2022

@normj @ashishdhingra Thanks for the quick responses!

Given the code linked above, I assume there isn't a workaround for 5.6.0?

Unfortunately, sam build will always update to the most recent version of Amazon.Lambda.Tools - aws/aws-lambda-builders#347

I've been looking at patching the sam cli locally to stop this behavior but it's a bit more complicated than I'd hoped, and I'm no python dev 😄.

normj added a commit that referenced this issue Nov 8, 2022
Fix issue #248 where excluding pdb files from publishing broke SAM debugging
@normj
Copy link
Member

normj commented Nov 8, 2022

The code is in the pipeline for release, so unless something unusual happens the fix should be out within the next couple hours.

Only work around till then I can think of is if you pull 5.5.0 into a local folder and set the folder up as a NuGet feed. Then put a nuget.config file that only has the local feed.

@normj
Copy link
Member

normj commented Nov 9, 2022

Version 5.6.1 of Amazon.Lambda.Tools is out. Sorry again for the regression and thanks for letting us know.

@normj
Copy link
Member

normj commented Nov 10, 2022

Closing since the fix has been released.

@normj normj closed this as completed Nov 10, 2022
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants