Skip to content

[preview4] Fix SuppressTrimAnalysisWarnings#17051

Merged
sbomer merged 2 commits intodotnet:release/6.0.1xx-preview4from
sbomer:fixSuppressP4
Apr 21, 2021
Merged

[preview4] Fix SuppressTrimAnalysisWarnings#17051
sbomer merged 2 commits intodotnet:release/6.0.1xx-preview4from
sbomer:fixSuppressP4

Conversation

@sbomer
Copy link
Copy Markdown
Member

@sbomer sbomer commented Apr 20, 2021

Porting #17050 to preview4.

This needs to be set before the .NET SDK targets get imported, otherwise
the .NET defaults win.
@ghost
Copy link
Copy Markdown

ghost commented Apr 20, 2021

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@sbomer sbomer requested a review from agocke April 20, 2021 22:08
publishCommand.Execute().Should().Pass()
.And.NotHaveStdOutContaining("warning IL");

var publishDirectory = publishCommand.GetOutputDirectory(DefaultTfm);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Which tfm is this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should be net6. It comes from

<SdkTargetFramework>net6.0</SdkTargetFramework>

which gets set as metadata on the test assembly in

<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>AspNetTestTfm</_Parameter1>
<_Parameter2>$(SdkTargetFramework)</_Parameter2>
</AssemblyAttribute>

and this is picked up in the test infra:
DefaultTfm = testAssemblyMetadata.SingleOrDefault(a => a.Key == "AspNetTestTfm").Value;

FWIW I did check that the test produces warnings if I set SuppressTrimAnalysisWarnings=false and this causes it to fail.

Copy link
Copy Markdown
Member

@agocke agocke left a comment

Choose a reason for hiding this comment

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

LGTM

@sbomer sbomer merged commit 1492fa8 into dotnet:release/6.0.1xx-preview4 Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants