-
Notifications
You must be signed in to change notification settings - Fork 531
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
[trimming] TrimMode=full
in debug mode, should enable analyzers
#9320
[trimming] TrimMode=full
in debug mode, should enable analyzers
#9320
Conversation
[TestCase ("TrimMode=full", new string [0], false)] | ||
[TestCase ("TrimMode=full", new string [] { "IL2055" }, false, 1)] | ||
[TestCase ("TrimMode=full", new string [] { "IL2055" }, true, 2)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that you will get 2x warnings in Release
, one from the trimmer and one from the Roslyn analyzer. This is "by design", and we shouldn't try to hide them or anything.
This comment was marked as outdated.
This comment was marked as outdated.
d62de7d
to
a622ac2
Compare
For AOT scenarios, projects would set: <PublishAot>true</PublishAot> For both `Debug` and `Release`, this allows you to get the same set of analyzers in both configurations. You'd want to see the same warnings for both. For Android, the project template is currently doing: <PropertyGroup Condition="'$(Configuration)' == 'Release'"> <TrimMode>Full</TrimMode> </PropertyGroup> But this would result in a *different* set of warnings between `Debug` and `Release` mode! Instead, we can do: <PropertyGroup> <TrimMode>Full</TrimMode> </PropertyGroup> And then add a new default, such as: <EnableTrimAnalyzer Condition="'$(EnableTrimAnalyzer)' == '' and '$(TrimMode)' == 'full'">true</EnableTrimAnalyzer> `TrimMode=Full` does *not* enable the trimmer, so other defaults in `Debug` should remain unchanged. So, the new behavior is: * `Configuration=Debug` * `PublishTrimmed=false` (default, no trimmer) * `TrimMode=Full` (project template) * `EnableTrimAnalyzer=true` (new default) * You get the same warnings in `Debug` and `Release` mode. I also reworded the commend in the project template slightly, to mention it enables analyzers.
a622ac2
to
5ff483a
Compare
Draft commit message: For AOT scenarios, projects would set:
<PublishAot>true</PublishAot>
For both `Debug` and `Release`, this allows you to get the same set
of analyzers in both configurations. You'd want to see the same
warnings for both.
For Android, the project template is currently doing:
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TrimMode>Full</TrimMode>
</PropertyGroup>
but this would result in a *different* set of warnings between
`Debug` and `Release` configuration builds!
Instead, we can do:
<PropertyGroup>
<TrimMode>Full</TrimMode>
</PropertyGroup>
And then add a new default, such as:
<EnableTrimAnalyzer
Condition=" '$(EnableTrimAnalyzer)' == '' and '$(TrimMode)' == 'full' "
>true</EnableTrimAnalyzer>
`$(TrimMode)=Full` does *not* enable the trimmer, so other defaults
in the `Debug` configuration build should remain unchanged.
So, the new behavior is:
* `$(Configuration)=Debug`
* `$(PublishTrimmed)=false` (default, no trimmer)
* `$(TrimMode)=Full` (project template)
* `$(EnableTrimAnalyzer)=true` (new default)
* You get the same set of warnings in `Debug` and `Release`
configuration builds.
I also reworded the comment in the project template slightly, to
mention it enables analyzers. @jonathanpeppers : one question about that commit message: you say:
"new behavior" implies a change in behavior. The default |
I think I just missed the word “for” like: For Configuration=Debug |
For NativeAOT scenarios, projects would set:
For both
Debug
andRelease
, this allows you to get the same set of analyzers in both configurations. You'd want to see the same warnings for both.For Android, the project template is currently doing:
But this would result in a different set of warnings between
Debug
andRelease
mode!Instead, we can do:
And then add a new default, such as:
TrimMode=Full
does not enable the trimmer, so other defaults inDebug
should remain unchanged.So, the new behavior is:
Configuration=Debug
PublishTrimmed=false
(default, no trimmer)TrimMode=Full
(project template)EnableTrimAnalyzer=true
(new default)Debug
andRelease
mode.I also reworded the commend in the project template slightly, to mention it enables analyzers.