stryker-mutator / stryker-net

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

"Could not find build environment" on large sln file. #2449

Closed petertiedemann closed 2 months ago

petertiedemann commented 1 year ago

Describe the bug Running stryker against a large sln file ( 278 projects) on a 5950x (16c/32t) CPU leads to multiple "Could not find build environment" errors.

Logs I couldn't figure out how to output the log when running from a configuration file, but a snippet is included here, please see additional context below.

Unhandled exception. System.AggregateException: One or more errors occurred. (Could not find build environment) (Could not find build environment) (Could not find build environment) (Could not find build environment) (Could not find build environment) (Could not find build environment) (Could not find build environment)
 ---> System.InvalidOperationException: Could not find build environment
   at Buildalyzer.Environment.EnvironmentFactory.GetBuildEnvironment(String targetFramework, EnvironmentOptions options)
   at Buildalyzer.Environment.EnvironmentFactory.GetBuildEnvironment(String targetFramework)
   at Buildalyzer.ProjectAnalyzer.Build(String targetFramework)
   at Buildalyzer.ProjectAnalyzer.Build()
   at Stryker.Core.Initialisation.ProjectOrchestrator.<>c__DisplayClass7_0.<AnalyzeSolution>b__0(IProjectAnalyzer project) in /_/src/Stryker.Core/Stryker.Core/Initialisation/ProjectOrchestrator.cs:line 124
   at System.Threading.Tasks.Parallel.<>c__DisplayClass33_0`2.<ForEachWorker>b__0(Int32 i)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)

Expected behavior No failures

Desktop (please complete the following information):

Additional context The underlying issue appears to be from Buildalyzer, where I have reported this: https://github.com/daveaglick/Buildalyzer/issues/227

I suspect it could also be worked around from stryker by limiting the concurrency (for example using the value of -c CLI flag here as well)?

richardwerkman commented 1 year ago

I've encountered this behaviour as well now. But I've seen it only once so it seems flaky behaviour. Was yours also flaky or did you encounter this on every run?

OS: MacOS Framework Version net6.0 Stryker Version 3.7.1

JustineSondore commented 1 year ago

Not much of substance to add, but I've also encountered this error.

Solution is not that large, ~30 projects. Stryker.Net runs fine on the solution on my developer's machine (win). But in the Azure pipelines it keeps throwing the above mentioned errors on one of the build agents. Yet on another build agent it runs fine, and unfortunately I don't really know how the "bad" agent is different.

rouke-broersma commented 1 year ago

@JustineSondore are they the same vm type?

petertiedemann commented 1 year ago

@richardwerkman It always failed for me, but in slightly different ways each time if I recall correctly.

dupdob commented 2 months ago

The underlying Buildalyzer have been closed, fix has been delivered and Stryker integrated it. Closing it as fixed