Closed dupdob closed 2 years ago
So I still don't completely understand it. Why symbols like NET6_0
are understood whereas symbols like NET6_0_OR_GREATER
are not? This basically says that all these _OR_GREATER
symbols were added with .NET5.
We need to test this, but are you certain that some symbols are automatically defined ? my understanding is that those are defined by MsBuild targets and Stryker does not use those (until we find a way to cleanly inject mutated source code during MsBuild builds).
Yes, actually Stryker currently works ideally for platform monikers other than _ORGREATER, and target-framework
option in the config also performs correctly with that.
Look: Repro.zip
For this class:
This is what Stryker does:
100% behavior that we need.
It looks like internally something somewhere doesn't use the .NET5+ SDK.
@psfinaki the build system is msbuild. We don't use msbuild so we don't have those symbols by default is what my guess would be. Why we do have some of the symbols I do not know.
update on this: Stryker uses Buildalyzer to capture the settings of the project. I guess that is how Stryker captures the predefined symbols, so maybe the problem lies within Buildalyzer. We need either to repro this or see if this is a known issue on Buildalyzer
I was able to reproduce this issue and could not see a workaround. So I created an issue with buildalyzer.
Thanks for that, @richardwerkman
I was able to fix the desired solution in Builalyzer so I created a PR. When it's merged and released we can fix this in Stryker
Is your feature request related to a problem? Please describe. See issue #1824
Describe the solution you'd like Stryker needs to declare predefined symbols when building the mutated assembly.
Describe alternatives you've considered Those symbols can be explicitly declared in the (VS/VC) project settings, but this defeats the purpose of predefined symbols.
Additional context It appears Roslyn does not add them automatically. So the code may have to declare them according the target framework version. Any official method would obviously be preferable.