Closed bonner-earle closed 3 months ago
Can you provide us with a reproduction project?
Yes, this was tested on WSL Debian with .net 8 sdk installed
Just to note, we're experiencing this on 4.0.2 too for an ASP.NET 8 app that also doesn't use any Razor
Thanks for providing a repro project. I do reproduce it, so I am able to analyze this issue. At this stage, I am unable to provide an ETA for a proper fix nor if there is a workaround. Stryker only provide basic supports for code analyzers and generators, this mainly comes from the fact that there is little to no documentation on how to use these. Especially, we have yet to find a trustworthy source on how they are invoked during a normal build.
Some standard code generators and analyzers are invoked even when you do not explicitly reference them. The list depends on which SDK your project refers to. For Web, you have 3 default generators: JsonSourceGenerator, LoggerMessageGenerator and RazorSourceGenerator.
It turns out that the RazorSourceGenerator
requires some setting to be set (see code). We have yet to understand how to pass this parameter properly.
Until we understand how to do it, the best we can do is continue even if there is an error at this stage. This will solve the problem for project not using Razor, but Razor project will keep failing (as of now, so this is not a regression)
Same issue with 4.0.2. 4.0.0 works, but get 2 warnings :
[11:37:46 WRN] Failed to load analyzer 'Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators': (error : ReferencesNewerCompiler, analyzer: All). [11:37:46 WRN] The analyzer 'Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators' references a newer version (4.9.0.0) of the compiler than the one used by Stryker.NET.
thanks for reporting. It kinda confirm the original analysis: Stryker V4.0 used the previous Roslyn version and the Razor code generator refused to load altogether. Later Stryker versions are able to load the generator, but it refuses to run due to insufficient configuration data. PR #2891 should fix that.
Describe the bug Running a project that worked on 4.0.0, throws the error
Failed to generate source code for mutated assembly: error RZ3600: Invalid value ''' for RazorLangVersion. Valid values include 'Latest' or a valid version in range 1.0 to 8.0.
when run in 4.0.1 The project doesn't contain any razor files It is a .net 6 Azure app service project the build is running on Linux, running stryker 4.0.1 on my box (Windows 11) works We don't explicitly specify a razor lang version anywhereLogs Not got any as only occurs on our build server
Expected behavior No error
Desktop (please complete the following information):
Additional context N/A