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

[dotnet] Missing mono-cil-strip (or alternative) #11445

Closed
spouliot opened this issue May 5, 2021 · 7 comments · Fixed by #12563
Closed

[dotnet] Missing mono-cil-strip (or alternative) #11445

spouliot opened this issue May 5, 2021 · 7 comments · Fixed by #12563
Assignees
Labels
dotnet An issue or pull request related to .NET (6) dotnet-pri1 .NET 6: important for stable release
Milestone

Comments

@spouliot
Copy link
Contributor

spouliot commented May 5, 2021

Release builds should strip all IL from assemblies (the one that were AOT'ed) to minimize the final app bundle size.

This is done using mono-cil-strip for the legacy SDK. However this tools ships with the Mono SDK and there is not, so far, a package (or an alternative tool) to achieve the same for dotnet SDK.

@spouliot spouliot added dotnet An issue or pull request related to .NET (6) dotnet-pri1 .NET 6: important for stable release dotnet-external-dependency .NET: this issue/pull request is blocked on external work labels May 5, 2021
@spouliot spouliot added this to the .NET 6 milestone May 5, 2021
@spouliot
Copy link
Contributor Author

spouliot commented May 5, 2021

c.c. @marek-safar

@marek-safar
Copy link
Contributor

Yep, it's going to be part of the runtime provided AOT tooling.

/cc @lewing

spouliot added a commit to spouliot/xamarin-macios that referenced this issue May 5, 2021
- Make git ignore the generated `report.md`
- Fix `.aotdata` reported total size in reports (was always 0)
- Add option to strip the dotnet app bundle (until [1]) so it's easier to compare with _oldnet_ sizes.

[1] xamarin#11445
spouliot added a commit that referenced this issue May 5, 2021
- Make git ignore the generated `report.md`
- Fix `.aotdata` reported total size in reports (was always 0)
- Add option to strip the dotnet app bundle (until [1]) so it's easier to compare with _oldnet_ sizes.

[1] #11445
@steveisok
Copy link
Contributor

@marek-safar was the thinking we would get this tool ported out of wasm? I asked @lewing about it and it's low priority for him.

@steveisok
Copy link
Contributor

This is something my team will handle. Will need a little bit of time

@akoeplinger
Copy link
Member

@rolfbjarne @spouliot this is available now: dotnet/runtime#57359

@rolfbjarne
Copy link
Member

@akoeplinger it seems to use the latest version of Cecil, and iirc the reason we were never able to use a newer version of Cecil was that newer versions would change the metadata tokens when writing out the stripped assembly, and that broke us. Is that not an issue anymore?

@akoeplinger
Copy link
Member

@rolfbjarne it does not use the latest version of Cecil, it embeds the old Cecil into the assembly until we can finish the rewrite on top of System.Reflection.Metadata.

@rolfbjarne rolfbjarne removed the dotnet-external-dependency .NET: this issue/pull request is blocked on external work label Aug 18, 2021
chamons added a commit that referenced this issue Oct 5, 2021
- Controlled by EnableAssemblyILStripping which defaults to true
- Integration test included

Before - https://gist.github.com/chamons/c7886f7bacbc2e5ac5966e4251d13e71
After - https://gist.github.com/chamons/148e1bef22fa336f953f3d02dcf20667

859,136 -> 527,872 managed

Fixes #11445.
@ghost ghost locked as resolved and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dotnet An issue or pull request related to .NET (6) dotnet-pri1 .NET 6: important for stable release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants