Skip to content

Treat warnings as errors in release builds #9719

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

Merged
merged 6 commits into from
Aug 5, 2025

Conversation

drewnoakes
Copy link
Member

@drewnoakes drewnoakes commented Aug 4, 2025

Lately we've started seeing warnings creeping into the codebase. These should be caught by CI and prevented.

To make it easier to reproduce CI behaviour locally, this setting is enabled for release builds. If CI fails and you want to recreate the error locally, switch to release mode and build.

Microsoft Reviewers: Open in CodeFlow

Lately we've started seeing warnings creeping into the codebase. These should be caught by CI and prevented.

To make it easier to reproduce CI behaviour locally, this setting is enabled for release builds. If CI fails and you want to recreate the error locally, switch to release mode and build.
@drewnoakes drewnoakes requested a review from a team as a code owner August 4, 2025 03:59
@drewnoakes
Copy link
Member Author

I expect the build of this first commit to fail due to the warnings. Will push up a fix for those warnings next.

@drewnoakes drewnoakes added the Area-Infrastructure Relates to build, test & run infrastructure of this repo. label Aug 4, 2025
The XAML code generator produces code that uses `XamlServices`, which is obsolete. Unfortunately there doesn't seem to be a way to suppress these warnings without modifying the code generator. Therefore, we allow just this one warning to be not treated as an error.
Copy link
Contributor

@LittleLittleCloud LittleLittleCloud left a comment

Choose a reason for hiding this comment

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

LGTM

@drewnoakes
Copy link
Member Author

Build failed as more warnings snuck in :)

@drewnoakes
Copy link
Member Author

drewnoakes commented Aug 5, 2025

@LittleLittleCloud I think one of the recently added tests is flakey. I've seen it fail intermittently recently.

error : [xUnit.net 00:00:21.83] BuildProjectAndWaitForCompletionAsync_BuildsSequentiallyWhenCalledInParallel [FAIL] [D:\a_work\1\s\tests\Microsoft.VisualStudio.ProjectSystem.Managed.VS.UnitTests\Microsoft.VisualStudio.ProjectSystem.Managed.VS.UnitTests.csproj]

at Microsoft.VisualStudio.ProjectSystem.VS.Build.SolutionBuildManagerTests.<BuildProjectAndWaitForCompletionAsync_BuildsSequentiallyWhenCalledInParallel>d__1.MoveNext() in D:\a_work\1\s\tests\Microsoft.VisualStudio.ProjectSystem.Managed.VS.UnitTests\ProjectSystem\VS\Build\SolutionBuildManagerTests.cs:line 151

Second build should start after the first build
Expected: True
Actual:   False

@drewnoakes
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@drewnoakes
Copy link
Member Author

I think I see why it could be flakey. Pushing up a fix.

@drewnoakes drewnoakes merged commit 642b738 into dotnet:main Aug 5, 2025
5 checks passed
@drewnoakes drewnoakes deleted the warnings-as-errors branch August 5, 2025 01:53
@drewnoakes
Copy link
Member Author

I think I see why it could be flakey. Pushing up a fix.

#9720

@dotnet-policy-service dotnet-policy-service bot added this to the 17.15 milestone Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure Relates to build, test & run infrastructure of this repo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants