stryker-mutator / stryker-net

Mutation testing for .NET core and .NET framework!
https://stryker-mutator.io
Apache License 2.0
1.78k stars 185 forks source link

Problem with referenced Razor pages: 'Stryker.NET could not compile the project after mutation.' #2142

Closed johanwintgens-ls closed 1 year ago

johanwintgens-ls commented 2 years ago

Describe the bug Stryker runs into problems whenever I try to unleash it on my Solution. I have tried to exclude the problem files/project both in the config file and in the dotnet stryker command, to no avail. The following output is produced with the command dotnet stryker --solution "C:\Users\johan.wintgens\source\repos\Lansweeper.IT\src\Lansweeper.IT.sln" -m "!**/CloudOverviewBase.cs" -m "!**/LinkToCloudBase.cs" -m "!**/SensorsBase.cs" -m "!**/*.razor", but I've also tried "!**/Lansweeper.IT.Hub/**/*.*" and tried lots of things via config and via cmd params, but none of that seems to work. Also, passing the solution path via config only seems to work for me when I use the full path, but in the documentation it looks like it should work with relative paths...

Logs Output: image Config right now: image

Expected behavior Either compile after mutation, or respect the exclusions given

Desktop (please complete the following information): Windows 10 - VS22 - ASP.NET - .NET 6.0 - dotnet-stryker 2.1.2

Additional context The 'types' that are not found are actually Razor pages, which seems to be the problem. At this point I would just like to exclude the whole Lansweeper.IT.Hub project, but I can't seem to get around it.

rouke-broersma commented 2 years ago

Solution runs are currently not functional. I cannot recommend that you try this. Instead, run stryker from either the test project or the project under test (while specifying which test project to use). When you run stryker this way the project containing razor pages should not be included.