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

Set partial trimming #265

Merged
merged 7 commits into from
May 2, 2023
Merged

Set partial trimming #265

merged 7 commits into from
May 2, 2023

Conversation

gord5500
Copy link
Contributor

@gord5500 gord5500 commented May 2, 2023

Why

The published build of bmx right now will crash with the error No parameterless constructor defined for type 'Amazon.Util.Internal.PlatformServices.NetworkReachability'

https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trim-self-contained

When building bmx with aot, we reduce the deployment size by getting rid of unused parts of libraries. Theres a problem though with the aws sdk right now where it gets rid of some parts we actually need. I think it's to do with this

How

The github issue page mentioned a temporary solution to set the trim mode to partial for now. The build size would be 17.5MB compared to 13 so it seems like not a big issue?

@github-actions github-actions bot added size/XS A very small PR - good job! and removed size/S A small PR. labels May 2, 2023
@gord5500 gord5500 marked this pull request as ready for review May 2, 2023 14:23
Copy link
Member

@boarnoah boarnoah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find, we will likely want to revisit this in a while to see if its needed anymore.

@gord5500 gord5500 merged commit 32e1eb4 into main May 2, 2023
@gord5500 gord5500 deleted the set_partial_trimming branch May 2, 2023 14:25
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're adding a BOM here. Did you use VS to edit this file? Can you set the encoding to be without BOM?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our editorconfig does set utf-8 (which means without BOM), but VS just doesn't respect that... 😠

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the linter we use is unfortunately not able to catch charset violations
editorconfig-checker/editorconfig-checker#85

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I saw that and thought it was weird and did edit through VS. I'll make a new pr to fix it

@cfbao
Copy link
Member

cfbao commented May 2, 2023

I believe there's a way to scope what we trim/don't trim to specific assemblies via a config file. It might be able to reduce binary size a bit without touching the "fragile" assemblies (e.g. AWS ones).
Not a priority as 17.5 MB isn't a big deal.

@gord5500 gord5500 mentioned this pull request May 2, 2023
gord5500 added a commit that referenced this pull request May 5, 2023
### Why

#265 (comment)
I didn't realize that's what was happening. I looked over and thought I
changed the naming or something but saw they were the same. Did not know
byte order mark was a thing 😅
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language/csharp size/XS A very small PR - good job!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants