Skip to content

Nullable-event regression tests use unsupported warning-error pragmas #7432

Closed as not planned

Description

@thomhurst

Summary

The nullable-event regression tests use five unsupported C# directives, #pragma warning error CS8604 through CS8615. The compiler emits CS1634 instead of promoting those diagnostics to errors, so the intended compile-time protection is ineffective.

Reproduction

Run dotnet test --project tests/TUnit.Mocks.Tests --framework net10.0 --treenode-filter "/*/*/Issue5425Tests/*" with SDK 10.0.403. tests/TUnit.Mocks.Tests/Issue5425Tests.cs:13-17 produces CS1634 (expected disable or restore).

Expected and actual

The file comments promise that nullable-event signature regressions fail compilation. These pragmas do not enforce that promise. Replace them with supported diagnostic severity configuration and verify it applies to the generated code that produces the targeted warnings.

Environment

.NET SDK 10.0.403, macOS arm64, PR #7405 head 68112ca.

Activity

  1. added
    bugSomething isn't working
    P3Low: cleanup, minor enhancement, or rare edge case
    on Nov 3, 2026
  2. thomhurst commented on Nov 3, 2026

    @thomhurst
    OwnerAuthor

    Superseded by PR #7414 and #7436. Verified #7414 at e3544bce4d609e07ad249d911087dda9b0511dbc: it removes all five unsupported pragmas from Issue5425Tests.cs and promotes those diagnostics in the project file. The remaining requirement to enforce diagnostics inside generated code is now explicit in #7436, including a positive control. Closing this duplicate tracking item; the generated-code guard remains open in #7436.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low: cleanup, minor enhancement, or rare edge casebugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions