Closed JanKrivanek closed 1 month ago
team triage: let's investigate the reason then decide
One cause is in skipping the check for events that don't have ProjectInstanceId set to invalid values:
But that is what happens for Evaluation time events (more details: https://github.com/dotnet/msbuild/blob/main/documentation/wiki/Binary-Log.md#meaning-of-various-ids-in-the-buildeventargs)
So if the warning is emited during eval - it will skip here
And more fundametely - it's one of the problems from the huge bucket of 'we need information from evaluation in order to process something earlier in the evaluation for BuildChecks'.
And it's even more intricate than that - the noWarn/WarnAsError/TreatWarnings as errors are being done during logging in the node that build the project, it's already not set in the main node. But majority of our Checks run in the main node.
We'll need to set it in the main node as well
Initial version of deferring: https://github.com/dotnet/msbuild/compare/main...proto/buildcheck-warns-promotability
The setting of warn to error etc. in the main node will need to be added as well
Context
MSBuildTreatWarningsAsErrors
andMSBuildWarningsAsErrors
seem to apply only to BuildCheck diagnostics produced by the 'in-node' check (BC0201-BC0203). The behavior should be consistent and ideally apply to all Checks - built-in and custom.Sample case
Case showing some diagnostics are promoted while some are not:
Repro
csproj:
.editorconfig:
Run:
$env:CalculatorVersion=1.2.3
dotnet build /check
Expected: All Diagnostics are promoted to errors (as per
MSBuildTreatWarningsAsErrors
) Observed:BC0103
remains as warningNotes
MSBuildTreatWarningsAsErrors
and verify it works properly. The e2e tests might be easier way of investigating the case for custom checks.