-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
PublishAot doesn't respect TreatWarningsAsErrors #94178
Comments
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsDescriptionWhen publishing an app for AOT, and However, when I We should be consistent in our behavior between these 2 publish operations and TreatWarningsAsErrors. Reproduction StepsIn your .csproj: <PublishAot>true</PublishAot>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> And have trim warnings in your app. Expected behaviorThe publish should fail because I have warnings and Actual behaviorThe trim/AOT warnings are emitted as warnings, but these warnings were not treated as errors, and my publish succeeds. Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationcc @vitek-karas @agocke @MichalStrehovsky
|
/cc: @simonrozsival |
runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logger.cs Lines 158 to 162 in 6d76479
😞 This brings up an interesting behavior of MSBuild - Setting I do agree that we should implement this to get parity between the tools, regardless of the confusing behavior of MSBuild in this case. |
Both roslyn and trimmer implement "warn as error" as a compiler feature - specifically the `TreatWarningsAsErrors` property only affects tools which explicitly react to it. There's a related MSBuild command line option which will affect all warnings, but that's not the one VS sets from the UI and what most customers use. See the comments in #94178. This implements the same behavior as the trimmer. It adds 3 new command line options to `ilc` and enable "warn as error" globally and to enable/disable specific warning codes. Note that `illink` implements a more complex command line parsing where order of parameters matters and sometimes the later ones can override the earlier ones. This was trying to emulate `csc` behavior. For `ilc` I don't see a reason to emulate that because running `ilc` on its own is not supported, only going through the SDK, which will never pass the new parameters multiple times. For testing this enables the existing trimmer tests for this functionality. This uncovered a small issue in substitution parser, which is also fixed here. For simplicity the test infra emulates the `illink` command line behavior over `ilc` (which is easy as they're very similar).
#96567 implements the same behavior as |
…6567) Both roslyn and trimmer implement "warn as error" as a compiler feature - specifically the `TreatWarningsAsErrors` property only affects tools which explicitly react to it. There's a related MSBuild command line option which will affect all warnings, but that's not the one VS sets from the UI and what most customers use. See the comments in dotnet#94178. This implements the same behavior as the trimmer. It adds 3 new command line options to `ilc` and enable "warn as error" globally and to enable/disable specific warning codes. Note that `illink` implements a more complex command line parsing where order of parameters matters and sometimes the later ones can override the earlier ones. This was trying to emulate `csc` behavior. For `ilc` I don't see a reason to emulate that because running `ilc` on its own is not supported, only going through the SDK, which will never pass the new parameters multiple times. For testing this enables the existing trimmer tests for this functionality. This uncovered a small issue in substitution parser, which is also fixed here. For simplicity the test infra emulates the `illink` command line behavior over `ilc` (which is easy as they're very similar).
Description
When publishing an app for AOT, and
TreatWarningsAsErrors=true
, if there are trim/AOT warnings, the publish doesn't fail as errors.However, when I
<PublishTrimmed>true</PublishTrimmed>
the same app (with the same trimming warnings), the publish fails.We should be consistent in our behavior between these 2 publish operations and TreatWarningsAsErrors.
Reproduction Steps
In your .csproj:
And have trim warnings in your app.
Expected behavior
The publish should fail because I have warnings and
TreatWarningsAsErrors=true
.Actual behavior
The trim/AOT warnings are emitted as warnings, but these warnings were not treated as errors, and my publish succeeds.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
cc @vitek-karas @agocke @MichalStrehovsky
The text was updated successfully, but these errors were encountered: