Repository navigation
Description
Summary
Building the test application emits analyzer-release tracking and nullable-reference warnings from the analyzer and code-fixer projects. These warnings obscure new diagnostics during development; a clean build should keep those projects warning-free.
Reproduction
Run dotnet test --project tests/TUnit.TestProject --framework net10.0 --treenode-filter '/*/TUnit.TestProject.Bugs._6554/PartialInjectionFailure*/*' from a clean checkout. Build diagnostics include RS2002 for TUnit0074–TUnit0076 in TUnit.Analyzers, RS2008 for TUNIT0999 in TestMetadataGenerator.cs, CS8604 in BaseMigrationCodeFixProvider.cs:218, CS8600/CS8604 in NUnitExpectedResultRewriter.cs:168/180, and CS8602 in NUnitMigrationCodeFixProvider.cs:334.
Expected and actual
These projects should build without release-tracking or nullable warnings. The listed diagnostics are emitted before the filtered test run.
Environment
SDK 10.0.403, macOS arm64, PR #7391 head 85020f6 (these files are unchanged by that PR). Please correct the release metadata and nullable flows in these projects.
Remaining scope and acceptance criteria
The following warnings reported in the discussion are included in this issue, alongside the original analyzer and migration code-fixer warnings:
- RS2008 for TM006, TM008 and TM009 in
src/TUnit.Mocks.SourceGenerator/Diagnostics.cs, built through bothTUnit.Mocks.SourceGenerator.Roslyn47andTUnit.Mocks.SourceGenerator.Roslyn414. - RS1032 in
src/TUnit.Analyzers.Internal/CultureSensitiveFormattingAnalyzer.cs,src/TUnit.Mocks.Analyzers/Rules.cs, andsrc/TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs. - RS2008 from the internal analyzer and assertion source-generator projects.
Acceptance criteria:
- Correct the release-tracking metadata and diagnostic messages responsible for the reported RS2002, RS2008 and RS1032 warnings, rather than globally suppressing those warnings.
- Correct the reported nullable flows in
src/TUnit.Analyzers.CodeFixers/Base/BaseMigrationCodeFixProvider.cs,NUnitExpectedResultRewriter.cs, andNUnitMigrationCodeFixProvider.cs, preserving migration behavior. - Clean builds of the affected projects emit none of the listed warnings. Run the relevant analyzer, code-fixer and generator tests, including
tests/TUnit.Mocks.SourceGenerator.Testson net10.0; review affected snapshots if generated output changes.
Triage at d87516cb9c confirmed the reported nullable code and diagnostic descriptors remain. Original line numbers above are historical; use the named files and diagnostics to locate them. The follow-up warning reports came from SDK 10.0.403 on macOS arm64; this triage did not rerun builds.
Activity
thomhurst commentedon Nov 2, 2026
Also reproduced RS2008 for TM006, TM008 and TM009 in
src/TUnit.Mocks.SourceGenerator/Diagnostics.cswhile building bothsrc/TUnit.Mocks.SourceGenerator.Roslyn47andsrc/TUnit.Mocks.SourceGenerator.Roslyn414with SDK 10.0.403 on macOS arm64 at 301d94b. Each build succeeds with three warnings. Please include those shared mock-generator diagnostics in the release-tracking fix.thomhurst commentedon Nov 2, 2026
Building the mock generator tests at PR #7406 also emits RS1032 from
src/TUnit.Analyzers.Internal/CultureSensitiveFormattingAnalyzer.cs:37,src/TUnit.Mocks.Analyzers/Rules.cs:30,71, andsrc/TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs:46,55, plus RS2008 from the internal and assertion generators. Reproduction: SDK 10.0.403,dotnet test --project tests/TUnit.Mocks.SourceGenerator.Tests --framework net10.0. Please include these existing diagnostic-message and release-tracking warnings in this cleanup.thomhurst commentedon Nov 3, 2026
Triage against
d87516cb9c: the reported nullable flows and diagnostic descriptors remain. Folded both follow-up warning reports into the body and added acceptance criteria so the next implementation covers the full reported scope. No builds were run in this triage.thomhurst commentedon Nov 3, 2026
Building tests/TUnit.Analyzers.Tests at 309ed46 with SDK 10.0.403 on macOS arm64 also reports CS8602 in src/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs:7252. The existing release-tracking and code-fixer warnings reproduce too.
thomhurst commentedon Nov 3, 2026
Additional nullable warning observed while validating #7455 against main
a412ddd5a5:src/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs, inInferGenericTypesFromArgumentSymbols, dereferences nullablecompilationatcompilation.GetSpecialType(SpecialType.System_Object)in the null-only type-parameter fallback (CS8602, line 7508 at this PR head). Reproduce with SDK 10.0.403 on macOS arm64 usingdotnet test --project tests/TUnit.Core.SourceGenerator.Tests --framework net10.0. This block is unchanged by #7455. Please include this generator nullable flow in the warning cleanup, preserving null-only class inference.thomhurst commentedon Nov 4, 2026
A clean targeted build at
592bb959a2with SDK 10.0.403 on macOS arm64 also emits CS8602 insrc/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs:7704and RS2008 for TUNITGEN005 inStaticPropertyInitializationGenerator.cs:23. Reproduce withdotnet test --project tests/TUnit.TestProject --framework net10.0 --treenode-filter '/*/TUnit.TestProject.Bugs._7451/ClassAndMethodParameterInference*/*'. Please include these nullable/release-tracking warnings in this issue.thomhurst commentedon Nov 4, 2026
Confirmed the existing nullable and release-tracking warnings while building the TUnit.Core package dependencies for #7533 on main be37704 with SDK 10.0.403 (macOS arm64).
dotnet buildof a solution filter containing TUnit.Core, its analyzer/source-generator Roslyn variants, and TUnit.Analyzers.CodeFixers succeeded with 24 warnings, including the nullable diagnostics already listed here.thomhurst commentedon Nov 4, 2026
The Release/net10.0 targeted TestProject build at
8d0cffe384also emits CS8602 insrc/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs:7704, RS2008 for TUNITGEN005 inStaticPropertyInitializationGenerator.cs:23, and RS2002 for TUnitAssertions0016. Reproduction:dotnet test --project tests/TUnit.TestProject --framework net10.0 -c Release --treenode-filter '/*/*/DependsOnTests2/*' --maximum-parallel-tests 4. SDK 10.0.403, macOS arm64. The existing migration code-fixer warnings also remain.thomhurst commentedon Nov 4, 2026
The generator snapshot run for #7569 also emitted CS8602 in the unchanged
InferTypesFromArgumentsAttributecode inTestMetadataGenerator.cs(line 6958 after the cleanup), and inMethodAssertionGenerator.cs:957. Command:dotnet test --project tests/TUnit.Core.SourceGenerator.Tests --framework net10.0, SDK 10.0.403, macOS arm64. Please include those nullable warnings in this cleanup; all 337 non-skipped tests passed.thomhurst commentedon Nov 4, 2026
Confirmed during #7552 validation on main base
885ee5f799, SDK 10.0.403, macOS arm64: a clean targeted build still emits the release-tracking and migration nullable warnings tracked here. It also emits CS8602 atsrc/TUnit.Core.SourceGenerator/Generators/TestMetadataGenerator.cs:7374(possible null dereference). Reproduce withdotnet test --project tests/TUnit.TestProject -f net10.0 --treenode-filter '/*/*/PreservedGenericTupleTests/*'in a clean worktree. Please include that generator nullable flow in the existing warning cleanup.thomhurst commentedon Nov 4, 2026
Confirmed RS2008 and RS1032 warnings from src/TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs while building tests/TUnit.Engine.Tests/TUnit.Engine.Tests.csproj -c Release -f net10.0 at a85bb69 (SDK 10.0.403, macOS arm64). Build succeeded with 281 warnings and zero errors. These diagnostics remain within this issue’s recorded scope.
thomhurst commentedon Nov 4, 2026
Reproduced the existing release-tracking, diagnostic-message and nullable warnings while building the analyzer tests for #7610 on SDK 10.0.403/macOS arm64. This also includes CS8602 in src/TUnit.Assertions.SourceGenerator/Generators/MethodAssertionGenerator.cs:957. Command: dotnet test --project tests/TUnit.Analyzers.Tests/TUnit.Analyzers.Tests.csproj --framework net10.0 --treenode-filter "///MethodDataSourceAnalyzerTests/*". The 142 selected tests pass; warning cleanup remains outside #7610.
thomhurst commentedon Nov 5, 2026
Reproduced RS1032/RS2008/RS2002 release-tracking warnings and nullable warnings while building the net10.0 core generator tests for #7351 on main base 1a40c80; includes TestMetadataGenerator.cs(6648), MethodAssertionGenerator.cs(957), and code-fixer warnings already covered here.
thomhurst commentedon Nov 5, 2026
Still reproducible on main 555b85d with SDK 10.0.403 on macOS arm64 while building TUnit.UnitTests for net10.0. The build emits RS2008 in the core/internal/assertion generators, RS2002 for TUnitAssertions0014–0016, and the previously reported nullable migration warnings. The targeted discovery ownership tests pass; these existing build diagnostics remain covered by this issue.
thomhurst commentedon Nov 5, 2026
Reproduced the existing RS2002/RS2008 and migration code-fixer CS8600/CS8602/CS8604 warnings while building the #7388 targeted tests on main 7780a6a with SDK 10.0.403 on macOS arm64. The affected files and diagnostics match the scope already recorded here.
thomhurst commentedon Nov 5, 2026
Confirmed while validating #7433 on main base b9d47de: the mock source-generator test build reports CS8602 in MethodAssertionGenerator.cs:957, CS8600/CS8604 in NUnitExpectedResultRewriter.cs:168/180, and CS8602 in NUnitMigrationCodeFixProvider.cs:334. These existing nullable warnings remain; the relevant tests pass.
thomhurst commentedon Nov 5, 2026
Confirmed the existing RS1032/RS2008/RS2002 and nullable build warnings during #7436 validation on main base 45d4a52, SDK 10.0.403, macOS arm64. Reproduction: dotnet test --project tests/TUnit.Mocks.SourceGenerator.Tests --framework net10.0. The warnings remain within the scope already tracked here.
thomhurst commentedon Nov 5, 2026
Reproduced on main 5a18e53 while validating #7462 with dotnet test --project tests/TUnit.Analyzers.Tests --framework net10.0: RS2000/RS2002 release-tracking warnings and CS8600/CS8604/CS8602 nullable warnings in the NUnit migration code fixers remain. Targeted tests pass; expected behavior is a warning-free analyzer/code-fixer build.