Skip to content

Exclusion glob !Program.cs is recognized but ignored in Blazor WebAssembly project #3275

@SeyTi01

Description

@SeyTi01

Describe the bug
When running Stryker.NET against a Blazor WebAssembly project with a mutate array that excludes "!**/Program.cs", Stryker correctly parses the exclusion into its options but continues to inject mutants into Program.cs. This leads to compile errors (e.g. “Type or namespace name ‘App’ could not be found”) and ultimately a failed mutation run.

Logs
logs.zip

2025-08-07T23:43:14.2837+02:00 [DBG] Stryker started with options: … 
  "Mutate": [
    FilePattern { Glob: Glob { Tokens: [WildcardDirectoryToken {…}, LiteralToken { Value: "Program.cs" }] }, IsExclude: True },
    FilePattern { Glob: Glob { Tokens: [WildcardDirectoryToken {…}, WildcardToken { }] }, IsExclude: False }
  ], …
2025-08-07T23:43:23.3235+02:00 [DBG] Mutating "D:\Projects\RiderProjects\StrykerBugProject\StrykerBugProject\Program.cs"
2025-08-07T23:43:23.9468+02:00 [DBG] Compilation failed: Type or namespace name "App" could not be found … Program.cs[400..403]
2025-08-07T23:43:24.0011+02:00 [WRN] Stryker.NET encountered a compile error in "…\Program.cs" (at 7:35) with message: "Type or namespace name 'App' could not be found"
2025-08-07T23:43:24.0159295+02:00 [FTL] Stryker.NET could not compile the project after mutation. This is probably an error for Stryker.NET and not your project. Please report this issue on github with the previous error message. (b29c3534)
2025-08-07T23:43:24.0262187+02:00 [ERR] An error occurred during the mutation test run  (2ecaed66)

Expected behavior
Stryker should apply the !Program.cs exclusion glob and skip injecting mutations into Program.cs.

Desktop:

  • OS: Windows 11 Pro
  • Type of project: Blazor WebAssembly
  • Framework Version: ASP.NET Core 9.0
  • Stryker Version: 4.8.0

Additional context
Example project to reproduce: https://github.com/SeyTi01/stryker-bug-project

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