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

Don't suppress trim analysis warnings when linking all assemblies #11246

Closed
sbomer opened this issue Apr 20, 2021 · 2 comments
Closed

Don't suppress trim analysis warnings when linking all assemblies #11246

sbomer opened this issue Apr 20, 2021 · 2 comments
Labels
dotnet An issue or pull request related to .NET (6) enhancement The issue or pull request is an enhancement good first issue This is a good first issue for someone to start working with our code
Milestone

Comments

@sbomer
Copy link
Contributor

sbomer commented Apr 20, 2021

dotnet/sdk#16865 adds a property (available in preview4) TrimmerDefaultAction which can be set to link to enable "LinkAll" behavior. Consider not suppressing trim analysis warnings in this case to warn users about possible issues.

This can be done by setting the following in some targets that are imported after the project file but before the .NET illink targets (so that it takes into account any user-set value for TrimmerDefaultAction):

<SuppressTrimAnalysisWarnings Condition="'$(SuppressTrimAnalysisWarnings)' == '' And '$(TrimmerDefaultAction)' != 'link'">true</SuppressTrimAnalysisWarnings> 

and removing the unconditional setting from here:

<SuppressTrimAnalysisWarnings Condition=" '$(SuppressTrimAnalysisWarnings)' == '' ">true</SuppressTrimAnalysisWarnings>

@jonathanpeppers @marek-safar

See also #10405.

@marek-safar
Copy link
Contributor

/cc @spouliot

@mandel-macaque mandel-macaque added the enhancement The issue or pull request is an enhancement label Apr 20, 2021
@mandel-macaque mandel-macaque added this to the Future milestone Apr 20, 2021
@spouliot spouliot modified the milestones: Future, .NET 6 Apr 20, 2021
spouliot pushed a commit to spouliot/xamarin-macios that referenced this issue Apr 20, 2021
vs-mobiletools-engineering-service2 pushed a commit to vs-mobiletools-engineering-service2/xamarin-macios that referenced this issue Apr 22, 2021
@spouliot spouliot removed their assignment Sep 14, 2021
@rolfbjarne rolfbjarne added the dotnet An issue or pull request related to .NET (6) label Feb 9, 2022
@rolfbjarne rolfbjarne modified the milestones: .NET 6, .NET 7 Feb 9, 2022
@rolfbjarne rolfbjarne modified the milestones: .NET 7, .NET 8 Aug 26, 2022
@rolfbjarne rolfbjarne added the good first issue This is a good first issue for someone to start working with our code label Aug 26, 2022
@rolfbjarne rolfbjarne modified the milestones: .NET 8, .NET 9 Sep 12, 2023
@github-project-automation github-project-automation bot moved this to Technical Debt in .NET 9 Aug 27, 2024
@rolfbjarne rolfbjarne modified the milestones: .NET 9, .NET 10 Sep 27, 2024
rolfbjarne added a commit that referenced this issue Sep 27, 2024
Our own code shouldn't produce trim analysis warnings anymore (see #10405), so
we don't need to suppress trim analysis warnings for everyone.

Fixes #11246.
@rolfbjarne
Copy link
Member

We've implemented this for .NET 9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet An issue or pull request related to .NET (6) enhancement The issue or pull request is an enhancement good first issue This is a good first issue for someone to start working with our code
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants