Skip to content

Add NestedTypes to DynamicallyAccessedMember use #817

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

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

yaakov-h
Copy link
Contributor

@yaakov-h yaakov-h commented Aug 1, 2021

This prevents nested types - e.g. child objects or arrays of child objects - from being removed by the linker when an application is trimmed.

This only works at the moment in currently unreleased versions of the .NET SDK (e.g. v6.0.100-rc.1.21381.5). It does not work in any publicly released preview up to and including .NET 6 Preview 6.

I observed this when trying to make SteamKit trimmable and when trying to produce trimmed builds of DepotDownloader. Whilst simply "not having child objects" could be considered a valid workaround, we build directly from reverse-engineered protobuf files that we have no real control over.

See dotnet/linker#2185 for more information about use of the attribute.

This prevents nested types - e.g. child objects or arrays of child
objects - from being removed by the linker when an application is
trimmed.

This only works at the moment in current unreleased versions of the
.NET SDK (e.g. .NET 6 rc.1.21381.5). It does not work in any publicly
released preview up to and including .NET 6 Preview 6.

See dotnet/linker#2185 for more information.
@mgravell mgravell merged commit ca2148a into protobuf-net:main Aug 30, 2024
@mgravell
Copy link
Member

Sorry for delay; merging with thanks; will plan a deploy

@yaakov-h yaakov-h deleted the dotnet-trimming branch September 1, 2024 06:38
@xPaw
Copy link
Contributor

xPaw commented Oct 22, 2024

@mgravell can we get a new release with this please?

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

Successfully merging this pull request may close these issues.

3 participants