Skip to content

test: restore mutation testing after the .NET 11 GA update - #41

Merged
Frognar merged 1 commit into
mainfrom
refactor/no-union-conversions-in-src
Nov 14, 2026
Merged

Frognar merged 1 commit into
mainfrom
refactor/no-union-conversions-in-src

Conversation

@Frognar

@Frognar Frognar commented Nov 14, 2026

Copy link
Copy Markdown
Owner

What

The nightly Stryker run has failed since #35 (.NET 11 GA) removed <LangVersion>preview</LangVersion>. There were two independent causes; both are fixed here and Stryker gives 100 % locally again (233 killed, 0 survived).

  1. Union conversions in src/ (CS8652). Stryker's bundled Roslyn still treats unions as a preview feature; without LangVersion preview it compiles the library with its own default and every union conversion (return value;, : none) fails to compile. Setting "language-version": "Preview" in stryker-config.json does not help: the mutants compile, but its preview unions are not compatible with the GA-built tests at run time. Fix: library code builds maybes with an internal Maybe<T>.Of(value) (delegates to IUnionMembers.Create) and default (None): 40 mechanical changes in 9 files, no behavior or public API change. A new last step of the Linux CI job builds the library as C# 14, which reports exactly the code Stryker cannot compile (same check as ci: check the library builds without union conversions dotResult#86).
  2. Test host crash during discovery. xUnit calls GetExportedTypes() on the test assembly; the public JSON model Profile has Maybe<…> fields, so loading it loads DotMaybe before Stryker's runner can resolve the mutated build. Every test host crashed with FileNotFoundException: DotMaybe, Version=2.0.0.0, and Stryker reported "unable to calculate a mutation score". Fix: Profile is internal.

Also bumps dotnet-stryker 5.0.0 → 5.1.0, the version dotResult uses (not the fix on its own: verified that 5.1.0 alone still crashed).

test: rather than fix:/refactor:: nothing changes for users, so no release.

Checklist

  • Tests cover the change (properties first, examples only where a property does not fit) (existing properties; Stryker 100 %)
  • dotnet test --solution dotMaybe.slnx is green locally (357 properties + 62 contracts, Release)
  • Public API changes have XML docs (n/a: no public API change)

🤖 Generated with Claude Code

https://claude.ai/code/session_012weRUz3QcTAaQw32ZmQkoK

The nightly Stryker run has failed since the GA update removed
LangVersion preview, for two reasons:

- Stryker's bundled Roslyn treats unions as a preview feature (CS8652), so
  the union conversions in src/ broke every mutated build. Library code now
  builds maybes with an internal Maybe<T>.Of(value) and default (None); CI
  builds the library as C# 14 to keep it that way.
- xUnit's discovery loads every public type of the test assembly; the public
  JSON model Profile (Maybe fields) loaded DotMaybe before Stryker could
  resolve the mutated build, crashing every test host. Profile is internal.

Also bumps dotnet-stryker to 5.1.0, as in dotResult. Locally: 100 %.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012weRUz3QcTAaQw32ZmQkoK
@Frognar
Frognar merged commit 8add90e into main Nov 14, 2026
5 checks passed
@Frognar
Frognar deleted the refactor/no-union-conversions-in-src branch November 14, 2026 07:23
@Frognar Frognar mentioned this pull request Nov 14, 2026
3 tasks done
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.

1 participant