はじめに
GitHub Actions上でstryker-netがsetup-dotnetで.net9を指定していたときは動いていたのに、.net10に変えたら急にエラーがでてくるようになりました。
github.com
[12:21:53 INF] Analysis starting. [12:21:53 INF] Identifying projects to mutate in .../sandbox.sln. This can take a while. [12:21:56 INF] Analysis complete. [12:21:56 ERR] An error occurred during the mutation test run System.FormatException: Commandline could not be parsed. at Stryker.Core.Initialisation.InputFileResolver.AnalyzeAllNeededProjects(List1 projectList, IStrykerOptions options, IAnalyzerManager manager, ScanMode mode) at Stryker.Core.Initialisation.InputFileResolver.AnalyzeAndIdentifyProjects(List1 projectList, IStrykerOptions options, IAnalyzerManager manager, ScanMode mode) at Stryker.Core.Initialisation.InputFileResolver.ResolveSourceProjectInfos(IStrykerOptions options) at Stryker.Core.Initialisation.InitialisationProcess.GetMutableProjectsInfo(IStrykerOptions options) at Stryker.Core.Initialisation.ProjectOrchestrator.MutateProjects(IStrykerOptions options, IReporter reporters, ITestRunner runner) at Stryker.Core.StrykerRunner.RunMutationTest(IStrykerInputs inputs, ILoggerFactory loggerFactory, IProjectOrchestrator projectOrchestrator)
その対処法を見つけたので書き残しておきたいと思います。
原因
stryker-netが依存しているBuildalyzerが、.NET10 RC2からのMSBuildの変更に追従できていなかったことが問題なようです。
There seem to be some changes in newer versions of MSBuild command line for .NET 10 RC2 and some newer versions of .NET 9 that cause Buildalyzer to fail to parse the arguments, which then causes issues for tools built on top of Buildalyzer such as Stryker.
Incompatibility with .NET 10 from RC2 · Issue #318 · Buildalyzer/Buildalyzer · GitHub
詳細は該当Issueと対応したPRに記載されています。
github.com
github.com
github.com
対処法
最新バージョンのStryker.NETを利用してください。