Skip to content

Switch to built-in IsTrimmable property #41021

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 3 commits into from
Apr 7, 2022
Merged

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Apr 3, 2022

Fixes #41016

@JamesNK JamesNK added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Apr 3, 2022
@JamesNK
Copy link
Member Author

JamesNK commented Apr 3, 2022

Trimming analyzers are finding new errors and breaking a lot.

@JamesNK
Copy link
Member Author

JamesNK commented Apr 3, 2022

A new issue for fixing the NullReferenceException and NotImplementedException errors in analyzer - dotnet/linker#2718

The analyzer is finding errors that ILLink didn't report. Is that expected? I thought ILLinker was the authority but it seems like analyzers and the linker each contribute different warnings.

cc @eerhardt @agocke

@agocke
Copy link
Member

agocke commented Apr 4, 2022

We've been trying to match the warnings provided by the linker in the analyzer, so that's likely why you're hitting new issues. The analyzer is undergoing significant development, so these are new bugs that are introduced. If you file bugs we should fix them ASAP.

The linker is basically the authority, and any bug where the analyzer is different is likely a bug in the analyzer -- with a few minimal exceptions around things that can't be properly represented in metadata.

Thanks for turning this on, we can look through and investigate the problems.

@JamesNK
Copy link
Member Author

JamesNK commented Apr 6, 2022

It will take time for analyzer fixes to be made and the dependency to flow to aspnetcore. I'll keep IsTrimmable but update this PR to disable analyzers. Can reenable once they're fixed.

@JamesNK
Copy link
Member Author

JamesNK commented Apr 6, 2022

@dougbu @wtgodbe Could you review/approve these build changes?

@@ -42,4 +42,10 @@
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
</PropertyGroup>

<!-- Trim analyzers are automatically enabled by IsTrimming=true. They currently break when run on aspnetcore.
Remove when trimming analyzers are fixed: https://github.com/dotnet/aspnetcore/issues/41016 -->
Copy link
Member

Choose a reason for hiding this comment

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

Would it make more sense to link to the linker issue? That way people finding this comment can go directly to the linker issue and see if it is fixed yet or not.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm going to leave the aspnetcore issue open with a link to the linker issue.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

LGTM. Just one minor nit about the comment.

<!-- Trim analyzers are automatically enabled by IsTrimming=true. They currently break when run on aspnetcore.
Remove when trimming analyzers are fixed: https://github.com/dotnet/aspnetcore/issues/41016 -->
<PropertyGroup>
<EnableTrimAnalyzer Condition=" '$(EnableTrimAnalyzer)' == ''">false</EnableTrimAnalyzer>
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see this set anywhere else. Why include the Condition

Copy link
Member Author

Choose a reason for hiding this comment

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

Just in case we want to enable for some projects later to test whether it works or not.

Copy link
Contributor

Choose a reason for hiding this comment

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

/fyi the Condition doesn't help that case much because projects are read after Directory.Build.props files and (therefore) this file. The project can therefore override any property it likes (as long as it doesn't use a != '' Condition of course).

But my comment was definitely a nit.

Copy link
Contributor

@dougbu dougbu left a comment

Choose a reason for hiding this comment

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

Just one nit 😃

@JamesNK JamesNK merged commit f08ae33 into main Apr 7, 2022
@JamesNK JamesNK deleted the jamesnk/rename-trimmable branch April 7, 2022 00:02
@ghost ghost added this to the 7.0-preview4 milestone Apr 7, 2022
@sbomer sbomer mentioned this pull request May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Trimming] Consider using standard <IsTrimmable> property
4 participants