Skip to content

Comments

Add warning waves proposal#12713

Open
chsienki wants to merge 1 commit intodotnet:mainfrom
chsienki:warning_waves_proposal
Open

Add warning waves proposal#12713
chsienki wants to merge 1 commit intodotnet:mainfrom
chsienki:warning_waves_proposal

Conversation

@chsienki
Copy link
Member

@chsienki chsienki commented Jan 24, 2026

@chsienki chsienki requested a review from a team as a code owner January 24, 2026 04:28
@chsienki chsienki force-pushed the warning_waves_proposal branch from f0df091 to cebbe58 Compare January 24, 2026 04:29

<!-- Use wave 10.0 to suppress warnings introduced in wave 11.0 -->
<!-- All existing warnings from wave 10.0 are still reported -->
<RazorWarningWave>10.0</RazorWarningWave>
Copy link
Member Author

Choose a reason for hiding this comment

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

MSBuild property name is up for debate

Copy link
Member

Choose a reason for hiding this comment

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

I think RazorWarningLevel to match Roslyn (WarningLevel)

2. What is the minimum warning wave version we should support? Are values like 8 valid, or only 10+?

3. Should we have a 'Latest' or 'Preview' warning wave value? Seems like if we want to do 1. then we would need these, but not otherwise the omission of the value serves the same purpose.

Copy link
Member Author

@chsienki chsienki Jan 24, 2026

Choose a reason for hiding this comment

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

Should have another open question about if we should tie RazorWarningWave to AnalysisLevel by default as discussed in the language design issue. My thought is we probably should.


## Open Questions

1. Should there be a way to opt-in to future warnings (set wave higher than language version) for early adopters?
Copy link
Member

Choose a reason for hiding this comment

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

Sounds useful and simple (in Roslyn, this is done by setting warn level to 9999)


## References

- [C# Warning Waves Documentation](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/warning-waves)
Copy link
Member

Choose a reason for hiding this comment

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

Comment on lines +11 to +15
Currently, upgrading to a newer version of .NET brings the corresponding Razor language version by default as the language version is tied to the TFM. When new warnings are introduced in a language version, users with `<TreatWarningsAsErrors>true</TreatWarningsAsErrors>` face a difficult choice:

1. **Fix all new warnings immediately** - This can be time-consuming and block upgrades, especially for large codebases.
2. **Downgrade the language version** - This allows the upgrade but prevents users from using new language features.
3. **Disable specific warnings** - This requires identifying each new warning and suppressing them individually, which is error-prone and may hide legitimate issues.
Copy link
Member

Choose a reason for hiding this comment

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

Is the main value prop of the warnings to simplify the bulk disabling of new warnings (which in other circumstances would require one of the three things you mentioned).

If so, would it make sense to have a Latest/Preview value by default (given that new users can now opt-out with a single gesture). As an alternative, it would default to the TFM unless explicitly configured, won't it?

4. **Tooling Updates**: Ensure IDE tooling (Visual Studio, VS Code) respects warning wave settings.
5. **Documentation**: Document all warnings and their associated waves.

## Open Questions
Copy link
Member

@jjonescz jjonescz Jan 26, 2026

Choose a reason for hiding this comment

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

Why not simply be consistent with roslyn in all aspects of warning waves?


### Warning Wave Versioning

Warning waves will be versioned to match Razor language versions:
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we should mention Razor language version, as its essentially only by convention that it matches the .NET version, and that's what we're really matching IMO. Also ties with Roslyn, which definitely doesn't match lang version and warning waves.


<!-- Use wave 10.0 to suppress warnings introduced in wave 11.0 -->
<!-- All existing warnings from wave 10.0 are still reported -->
<RazorWarningWave>10.0</RazorWarningWave>
Copy link
Member

Choose a reason for hiding this comment

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

I think RazorWarningLevel to match Roslyn (WarningLevel)


1. Should there be a way to opt-in to future warnings (set wave higher than language version) for early adopters?

2. What is the minimum warning wave version we should support? Are values like 8 valid, or only 10+?
Copy link
Member

Choose a reason for hiding this comment

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

If we don't allow this, presumably that means someone targetting .NET 8 with the latest SDK just immediately gets errors about their warning wave, which they didn't even know about, right? Feels bad man.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants