Skip to content

Conversation

agocke
Copy link
Member

@agocke agocke commented Apr 12, 2023

Fixes #31284

@ghost ghost added Area-ILLink untriaged Request triage from a team member labels Apr 12, 2023
@agocke agocke changed the title Add CheckAotCompatible flag to enable all analyzers Add IsAotCompatible flag to enable all analyzers and IsTrimmable Apr 13, 2023
@agocke agocke marked this pull request as ready for review April 13, 2023 22:19
@agocke agocke requested review from AntonLapounov and a team as code owners April 13, 2023 22:19
@agocke agocke requested review from sbomer and removed request for AntonLapounov April 13, 2023 22:19
@agocke agocke closed this Apr 13, 2023
@agocke agocke reopened this Apr 13, 2023
Comment on lines 551 to 560
// The below relies on the build above being cached so that no warnings are produced
// If this fails, it's likely because the build above was not cached
var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name));
publishCommand
.Execute(RuntimeIdentifier)
.Should().Pass()
.And.NotHaveStdOutContaining("warning IL3050")
.And.NotHaveStdOutContaining("warning IL3056")
.And.NotHaveStdOutContaining("warning IL2026")
.And.NotHaveStdOutContaining("warning IL3002");
Copy link
Member

Choose a reason for hiding this comment

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

IMO - this is kind of weird behavior to test. Is there a reason we are verifying this in the test?

Copy link
Member Author

@agocke agocke Apr 14, 2023

Choose a reason for hiding this comment

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

I asked myself -- what's the difference between IsAotCompatible and PublishAot? And came up with -- IsAotCompatible just does analysis, it doesn't actually enable trimming. Seems like we should have a test to verify that they are semantically distinct.

Copy link
Member

Choose a reason for hiding this comment

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

what's the difference between IsAotCompatible and PublishAot? And came up with -- IsAotCompatible just does analysis, it doesn't actually enable trimming.

Maybe it would make more sense to verify this another way then? Using the "does it emit warnings?" as a verification for "did it publish for AOT?" doesn't seem like a direct way to verify it - especially if that rule can fail, like mentioned in the comments.

Is there a better way to check if the app was published for AOT?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe you could check for the native subdirectory that would be present if it were published for AOT.

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 think checking the warnings is fine. That's also how we verify trimming for the linker. I've changed the code to more reliably detect the warnings, so I'm not worried about caching affecting things now.

Copy link
Member

@sbomer sbomer left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-ILLink untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EnableAotAnalyzer=true should also default EnableSingleFileAnalyzer=true
3 participants