Skip to content
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

WarningsNotAsErrors ignored for some warnings with /warnaserror option #10874

Open
rainersigwald opened this issue Oct 23, 2024 · 0 comments · May be fixed by #10892
Open

WarningsNotAsErrors ignored for some warnings with /warnaserror option #10874

rainersigwald opened this issue Oct 23, 2024 · 0 comments · May be fixed by #10892
Labels
Area: Debuggability Issues impacting the diagnosability of builds, including logging and clearer error messages. Area: Engine Issues impacting the core execution of targets and tasks. Priority:1 Work that is critical for the release, but we could probably ship without triaged

Comments

@rainersigwald
Copy link
Member

Given

<Project>
  <PropertyGroup>
    <MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
    <MSBuildWarningsNotAsErrors>ABC123</MSBuildWarningsNotAsErrors>
  </PropertyGroup>

  <Target Name="Dispatch">
    <ItemGroup>
        <P Include="$(MSBuildThisFileFullPath)" AdditionalProperties="Num=1" />
        <P Include="$(MSBuildThisFileFullPath)" AdditionalProperties="Num=2" />
        <P Include="$(MSBuildThisFileFullPath)" AdditionalProperties="Num=3" />
        <P Include="$(MSBuildThisFileFullPath)" AdditionalProperties="Num=4" />
    </ItemGroup>
    <MSBuild Projects="@(P)" BuildInParallel="true" Targets="Warn" />

  </Target>

  <Target Name="Warn">
    <Warning Code="ABC123" Text="Hello from instance $(Num) in pid $([System.Diagnostics.Process]::GetCurrentProcess().Id)" />
    <Exec Command="sleep 1" /><!-- To give worker nodes some time to spin up -->
  </Target>
</Project>

The MSBuildWarningsNotAsErrors is not consistently respected:

dotnet msbuild -m .\foo.csproj /warnaserror

  foo succeeded with 1 warning(s) (0.0s)

    C:\Users\raines\Downloads\foo.csproj(19,5): warning ABC123: Hello from instance 1 in pid 39896

  foo succeeded (0.0s)

    C:\Users\raines\Downloads\foo.csproj(19,5): error ABC123: Hello from instance 4 in pid 3804

  foo succeeded (0.0s)

    C:\Users\raines\Downloads\foo.csproj(19,5): error ABC123: Hello from instance 3 in pid 5872

  foo succeeded (0.0s)

    C:\Users\raines\Downloads\foo.csproj(19,5): error ABC123: Hello from instance 2 in pid 8016


Build failed with 3 error(s) and 1 warning(s) in 0.2s
@rainersigwald rainersigwald added Area: Debuggability Issues impacting the diagnosability of builds, including logging and clearer error messages. Area: Engine Issues impacting the core execution of targets and tasks. labels Oct 23, 2024
rainersigwald added a commit to rainersigwald/msbuild that referenced this issue Oct 25, 2024
Remote (built in another node) projects were not
respecting MSBuildWarningsNotAsErrors configured
in the projects, when the API or CLI `-warnaserror`
option was enabled.

Fixes dotnet#10874.
rainersigwald added a commit to rainersigwald/msbuild that referenced this issue Oct 25, 2024
Remote (built in another node) projects were not
respecting MSBuildWarningsNotAsErrors configured
in the projects, when the API or CLI `-warnaserror`
option was enabled.

Fixes dotnet#10874.
@rainersigwald rainersigwald linked a pull request Oct 25, 2024 that will close this issue
@maridematte maridematte added triaged Priority:1 Work that is critical for the release, but we could probably ship without labels Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Debuggability Issues impacting the diagnosability of builds, including logging and clearer error messages. Area: Engine Issues impacting the core execution of targets and tasks. Priority:1 Work that is critical for the release, but we could probably ship without triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants