Skip to content

Stryker.NET 4.8.1 fails to analyze .NET 9 projects - "Analyzing 0 projects" #3367

@Vivihung

Description

@Vivihung

Stryker.NET 4.8.1 fails to analyze .NET 9 projects - "Analyzing 0 projects"

Description

Stryker.NET 4.8.1 fails to find any projects to mutate when running against a .NET 9 test project, despite the test project having valid project references. The error message "No project references found. Please add a project reference to your test project and retry" is misleading, as project references exist and work correctly with dotnet build and dotnet test.

Environment

  • Stryker.NET Version: 4.8.1
  • .NET SDK Version: 9.0.307
  • OS: Windows
  • Target Framework: net9.0 (defined in Directory.Build.props)

Project Structure

src/
├── MyFeature/
│   ├── Service/
│   │   └── MyApp.MyFeature.Service.csproj
│   ├── Tests/
│   │   ├── MyApp.MyFeature.Tests.csproj (test project)
│   │   └── stryker-config.json
│   └── Shared/
│       └── MyApp.MyFeature.Shared.csproj
└── TestInfrastructure/
    ├── Infrastructure/
    │   └── MyApp.TestInfrastructure.csproj (marked with <IsTestProject>true</IsTestProject>)
    ├── Integration/
    │   └── MyApp.TestIntegration.csproj (marked with <IsTestProject>true</IsTestProject>)
    └── Shared/
        └── MyApp.TestShared.csproj (marked with <IsTestProject>true</IsTestProject>)

Test Project References

The test project (MyApp.MyFeature.Tests.csproj) contains:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <IsTestProject>true</IsTestProject>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\Service\MyApp.MyFeature.Service.csproj" />
    <ProjectReference Include="..\..\TestInfrastructure\Infrastructure\MyApp.TestInfrastructure.csproj" />
    <ProjectReference Include="..\..\TestInfrastructure\Integration\MyApp.TestIntegration.csproj" />
    <ProjectReference Include="..\..\TestInfrastructure\Shared\MyApp.TestShared.csproj" />
  </ItemGroup>
</Project>

Stryker Configuration

stryker-config.json:

{
  "stryker-config": {
    "project": "MyApp.MyFeature.Service.csproj",
    "test-case-filter": "Category=Unit",
    "reporters": ["progress", "html", "cleartext"],
    "thresholds": { "high": 80, "low": 60, "break": 40 },
    "concurrency": 4,
    "mutation-level": "standard",
    "ignore-mutations": ["string"]
  }
}

Steps to Reproduce

  1. Create a .NET 9 project with Directory.Build.props setting <TargetFramework>net9.0</TargetFramework>
  2. Create a test project that references multiple projects (including test infrastructure projects)
  3. Mark test infrastructure projects with <IsTestProject>true</IsTestProject>
  4. Run dotnet stryker from the test project directory

Expected Behavior

Stryker should:

  1. Identify the test project
  2. Find the project references (especially MyApp.MyFeature.Service.csproj)
  3. Begin mutation testing on the Service project

Actual Behavior

Stryker fails with:

[17:44:55 INF] Analyzing 1 test project(s).
[17:44:55 DBG] Analyzing 0 projects.
[17:44:55 DBG] Analyzing MyApp.MyFeature.Tests.csproj
[17:44:56 DBG] Analysis of project MyApp.MyFeature.Tests.csproj succeeded.

Stryker.NET failed to mutate your project. For more information see the logs below:

No project references found. Please add a project reference to your test project and retry.

The critical line is [17:44:55 DBG] Analyzing 0 projects. - Stryker is not detecting any projects to mutate.

Verification

The project builds and tests successfully:

$ cd src/MyFeature/Tests
$ dotnet build
# Build succeeded

$ dotnet test
# All tests pass

$ dotnet list reference
Project reference(s)
--------------------
..\Service\MyApp.MyFeature.Service.csproj
..\..\TestInfrastructure\Infrastructure\MyApp.TestInfrastructure.csproj
..\..\TestInfrastructure\Integration\MyApp.TestIntegration.csproj
..\..\TestInfrastructure\Shared\MyApp.TestShared.csproj

What I've Tried

  1. ✅ Added "project": "MyApp.MyFeature.Service.csproj" to stryker-config.json
  2. ✅ Passed --project "MyApp.MyFeature.Service.csproj" via command line
  3. ✅ Marked all test infrastructure projects with <IsTestProject>true</IsTestProject>
  4. ✅ Ran from both test project directory and service project directory (using --test-project)
  5. ✅ Verified no Microsoft.NET.Test.Sdk package in the service project
  6. ✅ Ran dotnet restore to ensure all references are resolved
  7. ✅ Verified project builds successfully

None of these resolved the issue.

Hypothesis

This appears to be a .NET 9 compatibility issue. Stryker.NET 4.8.1's package description states it "requires the dotnet 8 runtime or newer" and targets net8.0, but may not properly support .NET 9 projects yet.

Full Debug Output

Click to expand full trace output
[17:44:55 INF] Logging enabled at level Trace
Version: 4.8.1
[17:44:55 DBG] Stryker starting, version: 4.8.1

[17:44:55 INF] Stryker will use a max of 4 parallel testsessions.
[17:44:55 DBG] Stryker started with options: {"MsBuildPath": null, "DevMode": false, "ProjectPath": "C:\\repo\\src\\MyFeature\\Tests", "IsSolutionContext": false, "WorkingDirectory": "C:\\repo\\src\\MyFeature\\Tests", "OutputPath": "C:\\repo\\src\\MyFeature\\Tests\\StrykerOutput\\2025-12-02.17-44-55", "ReportPath": "C:\\repo\\src\\MyFeature\\Tests\\StrykerOutput\\2025-12-02.17-44-55\\reports", "ReportFileName": "mutation-report", "SolutionPath": null, "Configuration": null, "TargetFramework": null, "LogOptions": {"LogToFile": false, "LogLevel": "Verbose", "$type": "LogOptions"}, "MutationLevel": "Standard", "Thresholds": {"High": 80, "Low": 60, "Break": 40, "$type": "Thresholds"}, "AdditionalTimeout": 5000, "LanguageVersion": "Default", "Concurrency": 4, "SourceProjectName": "MyApp.MyFeature.Service.csproj", "TestProjects": [], "TestCaseFilter": "Category=Unit", "Reporters": ["Progress", "Html", "ClearText"], "WithBaseline": false, "BaselineProvider": "Disk", "AzureFileStorageUrl": "", "AzureFileStorageSas": "", "DashboardUrl": "https://dashboard.stryker-mutator.io", "DashboardApiKey": null, "Since": false, "SinceTarget": "master", "DiffIgnoreChanges": [], "FallbackVersion": "master", "ModuleName": "", "ReportTypeToOpen": null, "Mutate": [{"Glob": {"Tokens": [{"TrailingPathSeparator": {"Value": "\\", "$type": "PathSeparatorToken"}, "LeadingPathSeparator": null, "$type": "WildcardDirectoryToken"}, {"$type": "WildcardToken"}], "$type": "Glob"}, "IsExclude": false, "TextSpans": [{"Start": 0, "End": 2147483647, "Length": 2147483647, "IsEmpty": false, "$type": "TextSpan"}], "$type": "FilePattern"}], "IgnoredMethods": [], "ExcludedMutations": ["String"], "ExcludedLinqExpressions": [], "OptimizationMode": "CoverageBasedTest", "ProjectName": "", "ProjectVersion": "", "BreakOnInitialTestFailure": false, "MutantIdProvider": {"$type": "BasicIdProvider"}, "$type": "StrykerOptions"}
[17:44:55 INF] Analysis starting.
[17:44:55 VRB] Scanned the directory C:\repo\src\MyFeature\Tests for *.csproj files: found ["C:\\repo\\src\\MyFeature\\Tests\\MyApp.MyFeature.Tests.csproj"]
[17:44:55 VRB] Found project file C:\repo\src\MyFeature\Tests\MyApp.MyFeature.Tests.csproj in path C:\repo\src\MyFeature\Tests
[17:44:55 DBG] Using C:\repo\src\MyFeature\Tests\MyApp.MyFeature.Tests.csproj as test project
[17:44:55 INF] Analyzing 1 test project(s).
[17:44:55 DBG] Analyzing 0 projects.
[17:44:55 DBG] Analyzing MyApp.MyFeature.Tests.csproj
[17:44:56 DBG] Analysis of project MyApp.MyFeature.Tests.csproj succeeded.
[17:44:56 INF] Analysis complete.
[17:44:56 INF] Time Elapsed 00:00:00.9518740

Stryker.NET failed to mutate your project. For more information see the logs below:

No project references found. Please add a project reference to your test project and retry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions