You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to the template re-sync (#182): CODESTYLE.md now bans #pragma warning disable in favor of [SuppressMessage] / .editorconfig. Two test cases in LanguageTagTests.cs used #pragma; this conforms them to the rule. Surfaced by Copilot on #183.
Changes
CA1508 (analyzer - "'tag1 == tag2' is always true"): annotate OperatorEquals_BothNull_ReturnsTrue with [SuppressMessage] + Justification. The test deliberately compares two null tags to exercise operator== with both operands null.
CS8602 (compiler nullable warning): [SuppressMessage] cannot suppress compiler CS#### diagnostics, only #pragma/NoWarn or code can. Replaced the #pragma with the null-forgiving operator on the Equals(object?) receiver - idiomatic and rule-compliant (CODESTYLE bans #pragma, not !).
No #pragma warning directives remain in the codebase.
…ving
CODESTYLE.md now bans `#pragma warning disable` in favor of
[SuppressMessage] / .editorconfig. Conform the two test cases:
- CA1508 (analyzer): annotate OperatorEquals_BothNull_ReturnsTrue with
[SuppressMessage] + Justification - the test intentionally compares
two null tags to exercise operator== with both operands null.
- CS8602 (compiler nullable; [SuppressMessage] cannot suppress it): use
the null-forgiving operator on the Equals(object?) receiver instead.
Build: 0 warnings / 0 errors. Tests: 257/257 pass.
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Aligns the test suite with the newly consolidated CODESTYLE.md rule (post template re-sync) that bans #pragma warning disable by replacing pragma-based suppressions with [SuppressMessage] (for analyzer warnings) and code-based nullability handling (for compiler warnings).
Changes:
Replace #pragma warning disable CS8602 in Equals_NullTag_ReturnsFalse by using the null-forgiving operator on the call site.
Replace #pragma warning disable CA1508 in OperatorEquals_BothNull_ReturnsTrue with a method-level [SuppressMessage] including a justification.
Copilot read tag! as redundant. It is load-bearing: removing it
reintroduces CS8602 (verified by a clean build), because the compiler
flags the Equals(object?) overload's receiver as possibly-null here -
a false-positive that [SuppressMessage] cannot suppress (CS#### are
compiler, not analyzer, diagnostics). Add a one-line comment so the
suppression reads intentionally rather than as a real null concern.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the template re-sync (#182):
CODESTYLE.mdnow bans#pragma warning disablein favor of[SuppressMessage]/.editorconfig. Two test cases inLanguageTagTests.csused#pragma; this conforms them to the rule. Surfaced by Copilot on #183.Changes
OperatorEquals_BothNull_ReturnsTruewith[SuppressMessage]+Justification. The test deliberately compares two null tags to exerciseoperator==with both operands null.[SuppressMessage]cannot suppress compilerCS####diagnostics, only#pragma/NoWarnor code can. Replaced the#pragmawith the null-forgiving operator on theEquals(object?)receiver - idiomatic and rule-compliant (CODESTYLE bans#pragma, not!).No
#pragma warningdirectives remain in the codebase.Verification
dotnet build(no-incremental): 0 warnings / 0 errorsdotnet format style --verify-no-changes: cleandotnet test: 257/257 pass