Skip to content

Conversation

@jkurdek
Copy link
Contributor

@jkurdek jkurdek commented Jul 26, 2022

Implementation of the feature described in #2891.

\cc @vitek-karas

@vitek-karas
Copy link
Member

We need to make this off-by-default - in the MSBuild parts by suppressing the warning by default for now.
@sbomer - any idea exactly how to go about it (so that it's possible to "unsuppress" it somehow).

@vitek-karas
Copy link
Member

@tlakollo could you please take a look?

Copy link
Contributor

@tlakollo tlakollo left a comment

Choose a reason for hiding this comment

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

I think it would be also interesting to test if compiler generated code like yields and async can produce the redundant warning suppression, it likely works but just in case. In general looks good to me

@sbomer
Copy link
Member

sbomer commented Jul 29, 2022

We need to make this off-by-default - in the MSBuild parts by suppressing the warning by default for now.
@sbomer - any idea exactly how to go about it (so that it's possible to "unsuppress" it somehow).

Ideally it would be suppressed the same as any other warnings with NoWarn under SuppressTrimAnalysisWarnings - but I assume the idea is that it should be separate from the other trim warnings until we are able to prune these down to only ones that are truly redundant? In that case, maybe we could give the new warnings a new warning version - 8 would make them show up only for .net 8. Or if we want these to forever be opt-in because we lack confidence that we can make them not noisy, then I would just add a new command-line flag that you would set from MSBuild with <_ExtraTrimmerArgs>--enable-redundant-suppression-detection</_ExtraTrimmerArgs> or similar.

@vitek-karas
Copy link
Member

I guess the command line option is the simplest... I really hoped we would be able to do this purely through warning system, but the warning level feels weird (we don't use it for anything... not sure we should start).

@sbomer
Copy link
Member

sbomer commented Jul 29, 2022

Another option that avoids a command-line argument would be to introduce a separate MSBuild flag that controls whether NoWarn includes the new warning code(s). Something like:

<PropertyGroup Condition="'$(_TrimmerShowRedundantSuppressions)' != 'true'">
    <NoWarn>$(NoWarn);IL2121</NoWarn>
</PropertyGroup>

But if we are planning for this to be turned on by default in the future I would lean towards using warning waves.

@jkurdek jkurdek requested a review from sbomer as a code owner August 1, 2022 14:53
Copy link
Member

@vitek-karas vitek-karas left a comment

Choose a reason for hiding this comment

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

Looks good

@sbomer, could you please quickly check the MSBuild integration?

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.

I didn't review the entire change, but the MSBuild logic looks good to me. Thanks!

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.

4 participants