Skip to content

Unit test builds emit nullable-reference and assertion-style warnings #7438

Closed

Description

@thomhurst

Summary

Building the unit test project emits nullable-reference and assertion-style warnings from its test sources. These diagnostics obscure new warnings during validation. The test project should build without these warnings.

Reproduction

On main at d87516c, run:

dotnet test --project tests/TUnit.UnitTests --framework net10.0 --treenode-filter '/*/*/ParallelMapTests/*'

The original report used ClassRowCleanupTests on #7417 at 02d1090. That class is not on this main revision; ParallelMapTests is present and building it compiles the unit-test project sources. #7417 is context, not a prerequisite.

Expected and actual

Expected: no nullable-reference or assertion-style warnings in unit-test source files.

Actual: CS8602 in ParallelMapTests.cs:105; CS8619 in PlaywrightVideoTests.cs:81,91 and PlaywrightTraceContextTests.cs:169; CS8604 in PropertyDataSourceInjectionTests.cs:161; TUnitAssertions0005 in EmptyDataSourceTests.cs, DependencyResolutionFailureTests.cs and LogSinkRouterTests.cs; TUnitAssertions0014/0015 in GenericTestGenerationTests.cs and EngineCancellationTokenTests.cs.

The relevant nullable code in ParallelMapTests and PlaywrightVideoTests is also present on main at d87516c. Analyzer and migration-project warnings are separately tracked in #7410; source-generator snapshot test warnings are #7428.

Acceptance criteria

Environment

.NET SDK 10.0.403, macOS arm64. Observed while validating #7417; the changed cleanup tests introduce none of these warnings.

Please correct these unit-test diagnostics while preserving the tests' behavior.

Activity

  1. thomhurst commented on Nov 3, 2026

    @thomhurst
    OwnerAuthor

    Triaged against origin/main at d87516c. The reported nullable and assertion patterns remain in the source; no closing PR or native dependencies were found. Updated the reproduction to use ParallelMapTests, which exists on main, and added acceptance criteria. The original ClassRowCleanupTests filter belongs to #7417; that PR is not a prerequisite. No build or tests were run during this source-only triage.

  2. added
    bugSomething isn't working
    P3Low: cleanup, minor enhancement, or rare edge case
    on Nov 3, 2026
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 workingin-progressWork is in progress

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions